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_custom_hash_expression() {
test_struct!([custom_hash="0x12345678", custom_hash_format="expression"]
{}
[(Djb2Hasher, Djb2Hasher, 0x12345678)]);
} | rust_cleaned_test_functions.jsonl/43892 | {
"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,
15875,
8950,
28068,
368,
341,
262,
1273,
15126,
0,
2561,
9163,
8950,
428,
15,
87,
16,
17,
18,
19,
20,
21,
22,
23,
497,
2526,
8950,
8955,
428,
28099,
7026,
338,
5613,
338,
17826,
35,
38978,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode() {
assert_encode_decode::<EventAccumulatorSchema>(
&(100, Position::from_inorder_index(100)),
&HashValue::random(),
);
} | rust_cleaned_test_functions.jsonl/129721 | {
"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,
11224,
15227,
368,
341,
262,
2060,
11224,
15227,
27638,
1556,
14603,
372,
10511,
8632,
17055,
286,
22796,
16,
15,
15,
11,
12380,
486,
1499,
1243,
1358,
3560,
7,
16,
15,
15,
6965,
286,
609,
6370,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_replace_newline() {
let mut args = HashMap::new();
args.insert("from".to_string(), to_value(&"\n").unwrap());
args.insert("to".to_string(), to_value(&"<br>").unwrap());
let result = replace(&to_value(&"Animal Alphabets\nB is for Bee-Eater").unwrap(), &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value("Animal Alphabets<br>B is for Bee-Eater").unwrap());
} | rust_cleaned_test_functions.jsonl/119648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
5921,
1056,
368,
341,
286,
1077,
5206,
2827,
284,
10528,
486,
931,
543,
286,
2827,
7030,
445,
1499,
3263,
983,
3904,
1507,
311,
3142,
2099,
11934,
77,
1827,
15454,
1423,
286,
2827,
7030,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accounts_cluster_bench() {
solana_logger::setup();
let validator_config = ValidatorConfig::default();
let num_nodes = 1;
let mut config = ClusterConfig {
cluster_lamports: 10_000_000,
poh_config: PohConfig::new_sleep(Duration::from_millis(50)),
node_stakes: vec![100; num_nodes],
validator_configs: make_identical_validator_configs(&validator_config, num_nodes),
..ClusterConfig::default()
};
let faucet_addr = SocketAddr::from(([127, 0, 0, 1], 9900));
let cluster = LocalCluster::new(&mut config);
let iterations = 10;
let maybe_space = None;
let batch_size = 100;
let close_nth = 100;
let maybe_lamports = None;
let num_instructions = 2;
let mut start = Measure::start("total accounts run");
run_accounts_bench(
cluster.entry_point_info.rpc,
faucet_addr,
&[&cluster.funding_keypair],
iterations,
maybe_space,
batch_size,
close_nth,
maybe_lamports,
num_instructions,
None,
);
start.stop();
info!("{}", start);
} | rust_cleaned_test_functions.jsonl/41987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
28441,
880,
19762,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
22935,
5332,
284,
32566,
2648,
486,
2258,
543,
286,
1077,
1629,
14896,
284,
220,
16,
280,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poll() {
let transport = ZmqTransport::default();
tests::test_poll(transport, "zmq:tcp://127.0.0.1:8081", Ready::writable());
} | rust_cleaned_test_functions.jsonl/85534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40002,
368,
341,
286,
1077,
7557,
284,
1863,
27674,
27560,
486,
2258,
1428,
286,
7032,
486,
1944,
40002,
7,
26445,
11,
330,
89,
27674,
25,
27161,
1110,
16,
17,
22,
13,
15,
13,
15,
13,
16,
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 |
#[test]
fn test_perm_two_rotations() {
assert_eq!(perm_to_atoms(&[1, 2, 0, 4, 3]), tvec!((0, 2), (3, 4)));
} | rust_cleaned_test_functions.jsonl/126324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31961,
23241,
38256,
804,
368,
341,
286,
2060,
10714,
10297,
19913,
2346,
67755,
2099,
58,
16,
11,
220,
17,
11,
220,
15,
11,
220,
19,
11,
220,
18,
9719,
259,
4083,
0,
1188,
15,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_part2() {
assert_eq!(
part2(
r"
eyr:1972 cid:100
hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926
iyr:2019
hcl:#602927 eyr:1967 hgt:170cm
ecl:grn pid:012533040 byr:1946
hcl:dab227 iyr:2012
ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277
hgt:59cm ecl:zzz
eyr:2038 hcl:74454a iyr:2023
pid:3556412378 byr:2007"
),
Some(0)
);
assert_eq!(
part2(
r"
pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980
hcl:#623a2f
eyr:2029 ecl:blu cid:129 byr:1989
iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm
hcl:#888785
hgt:164cm byr:2001 iyr:2015 cid:88
pid:545766238 ecl:hzl
eyr:2022
iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719
"
),
Some(4)
);
} | rust_cleaned_test_functions.jsonl/16295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 462
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
17,
368,
341,
262,
2060,
10714,
33673,
286,
949,
17,
1006,
310,
435,
698,
1195,
81,
25,
16,
24,
22,
17,
32141,
25,
16,
15,
15,
198,
71,
564,
14111,
16,
23,
16,
22,
16,
67,
59958,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_digit10() {
let mut lexer = Cursor::new("1000 +10 10## -1/2 .001");
assert_eq!(lexer.get_token(), Some(Token::new(Number, 4)));
assert_eq!(lexer.get_token(), Some(Token::new(Whitespace, 1)));
assert_eq!(lexer.get_token(), Some(Token::new(Number, 3)));
assert_eq!(lexer.get_token(), Some(Token::new(Whitespace, 1)));
assert_eq!(lexer.get_token(), Some(Token::new(Number, 4)));
assert_eq!(lexer.get_token(), Some(Token::new(Whitespace, 1)));
assert_eq!(lexer.get_token(), Some(Token::new(Number, 4)));
assert_eq!(lexer.get_token(), Some(Token::new(Whitespace, 1)));
assert_eq!(lexer.get_token(), Some(Token::new(Number, 4)));
} | rust_cleaned_test_functions.jsonl/25331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
48403,
16,
15,
368,
341,
286,
1077,
5206,
53259,
284,
28067,
486,
931,
445,
16,
15,
15,
15,
488,
16,
15,
220,
16,
15,
565,
481,
16,
14,
17,
659,
15,
15,
16,
797,
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,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_submit() {
let writer = Arc::new(MockMetricsWriter::new());
let agent = MetricsAgent::new(writer.clone(), Duration::from_secs(10), 1000);
for i in 0..42 {
agent.submit(
DataPoint::new("measurement")
.add_field_i64("i", i)
.to_owned(),
Level::Info,
);
}
agent.flush();
assert_eq!(writer.points_written(), 43);
} | rust_cleaned_test_functions.jsonl/10326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31674,
368,
341,
286,
1077,
6916,
284,
19689,
486,
931,
66436,
27328,
6492,
486,
931,
1423,
286,
1077,
8315,
284,
54190,
16810,
486,
931,
38356,
15997,
1507,
21045,
486,
1499,
68718,
7,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ipv6_parse() {
assert_eq!("2a02::/32".parse::<BgpAddrV6>(),Ok(BgpAddrV6::new(Ipv6Addr::new(0x2a02, 0, 0, 0, 0, 0, 0, 0), 32)));
assert_eq!("2a02::1".parse::<BgpAddrV6>(),Ok(BgpAddrV6::new(Ipv6Addr::new(0x2a02, 0, 0, 0, 0, 0, 0, 1), 128)));
} | rust_cleaned_test_functions.jsonl/87637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49378,
21,
21039,
368,
341,
286,
2060,
10714,
17223,
17,
64,
15,
17,
486,
14,
18,
17,
3263,
6400,
27638,
33,
21888,
13986,
53,
21,
39019,
11578,
5349,
21888,
13986,
53,
21,
486,
931,
8972,
301... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_global_simple() {
let dict = GlobalDictionary::new();
let index = dict.index_of("source.port").unwrap();
assert_eq!(*index,1,"check source port");
let index = dict.index_of("source.service").unwrap();
assert_eq!(*index,158,"check source service");
} | rust_cleaned_test_functions.jsonl/14331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
30015,
368,
1476,
262,
1077,
6451,
284,
7962,
8517,
486,
931,
543,
262,
1077,
1922,
284,
6451,
5154,
3575,
445,
2427,
14598,
1827,
15454,
543,
262,
2060,
10714,
0,
4071,
1252,
11,
16,
133... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_sort_many() -> Result<()> {
// column 1
let a00: &dyn Array = &Int32Array::from_slice(&[0, 1, 2, 3]);
let a01: &dyn Array = &Int32Array::from_slice(&[2, 3, 4]);
// column 2
let a10: &dyn Array = &Utf8Array::<i32>::from_slice(&["a", "c", "d", "e"]);
let a11: &dyn Array = &Utf8Array::<i32>::from_slice(&["b", "y", "z"]);
// column 3
// arrays to be sorted via the columns above
let array0: &dyn Array = &Int32Array::from_slice(&[0, 1, 2, 3]);
let array1: &dyn Array = &Int32Array::from_slice(&[4, 5, 6]);
let expected = Int32Array::from_slice(&[
0,
1,
4,
2,
3,
5, // arrays0 has finished
6, // arrays0 has finished
]);
// merge-sort according to column 1 and then column 2
let options = SortOptions::default();
let arrays0 = vec![a00, a01];
let arrays1 = vec![a10, a11];
let pairs = vec![(arrays0.as_ref(), &options), (arrays1.as_ref(), &options)];
let slices = slices(&pairs)?;
let array = take_arrays(&[array0, array1], slices);
assert_eq!(expected, array.as_ref());
Ok(())
} | rust_cleaned_test_functions.jsonl/47142 | {
"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,
20888,
18435,
22101,
368,
1464,
5714,
71698,
341,
286,
442,
3250,
220,
16,
198,
286,
1077,
264,
15,
15,
25,
609,
43085,
2910,
284,
609,
1072,
18,
17,
1857,
486,
1499,
26488,
2099,
58,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_channel() {
let (mut ctx, mut executor) = ockam_node::start_node();
executor
.execute(async move {
let alice_vault = Vault::create(&ctx).expect("failed to create vault");
let bob_vault = Vault::create(&ctx).expect("failed to create vault");
let mut alice = Entity::create(&ctx, &alice_vault).unwrap();
let mut bob = Entity::create(&ctx, &bob_vault).unwrap();
let alice_trust_policy = TrustIdentifierPolicy::new(bob.identifier().unwrap());
let bob_trust_policy = TrustIdentifierPolicy::new(alice.identifier().unwrap());
bob.create_secure_channel_listener("bob_listener", bob_trust_policy)
.unwrap();
let alice_channel = alice
.create_secure_channel(route!["bob_listener"], alice_trust_policy)
.unwrap();
ctx.send(
route![alice_channel, ctx.address()],
"Hello, Bob!".to_string(),
)
.await
.unwrap();
let msg = ctx.receive::<String>().await.unwrap().take();
let local_info = LocalInfo::decode(msg.local_message().local_info()).unwrap();
assert_eq!(local_info.their_profile_id(), &alice.identifier().unwrap());
let return_route = msg.return_route();
assert_eq!("Hello, Bob!", msg.body());
ctx.send(return_route, "Hello, Alice!".to_string())
.await
.unwrap();
let msg = ctx.receive::<String>().await.unwrap().take();
let local_info = msg.local_message().local_info();
let local_info = LocalInfo::decode(local_info).unwrap();
assert_eq!(local_info.their_profile_id(), &bob.identifier().unwrap());
assert_eq!("Hello, Alice!", msg.body());
ctx.stop().await.unwrap();
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/46786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1083
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
368,
341,
286,
1077,
320,
6984,
5635,
11,
5206,
31558,
8,
284,
297,
377,
309,
5084,
486,
2468,
5084,
543,
286,
31558,
198,
310,
659,
10257,
18285,
3271,
341,
394,
1077,
70433,
2273,
945,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reverse_bits() {
assert_eq!(reverse_bits(0b1101_0101), 0b1010_1011);
} | rust_cleaned_test_functions.jsonl/105388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 57
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
20034,
368,
341,
286,
2060,
10714,
10297,
25903,
20034,
7,
15,
65,
16,
16,
15,
16,
62,
15,
16,
15,
16,
701,
220,
15,
65,
16,
15,
16,
15,
62,
16,
15,
16,
16,
317,
262,
335
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_variables_curly() {
let sut = "5*{x} + 4*log2(log(1.5-{gamma}))*({x}*-(tan(cos(sin(652.2-{gamma}))))) + 3*{x}";
let expr = parse_with_default_ops::<f64>(sut).unwrap();
assert_float_eq_f64(expr.eval(&[1.0, 0.0]).unwrap(), 11.429314405093656);
let sut = "2*(4*{x} + y^2)";
let expr = parse_with_default_ops::<f64>(sut).unwrap();
assert_float_eq_f64(expr.eval(&[2.0, 3.0]).unwrap(), 34.0);
let sut = "sin({myvwmlf4i58eo;w/-😕+sin(a)r_25})";
let expr = parse_with_default_ops::<f64>(sut).unwrap();
assert_float_eq_f64(expr.eval(&[1.5707963267948966]).unwrap(), 1.0);
let sut = "((sin({myvar_25})))";
let expr = parse_with_default_ops::<f64>(sut).unwrap();
assert_float_eq_f64(expr.eval(&[1.5707963267948966]).unwrap(), 1.0);
} | rust_cleaned_test_functions.jsonl/66721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 452
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28182,
18956,
398,
368,
341,
286,
1077,
34212,
284,
330,
20,
9,
90,
87,
92,
488,
220,
19,
90414,
17,
12531,
7,
16,
13,
20,
63347,
32214,
92,
31870,
2306,
87,
92814,
8013,
52591,
88830,
89383,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_symlink_with_invalid_target_path() {
let mut symlink_bytes = BytesMut::new();
symlink_bytes.put_u32(0x01);
symlink_bytes.try_put_str("/linkpath").unwrap();
symlink_bytes.put_u32(0x01); // invalid target path length
assert_eq!(
Symlink::try_from(&mut symlink_bytes.freeze()),
Err(Error::BadMessage)
);
} | rust_cleaned_test_functions.jsonl/43470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
58530,
44243,
6615,
31433,
11123,
2638,
368,
341,
286,
1077,
5206,
83221,
12524,
284,
30024,
51440,
486,
931,
1428,
286,
83221,
12524,
3597,
7300,
18,
17,
7,
15,
87,
15,
16,
317,
286,
832... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_infinite() {
let nan: f32 = f32::NAN;
let inf: f32 = f32::INFINITY;
let neg_inf: f32 = f32::NEG_INFINITY;
assert!(!nan.is_infinite());
assert!(inf.is_infinite());
assert!(neg_inf.is_infinite());
assert!(!0.0f32.is_infinite());
assert!(!42.8f32.is_infinite());
assert!(!(-109.2f32).is_infinite());
} | rust_cleaned_test_functions.jsonl/8101 | {
"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,
6892,
1243,
25722,
368,
341,
286,
1077,
20021,
25,
282,
18,
17,
284,
282,
18,
17,
486,
45,
1093,
280,
286,
1077,
4132,
25,
282,
18,
17,
284,
282,
18,
17,
486,
687,
55990,
280,
286,
1077,
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_lagrange_commitments() {
let n = 64;
let domain = D::<Fp>::new(n).unwrap();
let mut srs = SRS::<VestaG>::create(n);
srs.add_lagrange_basis(domain);
let expected_lagrange_commitments: Vec<_> = (0..n)
.map(|i| {
let mut e = vec![Fp::zero(); n];
e[i] = Fp::one();
let p = Evaluations::<Fp, D<Fp>>::from_vec_and_domain(e, domain).interpolate();
let c = srs.commit_non_hiding(&p, None);
assert!(c.shifted.is_none());
assert_eq!(c.unshifted.len(), 1);
c.unshifted[0]
})
.collect();
let computed_lagrange_commitments = srs.lagrange_bases.get(&domain.size()).unwrap();
for i in 0..n {
assert_eq!(
computed_lagrange_commitments[i],
expected_lagrange_commitments[i]
);
}
} | rust_cleaned_test_functions.jsonl/104704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
351,
9669,
36346,
1368,
368,
341,
286,
1077,
308,
284,
220,
21,
19,
280,
286,
1077,
7947,
284,
422,
27638,
37,
79,
6831,
931,
1445,
568,
15454,
1428,
286,
1077,
5206,
274,
5428,
284,
328,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_map_append_fallible() {
let mut a = SgSet::<_, 6>::new();
assert!(a.try_insert(1).is_ok());
assert!(a.try_insert(2).is_ok());
assert!(a.try_insert(3).is_ok());
let mut b = SgSet::<_, 6>::new();
assert!(b.try_insert(4).is_ok());
assert!(b.try_insert(5).is_ok());
assert!(b.try_insert(6).is_ok());
assert!(a.try_append(&mut b).is_ok());
assert!(b.is_empty());
assert_eq!(b.try_insert(7), Ok(true));
assert_eq!(a.len(), 6);
assert_eq!(a.len(), a.capacity());
assert_eq!(a.try_insert(7), Err(SgError::StackCapacityExceeded));
assert_eq!(a.pop_last(), Some(6));
b.clear();
assert!(b.try_insert(4).is_ok());
assert!(b.try_insert(5).is_ok());
assert!(b.try_insert(6).is_ok());
println!(
"a_len: {} of {}, b_len: {}, common_len: {}",
a.len(),
a.capacity(),
b.len(),
a.iter().filter(|k| b.contains(&k)).count()
);
assert!(a.try_append(&mut b).is_ok());
assert_eq!(
a.into_iter().collect::<Vec<usize>>(),
vec![1, 2, 3, 4, 5, 6]
);
} | rust_cleaned_test_functions.jsonl/68252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
26041,
761,
541,
1238,
368,
341,
262,
1077,
5206,
264,
284,
328,
70,
1649,
27638,
6878,
220,
21,
6831,
931,
1428,
262,
2060,
10297,
64,
48779,
17678,
7,
16,
568,
285,
19817,
1423,
262,
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_diff() {
let mut t = SimpleTester {};
let mut f = TestFile::new("test.txt");
let res = f.run_tests(&mut t);
assert_eq!(res.as_ref().ok(), Some(&()), "Could not run tests: {:?}", res);
} | rust_cleaned_test_functions.jsonl/120712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
368,
341,
286,
1077,
5206,
259,
284,
8993,
58699,
9321,
286,
1077,
5206,
282,
284,
3393,
1703,
486,
931,
445,
1944,
3909,
797,
286,
1077,
592,
284,
282,
7634,
32509,
2099,
6984,
259,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_float_sum() {
let a = Float64Array::from(vec![1.1, 2.2, 3.3, 4.4, 5.5]);
assert_eq!(16.5, sum(&a).unwrap());
} | rust_cleaned_test_functions.jsonl/27858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
17586,
10160,
368,
341,
286,
1077,
264,
284,
13001,
21,
19,
1857,
486,
1499,
25592,
20703,
16,
13,
16,
11,
220,
17,
13,
17,
11,
220,
18,
13,
18,
11,
220,
19,
13,
19,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_nonexistant_dialogue() {
let querier = new_valid_db("get_nonexistant_dialogue.db");
querier.get_dialogue(1000);
} | rust_cleaned_test_functions.jsonl/107712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
21637,
327,
11202,
24331,
361,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
455,
21637,
327,
11202,
24331,
361,
7076,
3071,
286,
29134,
1268,
670,
24331,
361,
7,
16,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_empty_add_back() {
let mut assr = Assembler::new(16);
assert_eq!(assr.add(12, 4), Ok(()));
assert_eq!(assr, contigs![(12, 4)]);
} | rust_cleaned_test_functions.jsonl/52003 | {
"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,
15124,
2891,
3895,
368,
341,
286,
1077,
5206,
1071,
81,
284,
1634,
35401,
486,
931,
7,
16,
21,
317,
286,
2060,
10714,
10297,
395,
81,
1364,
7,
16,
17,
11,
220,
19,
701,
7622,
5065,
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 |
#[test]
fn test_ops_ctor() {
let fb = Firebase::new("https://db.fb.com").ok().unwrap();
let query = fb.ops(&FbOps {
order_by: Some("Hello World"),
limit_to_first: Some(5),
end_at: Some(7),
equal_to: Some(3),
shallow: Some(true),
format: Some(true),
..FbOps::default()
});
let corr = Url::parse("https://db.fb.com/?limitToFirst=5&orderBy=Hello+World&equalTo=3&format=export&shallow=true&endAt=7").ok().unwrap();
let this = Url::parse(&query.get_url()).ok().unwrap();
assert_queries_eq(&corr, &this);
} | rust_cleaned_test_functions.jsonl/37425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21959,
54185,
368,
341,
262,
1077,
25469,
284,
19683,
486,
931,
445,
2428,
1110,
1999,
53707,
905,
1827,
562,
1005,
15454,
543,
262,
1077,
3239,
284,
25469,
46778,
2099,
37,
65,
38904,
341,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_terms() {
let mut schema_builder = Schema::builder();
let text_field = schema_builder.add_text_field("text", TEXT);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let query_parser = QueryParser::for_index(&index, vec![text_field]);
let term_a = Term::from_field_text(text_field, "a");
let term_b = Term::from_field_text(text_field, "b");
{
let mut terms_set: BTreeSet<Term> = BTreeSet::new();
query_parser
.parse_query("a")
.unwrap()
.query_terms(&mut terms_set);
let terms: Vec<&Term> = terms_set.iter().collect();
assert_eq!(vec![&term_a], terms);
}
{
let mut terms_set: BTreeSet<Term> = BTreeSet::new();
query_parser
.parse_query("a b")
.unwrap()
.query_terms(&mut terms_set);
let terms: Vec<&Term> = terms_set.iter().collect();
assert_eq!(vec![&term_a, &term_b], terms);
}
{
let mut terms_set: BTreeSet<Term> = BTreeSet::new();
query_parser
.parse_query("\"a b\"")
.unwrap()
.query_terms(&mut terms_set);
let terms: Vec<&Term> = terms_set.iter().collect();
assert_eq!(vec![&term_a, &term_b], terms);
}
{
let mut terms_set: BTreeSet<Term> = BTreeSet::new();
query_parser
.parse_query("a a a a a")
.unwrap()
.query_terms(&mut terms_set);
let terms: Vec<&Term> = terms_set.iter().collect();
assert_eq!(vec![&term_a], terms);
}
{
let mut terms_set: BTreeSet<Term> = BTreeSet::new();
query_parser
.parse_query("a -b")
.unwrap()
.query_terms(&mut terms_set);
let terms: Vec<&Term> = terms_set.iter().collect();
assert_eq!(vec![&term_a, &term_b], terms);
}
} | rust_cleaned_test_functions.jsonl/78452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
37498,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
1318,
497,
15762,
317,
286,
1077,
10802,
284,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_positive_int_or_float() {
assert!(NonNegativeIntegerOrFloat::try_from(-1.0).is_err());
let mut v = NonNegativeIntegerOrFloat::try_from(1.0).unwrap();
assert!(v.try_set(-1.0).is_err());
assert!(v.try_set(1.0).is_ok());
} | rust_cleaned_test_functions.jsonl/42769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54160,
4042,
8734,
17586,
368,
341,
286,
2060,
10297,
8121,
38489,
3486,
2195,
5442,
486,
1539,
5673,
4080,
16,
13,
15,
568,
285,
9266,
5231,
286,
1077,
5206,
348,
284,
11581,
38489,
3486,
2195,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slip0010_vectors() {
let tests = test_vectors_slip0010_ed25519();
for t in tests.iter() {
let seed = hex::decode(t.seed).unwrap();
let path = t.path;
let key = Slip0010::derive_from_path(path, &seed).unwrap();
assert_eq!(t.c_code, hex::encode(key.chain_code));
assert_eq!(t.pr_key, hex::encode(key.private_key.to_bytes()));
assert_eq!(t.pb_key, hex::encode(key.get_public().to_bytes()));
}
} | rust_cleaned_test_functions.jsonl/3307 | {
"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,
11886,
573,
15,
15,
16,
15,
49158,
368,
341,
262,
1077,
7032,
284,
1273,
49158,
11886,
573,
15,
15,
16,
15,
32370,
17,
20,
20,
16,
24,
543,
262,
369,
259,
304,
7032,
19471,
368,
341,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_message_watermark_event_orderings() {
// Test that a message with a timestamp less than the watermark ensures that the watermark
// is dependent on the message.
{
let message_event_a: OperatorEvent = OperatorEvent::new(
Timestamp::new(vec![1]),
false,
0,
HashSet::new(),
HashSet::new(),
|| (),
);
let watermark_event_b: OperatorEvent = OperatorEvent::new(
Timestamp::new(vec![2]),
true,
0,
HashSet::new(),
HashSet::new(),
|| (),
);
assert_eq!(
message_event_a == watermark_event_b,
false,
"Message A with timestamp 1 and Watermark B\
with timestamp 2 should not be able to run concurrently."
);
assert_eq!(
watermark_event_b == message_event_a,
false,
"Message A with timestamp 1 and Watermark B\
with timestamp 2 should not be able to run concurrently."
);
assert_eq!(
message_event_a < watermark_event_b,
false,
"Message A with timestamp 1 should not depend\
on Watermark B with timestamp 2."
);
assert_eq!(
watermark_event_b < message_event_a,
true,
"Watermark B with timestamp 2 should depend\
on Message with timestamp 1"
);
assert_eq!(
message_event_a > watermark_event_b,
true,
"Watermark B with timestamp 2 should depend\
on Message with timestamp 1"
);
assert_eq!(
watermark_event_b > message_event_a,
false,
"Message A with timestamp 1 should not depend\
on Watermark B with timestamp 2."
);
}
// Test that a message with a timestamp equivalent to the watermark is run before the
// watermark.
{
let message_event_a: OperatorEvent = OperatorEvent::new(
Timestamp::new(vec![1]),
false,
0,
HashSet::new(),
HashSet::new(),
|| (),
);
let watermark_event_b: OperatorEvent = OperatorEvent::new(
Timestamp::new(vec![1]),
true,
0,
HashSet::new(),
HashSet::new(),
|| (),
);
assert_eq!(
message_event_a == watermark_event_b,
false,
"Message A with timestamp 1 and Watermark B\
with timestamp 2 should not be able to run concurrently."
);
assert_eq!(
watermark_event_b == message_event_a,
false,
"Message A with timestamp 1 and Watermark B\
with timestamp 2 should not be able to run concurrently."
);
assert_eq!(
message_event_a < watermark_event_b,
false,
"Message A with timestamp 1 should not depend\
on Watermark B with timestamp 2."
);
assert_eq!(
watermark_event_b < message_event_a,
true,
"Watermark B with timestamp 2 should depent\
on Message A with timestamp 1"
);
assert_eq!(
message_event_a > watermark_event_b,
true,
"Watermark B with timestamp 2 should depent\
on Message A with timestamp 1"
);
assert_eq!(
watermark_event_b > message_event_a,
false,
"Message A with timestamp 1 should not depend\
on Watermark B with timestamp 2."
);
}
// Test that a message with a timestamp greater than a watermark can be run concurrently
// with a watermark of lesser timestamp.
{
let message_event_a: OperatorEvent = OperatorEvent::new(
Timestamp::new(vec![2]),
false,
0,
HashSet::new(),
HashSet::new(),
|| (),
);
let watermark_event_b: OperatorEvent = OperatorEvent::new(
Timestamp::new(vec![1]),
true,
0,
HashSet::new(),
HashSet::new(),
|| (),
);
assert_eq!(
message_event_a == watermark_event_b,
true,
"Message A with timestamp 1 and Watermark B\
with timestamp 2 can run concurrently."
);
assert_eq!(
watermark_event_b == message_event_a,
true,
"Message A with timestamp 1 and Watermark B\
with timestamp 2 can run concurrently."
);
assert_eq!(
message_event_a < watermark_event_b,
false,
"Message A with timestamp 1 should not depend\
on Watermark B with timestamp 2."
);
assert_eq!(
watermark_event_b < message_event_a,
false,
"Message A with timestamp 1 should not depend\
on Watermark B with timestamp 2."
);
assert_eq!(
message_event_a > watermark_event_b,
false,
"Message A with timestamp 1 should not depend\
on Watermark B with timestamp 2."
);
assert_eq!(
watermark_event_b > message_event_a,
false,
"Message A with timestamp 1 should not depend\
on Watermark B with timestamp 2."
);
}
} | rust_cleaned_test_functions.jsonl/24875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
54550,
3987,
6748,
7869,
819,
368,
341,
286,
442,
3393,
429,
264,
1943,
448,
264,
11441,
2686,
1091,
279,
88006,
25351,
429,
279,
88006,
198,
286,
442,
374,
17749,
389,
279,
1943,
624,
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... | 7 |
#[test]
fn test_huya_live() {
Builder::new_current_thread().enable_all().build().unwrap().block_on(async move {
let u = TestUrl::new();
let b = qliveplayer_lib::streamfinder::huya::Huya::new();
println!("{:?}", b.get_live(u.huya_live_url.as_ref()).await.unwrap());
});
} | rust_cleaned_test_functions.jsonl/25594 | {
"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,
1523,
44544,
55203,
368,
341,
262,
20626,
486,
931,
11080,
10814,
1005,
12552,
5705,
1005,
5834,
1005,
15454,
1005,
4574,
4470,
18285,
3271,
341,
286,
1077,
575,
284,
3393,
2864,
486,
931,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3a_cmp() {
assert!(!Vec3AMask::default().any());
assert!(!Vec3AMask::default().all());
assert_eq!(Vec3AMask::default().bitmask(), 0x0);
let a = vec3a(-1.0, -1.0, -1.0);
let b = vec3a(1.0, 1.0, 1.0);
let c = vec3a(-1.0, -1.0, 1.0);
let d = vec3a(1.0, -1.0, -1.0);
assert_eq!(a.cmplt(a).bitmask(), 0x0);
assert_eq!(a.cmplt(b).bitmask(), 0x7);
assert_eq!(a.cmplt(c).bitmask(), 0x4);
assert_eq!(c.cmple(a).bitmask(), 0x3);
assert_eq!(a.cmplt(d).bitmask(), 0x1);
assert!(a.cmplt(b).all());
assert!(a.cmplt(c).any());
assert!(a.cmple(b).all());
assert!(a.cmple(a).all());
assert!(b.cmpgt(a).all());
assert!(b.cmpge(a).all());
assert!(b.cmpge(b).all());
assert!(!(a.cmpge(c).all()));
assert!(c.cmple(c).all());
assert!(c.cmpge(c).all());
assert!(a == a);
assert!(a < b);
assert!(b > a);
} | rust_cleaned_test_functions.jsonl/23489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
64,
35193,
368,
341,
262,
2060,
0,
3471,
10050,
18,
1402,
1073,
486,
2258,
1005,
3767,
1423,
262,
2060,
0,
3471,
10050,
18,
1402,
1073,
486,
2258,
1005,
541,
1423,
262,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transport_cc_extension() -> Result<()> {
let raw = Bytes::from_static(&[0x00, 0x02]);
let buf = &mut raw.clone();
let t1 = TransportCcExtension::unmarshal(buf)?;
let t2 = TransportCcExtension {
transport_sequence: 2,
};
assert_eq!(t1, t2);
let mut dst = BytesMut::with_capacity(t2.marshal_size());
dst.resize(t2.marshal_size(), 0);
t2.marshal_to(&mut dst)?;
assert_eq!(raw, dst.freeze());
Ok(())
} | rust_cleaned_test_functions.jsonl/120379 | {
"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,
46398,
28955,
31035,
368,
1464,
5714,
71698,
341,
262,
1077,
7112,
284,
30024,
486,
1499,
25360,
2099,
58,
15,
87,
15,
15,
11,
220,
15,
87,
15,
17,
2558,
262,
1077,
6607,
284,
609,
6984,
7112,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_assembler_shift_ops() {
test_case(&["SHR A, B"], &[0x040d]);
test_case(&["ASR [0x00FF], C"], &[0x0bce, 0x00ff]);
test_case(&["SHL [300], C"], &[0x0bcf, 0x012c]);
} | rust_cleaned_test_functions.jsonl/44760 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
35401,
22230,
21959,
368,
341,
262,
1273,
19096,
2099,
1183,
8590,
49,
362,
11,
425,
7914,
44590,
15,
87,
15,
19,
15,
67,
2558,
262,
1273,
19096,
2099,
1183,
1911,
49,
508,
15,
87,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header() {
with_basic_file(&valid_header_v2(), |disk_file: RawFile| {
let q = QcowFile::from(disk_file).unwrap();
assert_eq!(q.virtual_size(), 0x20_0000_0000);
});
with_basic_file(&valid_header_v3(), |disk_file: RawFile| {
let q = QcowFile::from(disk_file).unwrap();
assert_eq!(q.virtual_size(), 0x20_0000_0000);
});
} | rust_cleaned_test_functions.jsonl/96733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
368,
341,
286,
448,
34729,
2458,
2099,
1891,
8757,
2273,
17,
1507,
760,
30496,
2458,
25,
23022,
1703,
91,
341,
310,
1077,
2804,
284,
1207,
18921,
1703,
486,
1499,
1500,
3187,
2458,
568,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_line_locate_point_line() {
// Some finite examples
let line = Line::new(
Coordinate { x: -1.0, y: 0.0 },
Coordinate { x: 1.0, y: 0.0 },
);
let point = Point::new(0.0, 1.0);
assert_eq!(line.line_locate_point(&point), Some(0.5));
let point = Point::new(1.0, 1.0);
assert_eq!(line.line_locate_point(&point), Some(1.0));
let point = Point::new(2.0, 1.0);
assert_eq!(line.line_locate_point(&point), Some(1.0));
let point = Point::new(-1.0, 1.0);
assert_eq!(line.line_locate_point(&point), Some(0.0));
let point = Point::new(-2.0, 1.0);
assert_eq!(line.line_locate_point(&point), Some(0.0));
// point contains inf or nan
let point = Point::new(Float::nan(), 1.0);
assert_eq!(line.line_locate_point(&point), None);
let point = Point::new(Float::infinity(), 1.0);
assert_eq!(line.line_locate_point(&point), None);
let point = Point::new(Float::neg_infinity(), 1.0);
assert_eq!(line.line_locate_point(&point), None);
// line contains inf or nan
let line = Line::new(
Coordinate { x: 0.0, y: 0.0 },
Coordinate {
x: Float::infinity(),
y: 0.0,
},
);
let point = Point::new(1000.0, 1000.0);
assert_eq!(line.line_locate_point(&point), None);
let line = Line::new(
Coordinate { x: 0.0, y: 0.0 },
Coordinate {
x: Float::neg_infinity(),
y: 0.0,
},
);
let point = Point::new(1000.0, 1000.0);
assert_eq!(line.line_locate_point(&point), None);
let line = Line::new(
Coordinate { x: 0.0, y: 0.0 },
Coordinate {
x: Float::nan(),
y: 0.0,
},
);
let point = Point::new(1000.0, 1000.0);
assert_eq!(line.line_locate_point(&point), None);
// zero length line
let line: Line<f64> =
Line::new(Coordinate { x: 1.0, y: 1.0 }, Coordinate { x: 1.0, y: 1.0 });
let pt = point!(x: 2.0, y: 2.0);
assert_eq!(line.line_locate_point(&pt), Some(0.0));
// another concrete example
let line: Line<f64> = Line::new(
Coordinate { x: 0.0, y: 0.0 },
Coordinate { x: 10.0, y: 0.0 },
);
let pt = Point::new(555.0, 555.0);
assert_eq!(line.line_locate_point(&pt), Some(1.0));
let pt = Point::new(10.0000001, 0.0);
assert_eq!(line.line_locate_point(&pt), Some(1.0));
let pt = Point::new(9.0, 0.001);
assert_eq!(line.line_locate_point(&pt), Some(0.9));
} | rust_cleaned_test_functions.jsonl/63906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
13400,
349,
6085,
6528,
368,
341,
286,
442,
4329,
34226,
10295,
198,
286,
1077,
1555,
284,
7083,
486,
931,
1006,
310,
41035,
314,
856,
25,
481,
16,
13,
15,
11,
379,
25,
220,
15,
13,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_square() {
let l1_zeros: [&mut Mod_e414_17; 10] = [ &mut (&ZERO * &ZERO),
&mut (&ONE * &ZERO),
&mut (&TWO * &ZERO),
&mut (&M_ONE * &ZERO),
&mut (&M_TWO * &ZERO),
&mut (&ZERO * &ONE),
&mut (&ZERO * &TWO),
&mut (&ZERO * &M_ONE),
&mut (&ZERO * &M_TWO),
&mut ZERO.squared() ];
let l1_ones: [&mut Mod_e414_17; 4] = [ &mut (&ONE * &ONE),
&mut (&M_ONE * &M_ONE),
&mut ONE.squared(),
&mut M_ONE.squared() ];
let l1_twos: [&mut Mod_e414_17; 4] = [ &mut (&ONE * &TWO),
&mut (&TWO * &ONE),
&mut (&M_ONE * &M_TWO),
&mut (&M_TWO * &M_ONE) ];
let l1_threes: [&mut Mod_e414_17; 4] = [ &mut (&ONE * &THREE),
&mut (&THREE * &ONE),
&mut (&M_ONE * &M_THREE),
&mut (&M_THREE * &M_ONE) ];
let l1_fours: [&mut Mod_e414_17; 4] = [ &mut (&TWO * &TWO),
&mut (&M_TWO * &M_TWO),
&mut TWO.squared(),
&mut M_TWO.squared() ];
for i in 0..10 {
let mut val = l1_zeros[i].squared();
assert!(ZERO.normalize_eq(&mut val));
}
for i in 0..4 {
let mut val = l1_ones[i].squared();
assert!(ONE.normalize_eq(&mut val));
}
for i in 0..4 {
let mut val = l1_twos[i].squared();
assert!(FOUR.normalize_eq(&mut val));
}
for i in 0..4 {
let mut val = l1_threes[i].squared();
assert!(NINE.normalize_eq(&mut val));
}
for i in 0..4 {
let mut val = l1_fours[i].squared();
assert!(SIXTEEN.normalize_eq(&mut val));
}
} | rust_cleaned_test_functions.jsonl/15953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39794,
368,
341,
286,
1077,
326,
16,
83761,
25,
34336,
6984,
5650,
2204,
19,
16,
19,
62,
16,
22,
26,
220,
16,
15,
60,
284,
508,
609,
6984,
15899,
73956,
353,
609,
73956,
1326,
17648,
609,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_prune() {
let cache = CacheTest::new(CACHE_SIZE);
cache.insert(1, 100);
cache.insert(2, 200);
assert_eq!(2, cache.cache.total_charge());
let h = cache.cache.look_up(encoded_u32(1).as_slice()).expect("");
cache.cache.prune();
cache.cache.release(h);
assert_eq!(Some(100), cache.look_up(1));
assert_eq!(None, cache.look_up(2));
assert_eq!(1, cache.cache.total_charge());
cache.assert_deleted_keys_and_values(0, (2, 200));
} | rust_cleaned_test_functions.jsonl/82679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
2886,
368,
341,
286,
1077,
6500,
284,
19479,
2271,
486,
931,
3025,
17810,
4098,
317,
286,
6500,
7030,
7,
16,
11,
220,
16,
15,
15,
317,
286,
6500,
7030,
7,
17,
11,
220,
17,
15,
15,
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_constructors() {
type F = f32;
let x: F = 1.;
let y: F = 2.;
let z: F = 3.;
let w: F = 42.;
let zero: F = 0.;
{
let v = Vector0XYZ::from_xyz(x,y,z);
assert_eq!(v.x, x);
assert_eq!(Into::<[F;4]>::into(v), [zero,x,y,z]);
}
{
let v = VectorXYZ0::from_xyz(x,y,z);
assert_eq!(v.x, x);
assert_eq!(Into::<[F;4]>::into(v), [x,y,z,zero]);
}
{
let v = VectorWXYZ::from_xyz(x,y,z);
assert_eq!(v.x, x);
assert_eq!(v.w, zero);
assert_eq!(Into::<[F;4]>::into(v), [zero,x,y,z]);
}
{
let v = VectorXYZW::from_xyz(x,y,z);
assert_eq!(v.x, x);
assert_eq!(v.w, zero);
assert_eq!(Into::<[F;4]>::into(v), [x,y,z,zero]);
}
{
let v = VectorWXYZ::from_xyzw(x,y,z,w);
assert_eq!(v.x, x);
assert_eq!(v.w, w);
assert_eq!(Into::<[F;4]>::into(v), [w,x,y,z]);
}
{
let v = VectorXYZW::from_xyzw(x,y,z,w);
assert_eq!(v.x, x);
assert_eq!(v.w, w);
assert_eq!(Into::<[F;4]>::into(v), [x,y,z,w]);
}
} | rust_cleaned_test_functions.jsonl/33002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 725
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
1087,
368,
341,
262,
943,
434,
284,
282,
18,
17,
280,
262,
1077,
856,
25,
434,
284,
220,
16,
37403,
262,
1077,
379,
25,
434,
284,
220,
17,
37403,
262,
1077,
1147,
25,
434,
284,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_levels() {
let mut map = BTreeMap::new();
map.check();
assert_eq!(map.height(), None);
assert_eq!(map.len(), 0);
map.insert(0, ());
while map.height() == Some(0) {
let last_key = *map.last_key_value().unwrap().0;
map.insert(last_key + 1, ());
}
map.check();
// Structure:
// - 1 element in internal root node with 2 children
// - 6 elements in left leaf child
// - 5 elements in right leaf child
assert_eq!(map.height(), Some(1));
assert_eq!(map.len(), MIN_INSERTS_HEIGHT_1, "{}", map.dump_keys());
while map.height() == Some(1) {
let last_key = *map.last_key_value().unwrap().0;
map.insert(last_key + 1, ());
}
map.check();
// Structure:
// - 1 element in internal root node with 2 children
// - 6 elements in left internal child with 7 grandchildren
// - 42 elements in left child's 7 grandchildren with 6 elements each
// - 5 elements in right internal child with 6 grandchildren
// - 30 elements in right child's 5 first grandchildren with 6 elements each
// - 5 elements in right child's last grandchild
assert_eq!(map.height(), Some(2));
assert_eq!(map.len(), MIN_INSERTS_HEIGHT_2, "{}", map.dump_keys());
} | rust_cleaned_test_functions.jsonl/53924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 480
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37819,
368,
341,
262,
1077,
5206,
2415,
284,
425,
6533,
2227,
486,
931,
543,
262,
2415,
9093,
543,
262,
2060,
10714,
10297,
2186,
5727,
1507,
2240,
317,
262,
2060,
10714,
10297,
2186,
19406,
1507,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_key0_iv0_offset_1() {
let mut cipher = HC256::new(
&GenericArray::from(PAPER_KEY0),
&GenericArray::from(PAPER_IV0),
);
let mut buf1 = [0; 1];
let mut buf2 = [0; 63];
cipher.encrypt(&mut buf1);
cipher.encrypt(&mut buf2);
for i in 0..1 {
assert_eq!(buf1[i], EXPECTED_PAPER_KEY0_IV0[i])
}
for i in 0..63 {
assert_eq!(buf2[i], EXPECTED_PAPER_KEY0_IV0[i + 1])
}
} | rust_cleaned_test_functions.jsonl/15797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
15,
51411,
15,
6917,
62,
16,
368,
341,
262,
1077,
5206,
31088,
284,
45828,
17,
20,
21,
486,
931,
1006,
286,
609,
19964,
1857,
486,
1499,
5304,
57567,
6600,
15,
1326,
286,
609,
19964,
185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fast_retransmit_dup_acks_counter() {
let mut s = socket_established();
s.send_slice(b"abc").unwrap(); // This is lost
recv!(s, time 0, Ok(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"abc"[..],
..RECV_TEMPL
}));
send!(s, time 0, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
..SEND_TEMPL
});
// A lot of retransmits happen here
s.local_rx_dup_acks = u8::max_value() - 1;
// but intended behaviour is that we saturate the bounds
// of local_rx_dup_acks
send!(s, time 0, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
..SEND_TEMPL
});
send!(s, time 0, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
..SEND_TEMPL
});
send!(s, time 0, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
..SEND_TEMPL
});
assert_eq!(s.local_rx_dup_acks, u8::max_value(), "duplicate ACK count should not overflow but saturate");
} | rust_cleaned_test_functions.jsonl/91895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 739
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35743,
1288,
1458,
1763,
51932,
62,
7821,
15730,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
1428,
286,
274,
5219,
26488,
1883,
1,
13683,
1827,
15454,
2129,
442,
1096,
374,
5558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_update_first_seen_time() {
block_on(async {
let config = config_generator();
let mut state_machine = StateMachine::new_stub(&config, make_test_app_set()).await;
let now = time::i64_to_time(123456789);
assert_eq!(state_machine.record_update_first_seen_time("id", now).await, now);
{
let storage = state_machine.storage_ref.lock().await;
assert_eq!(storage.get_string(INSTALL_PLAN_ID).await, Some("id".to_string()));
assert_eq!(storage.get_int(UPDATE_FIRST_SEEN_TIME).await, Some(time_to_i64(now)));
assert_eq!(storage.len(), 2);
assert!(storage.committed());
}
let now2 = now + Duration::from_secs(1000);
assert_eq!(state_machine.record_update_first_seen_time("id", now2).await, now);
{
let storage = state_machine.storage_ref.lock().await;
assert_eq!(storage.get_string(INSTALL_PLAN_ID).await, Some("id".to_string()));
assert_eq!(storage.get_int(UPDATE_FIRST_SEEN_TIME).await, Some(time_to_i64(now)));
assert_eq!(storage.len(), 2);
assert!(storage.committed());
}
assert_eq!(state_machine.record_update_first_seen_time("id2", now2).await, now2);
{
let storage = state_machine.storage_ref.lock().await;
assert_eq!(storage.get_string(INSTALL_PLAN_ID).await, Some("id2".to_string()));
assert_eq!(storage.get_int(UPDATE_FIRST_SEEN_TIME).await, Some(time_to_i64(now2)));
assert_eq!(storage.len(), 2);
assert!(storage.committed());
}
});
} | rust_cleaned_test_functions.jsonl/94238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 920
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
8882,
12978,
60668,
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,
128... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reference() {
new_ucmd!()
.arg("-v")
.arg("--reference=ref_file")
.arg("/etc")
.fails()
.stderr_contains("chgrp: changing group of '/etc': Operation not permitted (os error 1)\nfailed to change group of '/etc' from ");
} | rust_cleaned_test_functions.jsonl/49272 | {
"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,
25433,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
85,
1138,
286,
659,
858,
21549,
16291,
28,
1097,
2458,
1138,
286,
659,
858,
4283,
12107,
1138,
286,
659,
59631,
741,
1789,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stop_all_aps_succeeds() {
let mut test_values = test_setup();
// Stop an AP
let stop_fut = test_values.iface_manager.stop_all_aps();
pin_mut!(stop_fut);
assert_variant!(test_values.exec.run_until_stalled(&mut stop_fut), Poll::Pending);
// Verify the service sees the request
let next_message = test_values.receiver.next();
pin_mut!(next_message);
assert_variant!(
test_values.exec.run_until_stalled(&mut next_message),
Poll::Ready(Some(IfaceManagerRequest::StopAllAps(StopAllApsRequest{
responder
}))) => {
responder.send(Ok(())).expect("failed to send stop AP response");
}
);
// Verify that the client gets the response
assert_variant!(test_values.exec.run_until_stalled(&mut stop_fut), Poll::Ready(Ok(_)));
} | rust_cleaned_test_functions.jsonl/59194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19039,
5705,
62,
2625,
643,
29264,
82,
368,
341,
286,
1077,
5206,
1273,
9146,
284,
1273,
21363,
1428,
286,
442,
14215,
458,
10106,
198,
286,
1077,
2936,
761,
332,
284,
1273,
9146,
35431,
578,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rules() {
let src = "%%
[0-9]+ 'int'
[a-zA-Z]+ 'id'
\\+ '+'
"
.to_string();
let ast = parse_lex::<u8>(&src).unwrap();
let intrule = ast.get_rule_by_name("int").unwrap();
assert_eq!("int", intrule.name.as_ref().unwrap());
assert_eq!("[0-9]+", intrule.re_str);
let idrule = ast.get_rule_by_name("id").unwrap();
assert_eq!("id", idrule.name.as_ref().unwrap());
assert_eq!("[a-zA-Z]+", idrule.re_str);
let plusrule = ast.get_rule_by_name("+").unwrap();
assert_eq!("+", plusrule.name.as_ref().unwrap());
assert_eq!("\\+", plusrule.re_str);
} | rust_cleaned_test_functions.jsonl/53998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21407,
368,
341,
286,
1077,
2286,
284,
330,
51377,
58,
15,
12,
24,
7574,
364,
396,
1248,
15481,
21088,
11171,
7574,
364,
307,
1248,
3422,
10,
13902,
1248,
698,
286,
659,
983,
3904,
543,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_failure_fail() {
let res = CmdResult {
bin_path: "".into(),
util_name: None,
tmpd: None,
code: None,
success: true,
stdout: "".into(),
stderr: "".into(),
};
res.failure();
} | rust_cleaned_test_functions.jsonl/12788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43618,
22121,
368,
341,
286,
1077,
592,
284,
40210,
2077,
341,
310,
9544,
2638,
25,
44907,
18122,
3148,
310,
4094,
1269,
25,
2240,
345,
310,
4174,
67,
25,
2240,
345,
310,
2038,
25,
2240,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_t35() {
init();
let product_type = 8;
let result = t35(product_type);
println!("{}", result.len());
println!("{:?}", result)
} | rust_cleaned_test_functions.jsonl/104721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
18,
20,
368,
341,
286,
2930,
543,
286,
1077,
1985,
1819,
284,
220,
23,
280,
286,
1077,
1102,
284,
259,
18,
20,
19475,
1819,
317,
286,
13751,
79878,
1102,
19406,
1423,
286,
13751,
88928,
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 |
#[test]
fn test_build_statistics_inconsistent_length() {
// return an inconsistent length to the actual statistics arrays
let required_columns = RequiredStatColumns::from(vec![(
"s1".into(),
StatisticsType::Min,
Field::new("s1_min", DataType::Int64, true),
)]);
let statistics = OneContainerStats {
min_values: Some(Arc::new(Int64Array::from(vec![Some(10)]))),
max_values: Some(Arc::new(Int64Array::from(vec![Some(20)]))),
num_containers: 3,
};
let result =
build_statistics_record_batch(&statistics, &required_columns).unwrap_err();
assert!(
result
.to_string()
.contains("mismatched statistics length. Expected 3, got 1"),
"{}",
result
);
} | rust_cleaned_test_functions.jsonl/97675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
49569,
1243,
78399,
5118,
368,
341,
286,
442,
470,
458,
39140,
3084,
311,
279,
5042,
13142,
18386,
198,
286,
1077,
2567,
22590,
284,
12659,
15878,
13965,
486,
1499,
25592,
20703,
1006,
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_pending_snapshot_pause_replication() {
let l = default_logger();
let mut sm = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
sm.restore(testing_snap());
sm.persist();
sm.become_candidate();
sm.become_leader();
sm.mut_prs().get_mut(2).unwrap().become_snapshot(11);
sm.step(new_message(1, 1, MessageType::MsgPropose, 1))
.expect("");
let msgs = sm.read_messages();
assert!(msgs.is_empty());
} | rust_cleaned_test_functions.jsonl/43882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37861,
53265,
59989,
25533,
1693,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
1525,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matches_starts_with_correctly() {
check(
&WildcardPattern::StartsWith {
pattern: "alf*".into(),
starts_with: "alf".into()
},
vec!["alf_loves_cats", "alf-loves-eating-cats", "alf"],
vec!["al", "", "cats", "not-only-alf-loves-cats"]);
} | rust_cleaned_test_functions.jsonl/80621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38344,
86552,
6615,
31550,
398,
368,
341,
286,
1779,
1006,
310,
609,
92988,
15760,
486,
3479,
16056,
341,
394,
5383,
25,
330,
3104,
9,
3263,
18122,
3148,
394,
8471,
6615,
25,
330,
3104,
3263,
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_read_repo_commit_detail() {
let repo_commit_detail: RepoCommitDetail = read_test_file("repo_commit_detail");
assert_eq!(
repo_commit_detail.id,
ObjectId::new("de4ac3cf96cb8a0893be22b03f5171d934f9d392"),
);
assert_eq!(repo_commit_detail.short_id, ObjectId::new("de4ac3cf"));
assert_eq!(repo_commit_detail.title, "Merge topic 'mr-awards'");
assert_eq!(repo_commit_detail.author_name, "Brad King");
assert_eq!(repo_commit_detail.author_email, "brad.king@kitware.com");
assert_eq!(repo_commit_detail.committer_name, "Kitware Robot");
assert_eq!(repo_commit_detail.committer_email, "kwrobot@kitware.com");
assert_eq!(
repo_commit_detail.created_at,
datetime((2016, 11, 8), (14, 30, 13, 0)),
);
assert_eq!(
repo_commit_detail.message,
"Merge topic 'mr-awards'\n\na222c553 gitlab: add a method for MR award \
queries\n\nAcked-by: Kitware Robot <kwrobot@kitware.com>\nReviewed-by: Brad King \
<brad.king@kitware.com>\nMerge-request: !46\n",
);
itertools::assert_equal(
&repo_commit_detail.parent_ids,
&[
ObjectId::new("559f5f4a2bfe1f48e9e95afa09c029deb655cf7d"),
ObjectId::new("a222c5539569cda6999b8069f1e51a5202c30711"),
],
);
assert_eq!(
repo_commit_detail.committed_date,
datetime((2016, 11, 8), (14, 30, 13, 0)),
);
assert_eq!(
repo_commit_detail.authored_date,
datetime((2016, 11, 8), (14, 30, 13, 0)),
);
let stats = repo_commit_detail.stats.as_ref().unwrap();
assert_eq!(stats.additions, 8);
assert_eq!(stats.deletions, 0);
assert_eq!(stats.total, 8);
let last_pipeline = repo_commit_detail.last_pipeline.as_ref().unwrap();
assert_eq!(last_pipeline.id, PipelineId::new(34289));
assert_eq!(last_pipeline.project_id, ProjectId::new(855));
assert_eq!(last_pipeline.ref_.as_ref().unwrap(), "master");
assert_eq!(
last_pipeline.sha,
ObjectId::new("de4ac3cf96cb8a0893be22b03f5171d934f9d392"),
);
assert_eq!(last_pipeline.status, StatusState::Success);
assert_eq!(
last_pipeline.created_at.unwrap(),
datetime((2016, 11, 8), (14, 30, 16, 81)),
);
assert_eq!(
last_pipeline.updated_at.unwrap(),
datetime((2016, 11, 8), (14, 35, 32, 670)),
);
assert_eq!(
last_pipeline.web_url,
"https://gitlab.kitware.com/utils/rust-gitlab/-/pipelines/34289",
);
assert_eq!(repo_commit_detail.project_id, ProjectId::new(855));
} | rust_cleaned_test_functions.jsonl/12953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
37784,
36346,
14480,
368,
341,
262,
1077,
15867,
36346,
14480,
25,
71509,
33441,
10649,
284,
1349,
4452,
2458,
445,
23476,
36346,
14480,
3071,
262,
2060,
10714,
33673,
286,
15867,
36346,
14480,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_squaring() {
let a = Fp2 {
c0: Fp::from_raw_unchecked([
0xc9a2183163ee70d4,
0xbc3770a7196b5c91,
0xa247f8c1304c5f44,
0xb01fc2a3726c80b5,
0xe1d293e5bbd919c9,
0x4b78e80020ef2ca,
]),
c1: Fp::from_raw_unchecked([
0x952ea4460462618f,
0x238d5eddf025c62f,
0xf6c94b012ea92e72,
0x3ce24eac1c93808,
0x55950f945da483c,
0x10a768d0df4eabc,
]),
};
let b = Fp2 {
c0: Fp::from_raw_unchecked([
0xa1e09175a4d2c1fe,
0x8b33acfc204eff12,
0xe24415a11b456e42,
0x61d996b1b6ee1936,
0x1164dbe8667c853c,
0x788557acc7d9c79,
]),
c1: Fp::from_raw_unchecked([
0xda6a87cc6f48fa36,
0xfc7b488277c1903,
0x9445ac4adc448187,
0x2616d5bc9099209,
0xdbed46772db58d48,
0x11b94d5076c7b7b1,
]),
};
assert_eq!(a.square(), b);
} | rust_cleaned_test_functions.jsonl/97987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 922
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
446,
3249,
368,
341,
286,
1077,
264,
284,
434,
79,
17,
341,
310,
272,
15,
25,
434,
79,
486,
1499,
16067,
4907,
7549,
8956,
394,
220,
15,
8148,
24,
64,
17,
16,
23,
18,
16,
21,
18,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_str() {
let tests = &[("", "\"\""), ("foo", "\"foo\"")];
test_encode_ok(tests);
test_pretty_encode_ok(tests);
} | rust_cleaned_test_functions.jsonl/29817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
2895,
368,
341,
262,
1077,
7032,
284,
44590,
19814,
15898,
2105,
3975,
3489,
7975,
497,
15898,
7975,
2105,
899,
935,
262,
1273,
11224,
19817,
8623,
82,
317,
262,
1273,
620,
21322,
11224,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_generate_invalid_k() {
let share1 = "2-1-1YAYwmOHqZ69jA".to_string().into_bytes();
sss::split_secret(10, 5, share1.as_slice(), true).unwrap();
} | rust_cleaned_test_functions.jsonl/77609 | {
"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,
48851,
31433,
4698,
368,
341,
262,
1077,
4332,
16,
284,
330,
17,
12,
16,
12,
16,
56,
3022,
19557,
46761,
80,
57,
21,
24,
73,
32,
3263,
983,
3904,
1005,
18122,
12524,
1428,
262,
274,
778,
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 |
#[test]
fn test_question_build_and_parse() {
let domain = DomainBuilder::from_str(DOMAIN_STRING).unwrap();
let unicast = false;
let qtype = Type::Aaaa;
let class = Class::In;
let question = QuestionBuilder::new(domain, qtype, class, unicast);
let mut buf = make_buf(question.bytes_len());
question.serialize_to_buf(buf.as_mut_slice());
let mut bv = BufferViewWrapper(buf.as_ref());
let parsed = Question::parse(&mut bv, None).unwrap();
assert_eq!(parsed.unicast, unicast);
assert_eq!(parsed.qtype, qtype);
assert_eq!(parsed.class, class);
} | rust_cleaned_test_functions.jsonl/34439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28915,
20801,
8378,
21039,
368,
341,
286,
1077,
7947,
284,
21070,
3297,
486,
1499,
2895,
5432,
1898,
6836,
12283,
568,
15454,
543,
286,
1077,
650,
35446,
284,
895,
280,
286,
1077,
2804,
1313,
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_gc_config_validate() {
let cfg = GCConfig::default();
cfg.validate().unwrap();
let mut invalid_cfg = GCConfig::default();
invalid_cfg.batch_keys = 0;
assert!(invalid_cfg.validate().is_err());
} | rust_cleaned_test_functions.jsonl/4823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49423,
5332,
42681,
368,
341,
286,
1077,
13286,
284,
22381,
2648,
486,
2258,
543,
286,
13286,
19520,
1005,
15454,
1428,
286,
1077,
5206,
8318,
18343,
284,
22381,
2648,
486,
2258,
543,
286,
8318,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_int_as_json() {
let mut ctx = EvalContext::new(Arc::new(EvalConfig::default_for_test()));
let cases = vec![
(
Some(FieldTypeFlag::UNSIGNED),
vec![Datum::U64(32)],
Some(Json::U64(32)),
),
(
Some(FieldTypeFlag::UNSIGNED | FieldTypeFlag::IS_BOOLEAN),
vec![Datum::U64(1)],
Some(Json::Boolean(true)),
),
(
Some(FieldTypeFlag::UNSIGNED | FieldTypeFlag::IS_BOOLEAN),
vec![Datum::I64(0)],
Some(Json::Boolean(false)),
),
(None, vec![Datum::I64(-1)], Some(Json::I64(-1))),
(None, vec![Datum::Null], None),
];
for (flag, cols, exp) in cases {
let mut col_expr = col_expr(0, FieldTypeTp::LongLong);
if flag.is_some() {
col_expr
.mut_field_type()
.as_mut_accessor()
.set_flag(flag.unwrap());
}
let ex = scalar_func_expr(ScalarFuncSig::CastIntAsJson, &[col_expr]);
let e = Expression::build(&ctx, ex).unwrap();
let res = e.eval_json(&mut ctx, &cols).unwrap();
if exp.is_none() {
assert!(res.is_none());
continue;
}
assert_eq!(res.unwrap().into_owned(), exp.unwrap());
}
} | rust_cleaned_test_functions.jsonl/2965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 892
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
4042,
11898,
9455,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
931,
4346,
1287,
486,
931,
10722,
831,
2648,
486,
2258,
5478,
4452,
7392,
286,
1077,
5048,
284,
7486,
90515,
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... | 4 |
#[test]
fn test_debug() {
let sgs = SgSet::from([3, 4, 1, 2, 5, 6]);
let bts = BTreeSet::from([3, 4, 1, 2, 5, 6]);
assert!(sgs.iter().eq(bts.iter()));
let sgt_str = format!("{:#?}", sgs);
let bts_str = format!("{:#?}", bts);
assert_eq!(sgt_str, bts_str);
println!("DEBUG:\n{}", sgt_str);
} | rust_cleaned_test_functions.jsonl/68237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
262,
1077,
274,
5857,
284,
328,
70,
1649,
486,
1499,
2561,
18,
11,
220,
19,
11,
220,
16,
11,
220,
17,
11,
220,
20,
11,
220,
21,
2558,
262,
1077,
293,
2576,
284,
425,
6533,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dynaerrorkind_to_dynaerror_success() {
let err = DynaError::new(DynaErrorKind::UnhandledError, None);
assert_eq!(err, DynaError::from(DynaErrorKind::UnhandledError));
} | rust_cleaned_test_functions.jsonl/133083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
814,
52344,
615,
669,
484,
2346,
814,
52344,
841,
18632,
368,
341,
286,
1077,
1848,
284,
43938,
64,
1454,
486,
931,
5432,
52344,
1454,
10629,
486,
95539,
1454,
11,
2240,
626,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_deposit_eth_to_near_balance_total_supply() {
let (master_account, contract) = init(CUSTODIAN_ADDRESS);
call_deposit_eth_to_near(&contract, CONTRACT_ACC);
let balance = get_eth_on_near_balance(&master_account, DEPOSITED_RECIPIENT, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_AMOUNT - DEPOSITED_FEE);
let balance = get_eth_on_near_balance(&master_account, CONTRACT_ACC, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_FEE);
let balance = total_supply(&master_account, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_AMOUNT);
let balance = total_eth_supply_on_near(&master_account, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_AMOUNT);
let balance = total_eth_supply_on_aurora(&master_account, CONTRACT_ACC);
assert_eq!(balance, 0);
} | rust_cleaned_test_functions.jsonl/112867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85798,
57757,
2346,
76340,
29396,
10784,
65630,
368,
341,
262,
1077,
320,
13629,
13500,
11,
5116,
8,
284,
2930,
3025,
8553,
2069,
22002,
20135,
317,
262,
1618,
85798,
57757,
2346,
76340,
2099,
20257... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clonemap() {
let mut map: CloneMap = TypeMap::custom();
map.insert::<KeyType>(Value(10));
assert!(map.contains::<KeyType>());
let cloned = map.clone();
assert_eq!(map.get::<KeyType>(), cloned.get::<KeyType>());
} | rust_cleaned_test_functions.jsonl/33447 | {
"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,
6794,
263,
42040,
368,
341,
286,
1077,
5206,
2415,
25,
27913,
2227,
284,
3990,
2227,
486,
9163,
543,
286,
2415,
7030,
27638,
97964,
2235,
1130,
7,
16,
15,
1106,
286,
2060,
10297,
2186,
8786,
276... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int32_fmt_debug() {
let buf = Buffer::from(&[0, 1, 2, 3, 4].to_byte_slice());
let arr = Int32Array::new(5, buf, 0, 0);
assert_eq!(
"PrimitiveArray<Int32>\n[\n 0,\n 1,\n 2,\n 3,\n 4,\n]",
format!("{:?}", arr)
);
} | rust_cleaned_test_functions.jsonl/11591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
18,
17,
38128,
15446,
368,
341,
286,
1077,
6607,
284,
10312,
486,
1499,
2099,
58,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
936,
983,
19737,
26488,
1423,
286,
1077,
2890,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_under_point() {
let ray = Ray {
origin: Tuple::point(0.0, 0.0, -5.0),
direction: Tuple::vector(0.0, 0.0, 1.0),
};
let sphere = Sphere::new(
Matrix::translation(0.0, 0.0, 1.0),
Material::new(
Some(Color::white()),
None,
0.1, 0.9, 0.3, 5.0, 0.0, 1.0, 1.5
),
);
let mut intersections = sphere.intersect(&ray);
compute_intersection_data(&mut intersections, &ray);
let int = intersections[0];
assert_eq!(int.t, 5.0);
assert!(int.under_point.z > EPSILON / 2.0);
assert!(int.point.z < int.under_point.z);
} | rust_cleaned_test_functions.jsonl/45910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58228,
6085,
368,
341,
286,
1077,
18299,
284,
13255,
341,
310,
6238,
25,
24622,
486,
2768,
7,
15,
13,
15,
11,
220,
15,
13,
15,
11,
481,
20,
13,
15,
1326,
310,
5106,
25,
24622,
486,
3215,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_string() {
assert_eq!(
"Callback returned an error",
Error::CallbackError.to_string()
);
assert_eq!(
"Callback returned an error",
Error::CallbackError.to_string()
);
} | rust_cleaned_test_functions.jsonl/115373 | {
"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,
2346,
3904,
368,
341,
286,
2060,
10714,
33673,
310,
330,
7494,
5927,
458,
1465,
756,
310,
4600,
486,
7494,
1454,
2389,
3904,
741,
286,
1439,
286,
2060,
10714,
33673,
310,
330,
7494,
5927,
458,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_bool() {
test_parse_err::<bool>(&[
("t", "EOF while parsing a value at line 1 column 1"),
("truz", "expected ident at line 1 column 4"),
("f", "EOF while parsing a value at line 1 column 1"),
("faz", "expected ident at line 1 column 3"),
("truea", "trailing characters at line 1 column 5"),
("falsea", "trailing characters at line 1 column 6"),
]);
test_parse_ok(vec![
("true", true),
(" true ", true),
("false", false),
(" false ", false),
]);
} | rust_cleaned_test_functions.jsonl/29828 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
22159,
368,
341,
262,
1273,
21039,
9266,
27638,
2641,
44784,
9640,
286,
3489,
83,
497,
330,
23483,
1393,
22314,
264,
897,
518,
1555,
220,
16,
3250,
220,
16,
4461,
286,
3489,
376,
5197,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_insert_get() {
let mut storage = Storage::new(8);
let alice_ref = storage.insert("alice", (1, 3.0, "Alice".to_string()));
assert_eq!(*storage.get(alice_ref), (1, 3.0, "Alice".to_string()));
assert_eq!(*storage.get_by_name("alice").unwrap().0, (1, 3.0, "Alice".to_string()));
assert!(storage.get_by_name("bob").is_none());
} | rust_cleaned_test_functions.jsonl/19584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
17678,
3062,
368,
341,
286,
1077,
5206,
5819,
284,
14693,
486,
931,
7,
23,
317,
1789,
286,
1077,
70433,
7793,
284,
5819,
7030,
445,
63195,
497,
320,
16,
11,
220,
18,
13,
15,
11,
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_new_behavior_previously_stuck() {
// any stake accounts activated and deactivated at the same epoch
do_test(
OldDeactivationBehavior::Stuck,
&[
StakeActivationStatus::default(),
StakeActivationStatus::default(),
StakeActivationStatus::default(),
StakeActivationStatus::default(),
StakeActivationStatus::default(),
StakeActivationStatus::default(),
StakeActivationStatus::default(),
],
);
} | rust_cleaned_test_functions.jsonl/15340 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
74540,
10442,
18281,
1261,
1942,
368,
341,
310,
442,
894,
18279,
9618,
21985,
323,
83616,
518,
279,
1852,
16342,
198,
39865,
310,
653,
4452,
1006,
394,
10621,
1912,
23002,
22753,
486,
623,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_close_enough() {
let zh = hash::ZERO_HASH;
// empty check
assert_eq!(close_enough(&vec![], 0), None);
// just 1 locator in history
let heights: Vec<u64> = vec![64, 62, 58, 50, 34, 2, 0];
let history_locator: Vec<(u64, Hash)> = vec![(0, zh.clone())];
let mut locator: Vec<(u64, Hash)> = vec![];
for h in heights {
if let Some(l) = close_enough(&history_locator, h) {
locator.push(l);
}
}
assert_eq!(locator, vec![(0, zh.clone())]);
// simple dummy example
let locator = vec![
(1000, zh.clone()),
(500, zh.clone()),
(250, zh.clone()),
(125, zh.clone()),
];
assert_eq!(close_enough(&locator, 2000), None);
assert_eq!(close_enough(&locator, 1050), Some((1000, zh)));
assert_eq!(close_enough(&locator, 900), Some((1000, zh)));
assert_eq!(close_enough(&locator, 270), Some((250, zh)));
assert_eq!(close_enough(&locator, 20), Some((125, zh)));
assert_eq!(close_enough(&locator, 125), Some((125, zh)));
assert_eq!(close_enough(&locator, 500), Some((500, zh)));
// more realistic test with 11 history
let heights: Vec<u64> = vec![
2554, 2552, 2548, 2540, 2524, 2492, 2428, 2300, 2044, 1532, 508, 0,
];
let history_locator: Vec<(u64, Hash)> = vec![
(2043, zh.clone()),
(2041, zh.clone()),
(2037, zh.clone()),
(2029, zh.clone()),
(2013, zh.clone()),
(1981, zh.clone()),
(1917, zh.clone()),
(1789, zh.clone()),
(1532, zh.clone()),
(1021, zh.clone()),
(0, zh.clone()),
];
let mut locator: Vec<(u64, Hash)> = vec![];
for h in heights {
if let Some(l) = close_enough(&history_locator, h) {
locator.push(l);
}
}
locator.dedup_by(|a, b| a.0 == b.0);
assert_eq!(
locator,
vec![(2043, zh.clone()), (1532, zh.clone()), (0, zh.clone()),]
);
// more realistic test with 12 history
let heights: Vec<u64> = vec![
4598, 4596, 4592, 4584, 4568, 4536, 4472, 4344, 4088, 3576, 2552, 504, 0,
];
let history_locator: Vec<(u64, Hash)> = vec![
(4087, zh.clone()),
(4085, zh.clone()),
(4081, zh.clone()),
(4073, zh.clone()),
(4057, zh.clone()),
(4025, zh.clone()),
(3961, zh.clone()),
(3833, zh.clone()),
(3576, zh.clone()),
(3065, zh.clone()),
(1532, zh.clone()),
(0, zh.clone()),
];
let mut locator: Vec<(u64, Hash)> = vec![];
for h in heights {
if let Some(l) = close_enough(&history_locator, h) {
locator.push(l);
}
}
locator.dedup_by(|a, b| a.0 == b.0);
assert_eq!(
locator,
vec![
(4087, zh.clone()),
(3576, zh.clone()),
(3065, zh.clone()),
(0, zh.clone()),
]
);
} | rust_cleaned_test_functions.jsonl/32008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12704,
6205,
1384,
368,
341,
197,
10217,
59748,
284,
5175,
486,
73956,
32309,
401,
197,
197,
322,
4287,
1779,
198,
197,
6948,
10714,
10297,
5552,
6205,
1384,
2099,
4083,
0,
12995,
220,
15,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_aes_siv_ciphertext_modifications() {
let key_str =
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f00112233445566778899aabbccddeefff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
let key = hex::decode(key_str).unwrap();
let aad = b"Additional data";
let a = tink_daead::subtle::AesSiv::new(&key).unwrap();
for i in 0..50 {
let msg = get_random_bytes(i);
let mut ct = a.encrypt_deterministically(&msg, aad).unwrap();
for j in 0..ct.len() {
for b in 0..8 {
ct[j] ^= 1 << b;
assert!(
a.decrypt_deterministically(&ct, aad).is_err(),
"Modified ciphertext decrypted: byte {}, bit {}",
j,
b
);
ct[j] ^= 1 << b;
}
}
}
} | rust_cleaned_test_functions.jsonl/131304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
643,
344,
666,
45043,
7480,
7029,
368,
341,
262,
1077,
1376,
2895,
4035,
286,
330,
15,
15,
15,
16,
15,
17,
15,
18,
15,
19,
15,
20,
15,
21,
15,
22,
15,
23,
15,
24,
15,
64,
15,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_copy4() {
use ndshape::ConstShape4u32;
let src_shape = ConstShape4u32::<10, 11, 12, 13>;
const SRC_SIZE: usize = 10 * 11 * 12 * 13;
let src = [1; SRC_SIZE];
let dst_shape = ConstShape4u32::<11, 12, 13, 14>;
const DST_SIZE: usize = 11 * 12 * 13 * 14;
let mut dst = [0; DST_SIZE];
copy4(
[2, 3, 4, 5],
&src,
&src_shape,
[3, 4, 5, 6],
&mut dst,
&dst_shape,
[4, 5, 6, 7],
);
for w in 7..7 + 5 {
for z in 6..6 + 4 {
for y in 5..5 + 3 {
for x in 4..4 + 2 {
let i = dst_shape.linearize([x, y, z, w]) as usize;
assert_eq!(1, dst[i]);
dst[i] = 0;
}
}
}
}
for i in 0..DST_SIZE {
assert_eq!(dst[i], 0);
}
} | rust_cleaned_test_functions.jsonl/85383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16096,
19,
368,
341,
262,
990,
15581,
12231,
486,
19167,
12301,
19,
84,
18,
17,
401,
262,
1077,
2286,
13597,
284,
24522,
12301,
19,
84,
18,
17,
27638,
16,
15,
11,
220,
16,
16,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_numbers_2() {
let s = to_chars("01234");
let cur = &mut 0;
expect_next_token(&s, cur, Token::Illegal);
} | rust_cleaned_test_functions.jsonl/21024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32964,
62,
17,
368,
341,
286,
1077,
274,
284,
311,
37418,
445,
15,
16,
17,
18,
19,
797,
286,
1077,
2847,
284,
609,
6984,
220,
15,
280,
286,
1720,
11257,
6458,
2099,
82,
11,
2847,
11,
9660,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_entropy() {
let entropy = |x: Pareto| x.entropy().unwrap();
test_case(0.1, 0.1, -11.0, entropy);
test_case(1.0, 1.0, -2.0, entropy);
test_case(10.0, 10.0, -1.1, entropy);
test_case(3.0, 1.0, -2.0 - 3f64.ln(), entropy);
test_case(1.0, 3.0, -4.0/3.0 + 3f64.ln(), entropy);
} | rust_cleaned_test_functions.jsonl/18750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50374,
368,
341,
286,
1077,
47502,
284,
760,
87,
25,
74185,
983,
91,
856,
13,
49150,
1005,
15454,
543,
286,
1273,
19096,
7,
15,
13,
16,
11,
220,
15,
13,
16,
11,
481,
16,
16,
13,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option_encode_some() {
let o1: Option<u8> = Some(0);
let o2: Option<u8> = Some(13);
let o3: Option<u8> = Some(0xFF);
let o4: Option<u64> = Some(13);
let o5: Option<u64> = Some(0x1FF);
let o6: Option<u64> = Some(0xFFFFFFFFFFFFFFFF);
let o7: Option<usize> = Some(13);
let o8: Option<usize> = Some(0xFFFFFFFFFFFFFFFF);
let byte_0 = &[1u8, 0u8][..];
let byte_13 = &[1u8, 13u8][..];
let byte_255 = &[1u8, 0xFFu8][..];
let word_13 = &[1u8, 13u8, 0u8][..];
let qword_13 = &[1u8, 13u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8][..];
let qword_256 =
&[1u8, 0xFFu8, 0x01u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8][..];
let qword_max = &[
1u8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8,
][..];
assert_eq!(strict_serialize(&o1).unwrap(), byte_0);
assert_eq!(strict_serialize(&o2).unwrap(), byte_13);
assert_eq!(strict_serialize(&o3).unwrap(), byte_255);
assert_eq!(strict_serialize(&o4).unwrap(), qword_13);
assert_eq!(strict_serialize(&o5).unwrap(), qword_256);
assert_eq!(strict_serialize(&o6).unwrap(), qword_max);
assert_eq!(strict_serialize(&o7).unwrap(), word_13);
assert!(strict_serialize(&o8).err().is_some());
assert_eq!(Option::<u8>::strict_decode(byte_0).unwrap(), Some(0));
assert_eq!(Option::<u8>::strict_decode(byte_13).unwrap(), Some(13));
assert_eq!(Option::<u8>::strict_decode(byte_255).unwrap(), Some(0xFF));
assert_eq!(Option::<u64>::strict_decode(qword_13).unwrap(), Some(13));
assert_eq!(
Option::<u64>::strict_decode(qword_256).unwrap(),
Some(0x1FF)
);
assert_eq!(
Option::<u64>::strict_decode(qword_max).unwrap(),
Some(0xFFFFFFFFFFFFFFFF)
);
assert_eq!(Option::<usize>::strict_decode(word_13).unwrap(), Some(13));
assert_eq!(
Option::<usize>::strict_decode(qword_max).unwrap(),
Some(0xFFFF)
);
} | rust_cleaned_test_functions.jsonl/21858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
11224,
61855,
368,
341,
286,
1077,
297,
16,
25,
6959,
34837,
23,
29,
284,
4329,
7,
15,
317,
286,
1077,
297,
17,
25,
6959,
34837,
23,
29,
284,
4329,
7,
16,
18,
317,
286,
1077,
297,
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_simple_transaction() {
let sapling = sapling_bls12::SAPLING.clone();
let spender_key = SaplingKey::generate_key(sapling.clone());
let receiver_key = SaplingKey::generate_key(sapling.clone());
let spender_address = spender_key.generate_public_address();
let receiver_address = receiver_key.generate_public_address();
let mut transaction = SimpleTransaction::new(sapling.clone(), spender_key, 0);
let in_note = Note::new(sapling.clone(), spender_address.clone(), 42, Memo([0; 32]));
let out_note = Note::new(sapling.clone(), receiver_address.clone(), 41, Memo([0; 32]));
let witness = make_fake_witness(sapling.clone(), &in_note);
transaction
.spend(&in_note, &witness)
.expect("should be able to spend note");
transaction
.receive(&out_note)
.expect("Should be able to receive note");
let public_transaction = transaction
.post()
.expect("should be able to post transaction");
public_transaction
.verify()
.expect("should be able to verify transaction")
} | rust_cleaned_test_functions.jsonl/58437 | {
"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,
30015,
28884,
368,
341,
262,
1077,
34635,
2718,
284,
34635,
2718,
880,
4730,
16,
17,
486,
50,
2537,
74115,
15997,
543,
262,
1077,
83888,
3097,
284,
80175,
2718,
1592,
486,
19366,
3097,
1141,
391,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_row_group_metadata_thrift_conversion() {
let schema_descr = get_test_schema_descr();
let mut columns = vec![];
for ptr in schema_descr.columns() {
let column = ColumnChunkMetaData::builder(ptr.clone()).build().unwrap();
columns.push(column);
}
let row_group_meta = RowGroupMetaData::builder(schema_descr.clone())
.set_num_rows(1000)
.set_total_byte_size(2000)
.set_column_metadata(columns)
.build()
.unwrap();
let row_group_exp = row_group_meta.to_thrift();
let row_group_res =
RowGroupMetaData::from_thrift(schema_descr, row_group_exp.clone())
.unwrap()
.to_thrift();
assert_eq!(row_group_res, row_group_exp);
} | rust_cleaned_test_functions.jsonl/82557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
6288,
22220,
5854,
41380,
64132,
368,
341,
286,
1077,
10802,
64622,
284,
633,
4452,
25371,
64622,
1428,
286,
1077,
5206,
8147,
284,
7486,
0,
15078,
286,
369,
10087,
304,
10802,
64622,
21153,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_de_single_str_bugs() {
let s = "{\"name\": \"my-awesome-package\",\"version\": \"1.0.0\",\"bugs\": \"https://example.com\"}";
let package = Package::from_str(s).unwrap();
} | rust_cleaned_test_functions.jsonl/7116 | {
"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,
2259,
19487,
2895,
880,
13299,
368,
341,
262,
1077,
274,
284,
54734,
606,
11693,
7245,
2408,
28524,
44135,
34333,
4366,
11693,
7245,
16,
13,
15,
13,
15,
34333,
56176,
11693,
7245,
2428,
1110,
8687... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rotate_line() {
let line0 = Line::from([(0., 0.), (0., 2.)]);
let line1 = Line::from([(1., 1.), (-1., 1.)]);
assert_relative_eq!(line0.rotate(90.0), line1);
} | rust_cleaned_test_functions.jsonl/49665 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
6528,
368,
341,
286,
1077,
1555,
15,
284,
7083,
486,
1499,
58590,
15,
2572,
220,
15,
24389,
320,
15,
2572,
220,
17,
6138,
2558,
286,
1077,
1555,
16,
284,
7083,
486,
1499,
58590,
16,
257... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_edit() {
let mut test_env = TestEnvironment::default();
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "a\n").unwrap();
std::fs::write(repo_path.join("file2"), "a\n").unwrap();
std::fs::write(repo_path.join("file3"), "a\n").unwrap();
test_env.jj_cmd_success(&repo_path, &["new"]);
std::fs::remove_file(repo_path.join("file1")).unwrap();
std::fs::write(repo_path.join("file2"), "b\n").unwrap();
let edit_script = test_env.set_up_fake_diff_editor();
// Nothing happens if we make no changes
std::fs::write(
&edit_script,
"files-before file1 file2\0files-after JJ-INSTRUCTIONS file2",
)
.unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["edit"]);
insta::assert_snapshot!(stdout, @r###"
Nothing changed.
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r###"
R file1
M file2
"###);
// Nothing happens if the diff-editor exits with an error
std::fs::write(&edit_script, "rm file2\0fail").unwrap();
let stderr = test_env.jj_cmd_failure(&repo_path, &["edit"]);
insta::assert_snapshot!(stderr, @r###"
Error: Failed to edit diff: The diff tool exited with a non-zero code
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r###"
R file1
M file2
"###);
// Can edit changes to individual files
std::fs::write(&edit_script, "reset file2").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["edit"]);
insta::assert_snapshot!(stdout, @r###"
Created 8c79910b5033 (no description set)
Working copy now at: 8c79910b5033 (no description set)
Added 0 files, modified 1 files, removed 0 files
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r###"
R file1
"###);
// Changes to a commit are propagated to descendants
test_env.jj_cmd_success(&repo_path, &["undo"]);
std::fs::write(&edit_script, "write file3\nmodified\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["edit", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r###"
Created 472de2debaff (no description set)
Rebased 1 descendant commits
Working copy now at: 6d19dc1ea106 (no description set)
Added 0 files, modified 1 files, removed 0 files
"###);
let contents = String::from_utf8(std::fs::read(repo_path.join("file3")).unwrap()).unwrap();
insta::assert_snapshot!(contents, @r###"
modified
"###);
} | rust_cleaned_test_functions.jsonl/53455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13156,
368,
341,
262,
1077,
5206,
1273,
15879,
284,
3393,
12723,
486,
2258,
543,
262,
1273,
15879,
1169,
73,
11684,
18632,
8623,
15879,
9265,
12993,
1507,
609,
1183,
2327,
497,
330,
23476,
497,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_space() {
let mut reader = Reader::init("x");
let error = space(&mut reader).err().unwrap();
assert_eq!(error.pos, Pos { line: 1, column: 1 });
assert_eq!(reader.state.cursor, 1);
let mut reader = Reader::init(" ");
assert_eq!(
space(&mut reader),
Ok(Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 1, 1, 2),
}),
);
assert_eq!(reader.state.cursor, 1);
} | rust_cleaned_test_functions.jsonl/119569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14663,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
87,
797,
286,
1077,
1465,
284,
3550,
2099,
6984,
6604,
568,
615,
1005,
15454,
543,
286,
2060,
10714,
10297,
841,
13006,
11,
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_calc_ok() {
assert_eq!(calc("2".to_string(), false).unwrap(), 2);
assert_eq!(calc("+3".to_string(), false).unwrap(), 3);
assert_eq!(calc("2 + 3".to_string(), false).unwrap(), 5);
assert_eq!(calc("2 + 3 * 4".to_string(), false).unwrap(), 14);
assert_eq!(calc("2 - 3 + 4".to_string(), false).unwrap(), 3);
assert_eq!(calc("1 + 2 * 3 - 4 + 5".to_string(), false).unwrap(), 8);
assert_eq!(
calc("( 5 - 3 ) * ( 1 + 2 ) + 10".to_string(), false).unwrap(),
16
);
assert_eq!(
calc("( ( 1 + 3 ) * 2 ) * 3".to_string(), false).unwrap(),
24
);
assert_eq!(calc("1+2*3-4+5".to_string(), false).unwrap(), 8);
assert_eq!(calc("((1+3)*2)*3".to_string(), false).unwrap(), 24);
assert_eq!(calc("1--5+-2*-3".to_string(), false).unwrap(), 12);
assert_eq!(calc("1--1 ".to_string(), false).unwrap(), 2);
assert_eq!(calc("-(1--1)--3".to_string(), false).unwrap(), 1);
assert_eq!(calc("(-1 * 3)".to_string(), false).unwrap(), -3);
assert_eq!(calc("(-1*+3-(-3-+3))".to_string(), false).unwrap(), 3);
assert_eq!(calc("-(-(-3))".to_string(), false).unwrap(), -3);
assert_eq!(calc("+1+2-3*4".to_string(), false).unwrap(), -9);
assert_eq!(calc("4+(1+2)*3".to_string(), false).unwrap(), 13);
assert_eq!(calc("-(1-(-1))".to_string(), false).unwrap(), -2);
assert_eq!(calc("-((3+1))".to_string(), false).unwrap(), -4);
} | rust_cleaned_test_functions.jsonl/2814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 791
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38241,
19817,
368,
341,
286,
2060,
10714,
10297,
26586,
445,
17,
3263,
983,
3904,
1507,
895,
568,
15454,
1507,
220,
17,
317,
286,
2060,
10714,
10297,
26586,
34973,
18,
3263,
983,
3904,
1507,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_nibble() {
let hash = b"hello".test_only_hash();
assert_eq!(hash.get_nibble(0), Nibble::from(3));
assert_eq!(hash.get_nibble(1), Nibble::from(3));
assert_eq!(hash.get_nibble(2), Nibble::from(3));
assert_eq!(hash.get_nibble(3), Nibble::from(8));
assert_eq!(hash.get_nibble(62), Nibble::from(9));
assert_eq!(hash.get_nibble(63), Nibble::from(2));
} | rust_cleaned_test_functions.jsonl/85912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1089,
82418,
368,
341,
286,
1077,
5175,
284,
293,
1,
14990,
3263,
1944,
18410,
8950,
543,
286,
2060,
10714,
10297,
8296,
670,
1089,
82418,
7,
15,
701,
451,
82418,
486,
1499,
7,
18,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sandbox_oom() {
use rustwide::cmd::CommandError;
runner::run("out-of-memory", |run| {
let res = run.build(
SandboxBuilder::new()
.enable_networking(false)
.memory_limit(Some(512 * 1024 * 1024)),
|build| {
build.cargo().args(&["run"]).run()?;
Ok(())
},
);
if let Some(CommandError::SandboxOOM) = res.err().and_then(|err| err.downcast().ok()) {
// Everything is OK!
} else {
panic!("didn't get the error CommandError::SandboxOOM");
}
Ok(())
});
} | rust_cleaned_test_functions.jsonl/74699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
31536,
62,
4191,
368,
341,
262,
990,
23071,
9150,
486,
8710,
486,
4062,
1454,
401,
262,
22259,
486,
6108,
445,
411,
8668,
64096,
497,
760,
6108,
91,
341,
286,
1077,
592,
284,
1598,
13239,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_character() {
let querier = new_valid_db("get_character.db");
let got_character = querier.get_character("Test_Character");
assert_eq!(got_character, common_character());
} | rust_cleaned_test_functions.jsonl/107698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
40988,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
455,
40988,
7076,
3071,
286,
1077,
2684,
40988,
284,
29134,
1268,
670,
40988,
445,
2271,
84529,
797,
286,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_same_module_struct_resolution() {
let allocator = Arena::new();
let vm_cache = VMModuleCache::new(&allocator);
let code = "
modules:
module M1 {
struct X {}
struct T { i: u64, x: Self.X }
}
script:
main() {
return;
}
";
let module = parse_and_compile_modules(code);
let fetcher = FakeFetcher::new(module);
let block_cache = BlockModuleCache::new(&vm_cache, fetcher);
{
let module_id = ModuleId::new(AccountAddress::default(), ident("M1"));
let module_ref = block_cache.get_loaded_module(&module_id).unwrap().unwrap();
let gas = GasMeter::new(GasUnits::new(100_000_000));
let struct_x = block_cache
.resolve_struct_def(module_ref, StructDefinitionIndex::new(0), &gas)
.unwrap()
.unwrap();
let struct_t = block_cache
.resolve_struct_def(module_ref, StructDefinitionIndex::new(1), &gas)
.unwrap()
.unwrap();
assert_eq!(struct_x, StructDef::new(vec![]));
assert_eq!(
struct_t,
StructDef::new(vec![Type::U64, Type::Struct(StructDef::new(vec![]))]),
);
}
} | rust_cleaned_test_functions.jsonl/22994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 617
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
10750,
15126,
39849,
368,
341,
262,
1077,
43655,
284,
27047,
486,
931,
543,
262,
1077,
10995,
11529,
284,
17792,
3332,
8233,
486,
931,
2099,
57631,
626,
262,
1077,
2038,
284,
6228,
286,
134... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() {
let mut pt = PathTransformer::new();
assert_eq!(pt.to_dist(Path::new("C:/a")).unwrap(), "/prefix/disk-C/a");
assert_eq!(pt.to_dist(Path::new(r#"C:\a\b.c"#)).unwrap(), "/prefix/disk-C/a/b.c");
assert_eq!(pt.to_dist(Path::new("X:/other.c")).unwrap(), "/prefix/disk-X/other.c");
let mut disk_mappings: Vec<_> = pt.disk_mappings().collect();
disk_mappings.sort();
assert_eq!(
disk_mappings,
&[
(Path::new("C:").into(), "/prefix/disk-C".into()),
(Path::new("X:").into(), "/prefix/disk-X".into()),
]
);
assert_eq!(pt.to_local("/prefix/disk-C/a").unwrap(), Path::new("C:/a"));
assert_eq!(pt.to_local("/prefix/disk-C/a/b.c").unwrap(), Path::new("C:/a/b.c"));
assert_eq!(pt.to_local("/prefix/disk-X/other.c").unwrap(), Path::new("X:/other.c"));
} | rust_cleaned_test_functions.jsonl/129911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
341,
286,
1077,
5206,
10817,
284,
7933,
46358,
486,
931,
543,
286,
2060,
10714,
10297,
417,
2389,
16031,
33030,
486,
931,
445,
34,
14375,
64,
15197,
15454,
1507,
3521,
11849,
3446,
318... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_substr_cmp() {
// Test case with empty first string.
assert_eq!(substr_cmp(b"", b"abc"), true);
// Test normal cases.
for b in 0..=u8::MAX {
let buf = vec![b];
match b {
b'a' => { assert_eq!(substr_cmp(&buf, b"abc"), true); },
_ => { assert_eq!(substr_cmp(&buf, b"abc"), false); },
}
}
for b in 0..=u8::MAX {
let buf1 = vec![b, b'b'];
let buf2 = vec![b'a', b];
match b {
b'a' => {
assert_eq!(substr_cmp(&buf1, b"abc"), true);
assert_eq!(substr_cmp(&buf2, b"abc"), false);
},
b'b' => {
assert_eq!(substr_cmp(&buf1, b"abc"), false);
assert_eq!(substr_cmp(&buf2, b"abc"), true);
},
_ => {
assert_eq!(substr_cmp(&buf1, b"abc"), false);
assert_eq!(substr_cmp(&buf2, b"abc"), false);
},
}
}
assert_eq!(substr_cmp(b"abc", b"abc"), true);
// Test case where first string is too large.
assert_eq!(substr_cmp(b"abcd", b"abc"), false);
} | rust_cleaned_test_functions.jsonl/99568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 766
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83578,
35193,
368,
341,
286,
442,
3393,
1142,
448,
4287,
1156,
914,
624,
286,
2060,
10714,
10297,
28614,
35193,
1883,
56323,
293,
1,
13683,
3975,
830,
317,
286,
442,
3393,
4622,
5048,
624,
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... | 5 |
#[test]
fn test_spatial_moments() {
let points = [
(53.0, 19.0),
(52.0, 20.0),
(49.0, 20.0),
(48.0, 21.0),
(47.0, 21.0),
(46.0, 22.0),
(45.0, 22.0),
(44.0, 23.0),
(43.0, 23.0),
(42.0, 24.0),
(41.0, 24.0),
(39.0, 26.0),
(38.0, 26.0),
(34.0, 30.0),
(76.0, 30.0),
(77.0, 31.0),
(79.0, 31.0),
(80.0, 32.0),
(81.0, 32.0),
(83.0, 34.0),
(84.0, 34.0),
(86.0, 36.0),
(86.0, 37.0),
(87.0, 38.0),
(87.0, 39.0),
(88.0, 40.0),
(88.0, 47.0),
(86.0, 49.0),
(86.0, 50.0),
(83.0, 53.0),
(82.0, 53.0),
(81.0, 54.0),
(81.0, 55.0),
(82.0, 55.0),
(84.0, 57.0),
(84.0, 58.0),
(85.0, 59.0),
(85.0, 60.0),
(86.0, 61.0),
(86.0, 63.0),
(87.0, 64.0),
(87.0, 65.0),
(88.0, 66.0),
(93.0, 66.0),
(94.0, 65.0),
(94.0, 64.0),
(95.0, 63.0),
(95.0, 60.0),
(96.0, 59.0),
(99.0, 59.0),
(99.0, 53.0),
(98.0, 52.0),
(97.0, 52.0),
(96.0, 51.0),
(95.0, 51.0),
(94.0, 50.0),
(93.0, 50.0),
(90.0, 47.0),
(90.0, 46.0),
(91.0, 45.0),
(91.0, 44.0),
(92.0, 43.0),
(92.0, 42.0),
(93.0, 41.0),
(93.0, 39.0),
(94.0, 38.0),
(94.0, 36.0),
(91.0, 33.0),
(91.0, 32.0),
(85.0, 26.0),
(84.0, 26.0),
(82.0, 24.0),
(81.0, 24.0),
(80.0, 23.0),
(79.0, 23.0),
(78.0, 22.0),
(77.0, 22.0),
(76.0, 21.0),
(75.0, 21.0),
(74.0, 20.0),
(71.0, 20.0),
(70.0, 19.0),
(69.0, 19.0),
(67.0, 21.0),
(66.0, 21.0),
(62.0, 25.0),
(60.0, 25.0),
(54.0, 19.0),
];
let moments: Spatial<f64, 3> = points.iter().collect();
assert_abs_diff_eq!(moments.get::<0, 0>(), 703.0);
assert_abs_diff_eq!(moments.get::<1, 0>(), 52175.166666666664);
assert_abs_diff_eq!(moments.get::<0, 1>(), 25661.5);
assert_abs_diff_eq!(moments.get::<2, 0>(), 4084450.6666666665);
assert_abs_diff_eq!(moments.get::<1, 1>(), 2024477.75);
assert_abs_diff_eq!(moments.get::<0, 2>(), 1071256.0);
assert_abs_diff_eq!(moments.get::<3, 0>(), 332589780.65000004);
assert_abs_diff_eq!(moments.get::<2, 1>(), 166738807.83333334);
assert_abs_diff_eq!(moments.get::<1, 2>(), 89124447.63333333);
assert_abs_diff_eq!(moments.get::<0, 3>(), 50269189.75);
} | rust_cleaned_test_functions.jsonl/116540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
32414,
717,
316,
805,
368,
341,
286,
1077,
3501,
284,
2278,
310,
320,
20,
18,
13,
15,
11,
220,
16,
24,
13,
15,
1326,
310,
320,
20,
17,
13,
15,
11,
220,
17,
15,
13,
15,
1326,
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_extend_bitflags() {
let src_code = quote! {
#[ubx_extend_bitflags]
#[ubx(from, rest_reserved)]
bitflags! {
#[doc = "Navigation Status Flags"]
pub struct Test: u8 {
#[doc = "position and velocity valid and within DOP and ACC Masks"]
const F1 = 1;
#[doc = "DGPS used"]
const F2 = 2;
#[doc = "Week Number valid"]
const F3 = 4;
#[doc = "Time of Week valid"]
const F4 = 8;
}
}
};
let src_code = src_code.to_string();
let mac: syn::ItemMacro = syn::parse_str(&src_code)
.unwrap_or_else(|err| panic_on_parse_error("test_extend_bitflags", &src_code, &err));
let tokens = extend_bitflags(mac)
.unwrap_or_else(|err| panic_on_parse_error("test_extend_bitflags", &src_code, &err));
run_compare_test(
tokens,
quote! {
bitflags! {
#[doc = "Navigation Status Flags"]
pub struct Test: u8 {
#[doc = "position and velocity valid and within DOP and ACC Masks"]
const F1 = (1 as u8);
#[doc = "DGPS used"]
const F2 = ((1 as u8) << 1u32);
#[doc = "Week Number valid"]
const F3 = ((1 as u8) << 2u32);
#[doc = "Time of Week valid"]
const F4 = ((1 as u8) << 3u32);
const RESERVED4 = ((1 as u8) << 4u32);
const RESERVED5 = ((1 as u8) << 5u32);
const RESERVED6 = ((1 as u8) << 6u32);
const RESERVED7 = ((1 as u8) << 7u32);
}
}
impl Test {
const fn from(x: u8) -> Self {
Self::from_bits_truncate(x)
}
}
},
);
} | rust_cleaned_test_functions.jsonl/16497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
13996,
11161,
368,
341,
262,
1077,
2286,
4136,
284,
12641,
0,
341,
286,
11506,
392,
87,
70265,
13996,
11161,
921,
286,
11506,
392,
87,
17016,
11,
2732,
74913,
5563,
286,
2699,
11161,
0,
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_for_loop_parenthesis_expressions() {
let input = "
FOR I=(1+2)TO(2+3)STEP(1+0)
PRINT I
NEXT
";
assert_prints!(input, "3", "4", "5");
} | rust_cleaned_test_functions.jsonl/64164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
17198,
620,
9151,
13189,
2702,
39873,
368,
341,
262,
1077,
1946,
284,
6228,
262,
4613,
358,
4539,
16,
10,
17,
8,
5207,
7,
17,
10,
18,
8,
50389,
7,
16,
10,
15,
340,
286,
35893,
358,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_array_from() {
let boolean_data = ArrayData::builder(DataType::Boolean)
.len(4)
.add_buffer(Buffer::from([12_u8]))
.build();
let int_data = ArrayData::builder(DataType::Int32)
.len(4)
.add_buffer(Buffer::from([42, 28, 19, 31].to_byte_slice()))
.build();
let struct_array = StructArray::from(vec![
(
Field::new("b", DataType::Boolean, false),
Arc::new(BooleanArray::from(vec![false, false, true, true]))
as Arc<Array>,
),
(
Field::new("c", DataType::Int32, false),
Arc::new(Int32Array::from(vec![42, 28, 19, 31])),
),
]);
assert_eq!(boolean_data, struct_array.column(0).data());
assert_eq!(int_data, struct_array.column(1).data());
assert_eq!(4, struct_array.len());
assert_eq!(0, struct_array.null_count());
assert_eq!(0, struct_array.offset());
} | rust_cleaned_test_functions.jsonl/11633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 565
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
3858,
5673,
368,
341,
286,
1077,
2710,
1769,
284,
2910,
1043,
486,
17850,
63941,
486,
6890,
340,
310,
659,
2892,
7,
19,
340,
310,
659,
718,
7776,
55574,
486,
1499,
2561,
16,
17,
7300,
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_map_consuming() {
let h = hlist![9000, "joe", 41f32];
let mapped = h.map(hlist![|n| n + 1, |s| s, |f| f + 1f32]);
assert_eq!(mapped, hlist![9001, "joe", 42f32]);
} | rust_cleaned_test_functions.jsonl/24759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
3382,
61117,
368,
341,
286,
1077,
305,
284,
305,
1607,
20703,
24,
15,
15,
15,
11,
330,
73,
4644,
497,
220,
19,
16,
69,
18,
17,
935,
286,
1077,
23844,
284,
305,
4770,
3203,
1607,
20703,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fail() {
let s = "
# syntax error
scalar
key: [1, 2]]
key1:a2
";
assert!(YamlLoader::load_from_str(s).is_err());
assert!(try_fail(s).is_err());
} | rust_cleaned_test_functions.jsonl/4321 | {
"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,
22121,
368,
341,
286,
1077,
274,
284,
6228,
2,
19482,
1465,
198,
35342,
198,
792,
25,
508,
16,
11,
220,
17,
14288,
792,
16,
43833,
17,
198,
876,
286,
2060,
10297,
56,
9467,
9181,
486,
1078,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_seed_with_derivation_path_maintnet() {
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let wallet = from_seed(
&mut jscontext,
"snYP7oArxKepd3GPDcrjMsJYiJeJB".to_owned(),
Some("m/44'/144'/0'/0/1".to_owned()),
false,
)?;
assert_eq!(
wallet.address.unwrap(),
"XVnJMYQFqA8EAijpKh5EdjEY5JqyxykMKKSbrUX8uchF6U8"
);
} | rust_cleaned_test_functions.jsonl/118742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
33809,
6615,
35345,
39127,
2638,
717,
1641,
4711,
368,
341,
286,
1077,
700,
4334,
284,
1460,
486,
3160,
486,
947,
445,
3656,
8291,
1827,
15454,
543,
286,
1077,
5206,
6994,
2147,
284,
12914,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unknown_causetId() {
let mut cc = ConjoiningGerunds::default();
let schemaReplicant = SchemaReplicant::default();
let knownCauset = KnownCauset::for_schemaReplicant(&schemaReplicant);
cc.apply_parsed_TuringString(knownCauset, TuringString {
source: None,
instanton: TuringStringNonValuePlace::ToUpper(ToUpper::from_valid_name("?x")),
attribute: causetid("foo", "bar"),
value: TuringStringValuePlace::Constant(NonIntegerConstant::Boolean(true)),
causetx: TuringStringNonValuePlace::Placeholder,
});
assert!(cc.is_known_empty());
} | rust_cleaned_test_functions.jsonl/32584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
666,
11855,
295,
764,
368,
341,
286,
1077,
5206,
12527,
284,
1200,
65205,
65397,
42950,
486,
2258,
543,
286,
1077,
10802,
18327,
35237,
284,
12539,
18327,
35237,
486,
2258,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eat_hex_int() {
let input = "0x05";
let expected = vec![Token::Int(5.into())];
let mut lexer = Lexer::new(input);
for token in expected.into_iter() {
let got = lexer.next_token().unwrap();
assert_eq!(got, token);
}
} | rust_cleaned_test_functions.jsonl/72662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
266,
32655,
4042,
368,
341,
262,
1077,
1946,
284,
330,
15,
87,
15,
20,
3302,
262,
1077,
3601,
284,
7486,
20703,
3323,
486,
1072,
7,
20,
39860,
2140,
935,
262,
1077,
5206,
53259,
284,
850... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_split_last() {
let mut a = vec![11];
let b: &[i32] = &[];
assert!(b.split_last().is_none());
assert_eq!(a.split_last(), Some((&11, b)));
a = vec![11, 12];
let b: &[_] = &[11];
assert_eq!(a.split_last(), Some((&12, b)));
} | rust_cleaned_test_functions.jsonl/12852 | {
"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,
17052,
12195,
368,
341,
262,
1077,
5206,
264,
284,
7486,
20703,
16,
16,
935,
262,
1077,
293,
25,
44590,
72,
18,
17,
60,
284,
609,
15078,
262,
2060,
10297,
65,
5289,
12195,
1005,
285,
31488,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_queen_moves() {
let position =
&Position::from_fen("rnbqkbnr/pppppppp/8/8/8/8/PPP1PPPP/RNBQKBNR w").unwrap();
let mut list = MoveVec::new();
let capture_mask = position.bb_side(position.state().stm.flip());
let push_mask = position.bb_empty();
slider_moves::<MoveVec>(
position,
capture_mask,
push_mask,
EMPTY,
Square(1),
&mut list,
);
assert_list_includes_moves(&list, &["d1xd7", "d1d2", "d1d3", "d1d4", "d1d5", "d1d6"]);
} | rust_cleaned_test_functions.jsonl/69358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47342,
268,
45390,
368,
341,
286,
1077,
2309,
4035,
310,
609,
3812,
486,
1499,
761,
268,
445,
81,
18080,
80,
74,
11081,
81,
87146,
602,
602,
602,
14,
23,
14,
23,
14,
23,
14,
23,
14,
97252,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repo_update() {
let tmpdir = setup("git_repo_update");
let tarball = tmpdir.mash("../../alpine-base.tgz");
assert!(sys::remove_all(&tmpdir).is_ok());
assert_eq!(git::is_repo(&tmpdir), false);
assert!(git::Repo::new(&tmpdir).unwrap().url("https://github.com/phR0ze/alpine-base.git").update().is_ok());
assert_eq!(git::is_repo(&tmpdir), true);
// Now wipe it out and extract a tarball of the repo that needs updated
let repo = git::Repo::new(&tmpdir).unwrap();
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(tar::extract_all(&tarball, &tmpdir).is_ok());
assert_eq!(repo.last_msg().unwrap(), "Use the workflow name for the badge".to_string());
assert!(git::Repo::new(&tmpdir).unwrap().url("https://github.com/phR0ze/alpine-base.git").update().is_ok());
assert_ne!(repo.last_msg().unwrap(), "Use the workflow name for the badge".to_string());
assert!(sys::remove_all(&tmpdir).is_ok());
} | rust_cleaned_test_functions.jsonl/114254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37784,
8882,
368,
341,
286,
1077,
4174,
3741,
284,
6505,
445,
12882,
37784,
8882,
797,
286,
1077,
12183,
3959,
284,
4174,
3741,
744,
988,
36800,
278,
38038,
30013,
734,
46589,
797,
286,
2060,
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_accounts_clean_after_snapshot_restore_then_old_revives() {
solana_logger::setup();
let old_lamport = 223;
let zero_lamport = 0;
let no_data = 0;
let dummy_lamport = 999_999;
let owner = AccountSharedData::default().owner;
let account = AccountSharedData::new(old_lamport, no_data, &owner);
let account2 = AccountSharedData::new(old_lamport + 100_001, no_data, &owner);
let account3 = AccountSharedData::new(old_lamport + 100_002, no_data, &owner);
let dummy_account = AccountSharedData::new(dummy_lamport, no_data, &owner);
let zero_lamport_account = AccountSharedData::new(zero_lamport, no_data, &owner);
let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_sdk::pubkey::new_rand();
let dummy_pubkey = solana_sdk::pubkey::new_rand();
let mut current_slot = 0;
let accounts = AccountsDb::new_single();
// A: Initialize AccountsDb with pubkey1 and pubkey2
current_slot += 1;
accounts.store_uncached(current_slot, &[(&pubkey1, &account)]);
accounts.store_uncached(current_slot, &[(&pubkey2, &account)]);
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root(current_slot);
// B: Test multiple updates to pubkey1 in a single slot/storage
current_slot += 1;
assert_eq!(0, accounts.alive_account_count_in_slot(current_slot));
assert_eq!(1, accounts.ref_count_for_pubkey(&pubkey1));
accounts.store_uncached(current_slot, &[(&pubkey1, &account2)]);
accounts.store_uncached(current_slot, &[(&pubkey1, &account2)]);
assert_eq!(1, accounts.alive_account_count_in_slot(current_slot));
// ref count
assert_eq!(2, accounts.ref_count_for_pubkey(&pubkey1));
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root(current_slot);
// C: Yet more update to trigger lazy clean of step A
current_slot += 1;
assert_eq!(2, accounts.ref_count_for_pubkey(&pubkey1));
accounts.store_uncached(current_slot, &[(&pubkey1, &account3)]);
assert_eq!(3, accounts.ref_count_for_pubkey(&pubkey1));
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root(current_slot);
// D: Make pubkey1 0-lamport; also triggers clean of step B
current_slot += 1;
assert_eq!(3, accounts.ref_count_for_pubkey(&pubkey1));
accounts.store_uncached(current_slot, &[(&pubkey1, &zero_lamport_account)]);
accounts.clean_accounts(None);
assert_eq!(
// Removed one reference from the dead slot (reference only counted once
// even though there were two stores to the pubkey in that slot)
3,
accounts.ref_count_for_pubkey(&pubkey1)
);
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root(current_slot);
// E: Avoid missing bank hash error
current_slot += 1;
accounts.store_uncached(current_slot, &[(&dummy_pubkey, &dummy_account)]);
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root(current_slot);
assert_load_account(&accounts, current_slot, pubkey1, zero_lamport);
assert_load_account(&accounts, current_slot, pubkey2, old_lamport);
assert_load_account(&accounts, current_slot, dummy_pubkey, dummy_lamport);
// pubkey1 to be revived as the state of step A.
accounts.clean_accounts(None);
let accounts = reconstruct_accounts_db_via_serialization(&accounts, current_slot);
accounts.clean_accounts(None);
info!("pubkey: {}", pubkey1);
accounts.print_accounts_stats("pre_clean");
assert_load_account(&accounts, current_slot, pubkey1, zero_lamport);
assert_load_account(&accounts, current_slot, pubkey2, old_lamport);
assert_load_account(&accounts, current_slot, dummy_pubkey, dummy_lamport);
current_slot += 1;
accounts.store_uncached(current_slot, &[(&pubkey2, &account)]);
accounts.get_accounts_delta_hash(current_slot);
accounts.add_root(current_slot);
// Do clean
accounts.clean_accounts(None);
// Ensure pubkey2 is cleaned from the index finally
assert_not_load_account(&accounts, current_slot, pubkey1);
assert_load_account(&accounts, current_slot, pubkey2, old_lamport);
assert_load_account(&accounts, current_slot, dummy_pubkey, dummy_lamport);
} | rust_cleaned_test_functions.jsonl/37793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1968
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
19573,
19844,
53265,
62677,
68367,
21108,
38082,
1886,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2310,
907,
309,
403,
284,
220,
17,
17,
18,
280,
286,
1077,
7168,
907,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pipein_synthesizes() {
let mut uut = rust_hdl_synth::TopWrap::new(PipeIn::new(0x80));
uut.uut.ok1.connect();
uut.connect_all();
rust_hdl_synth::yosys_validate("pipein", &generate_verilog(&uut)).unwrap();
} | rust_cleaned_test_functions.jsonl/55824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
258,
51393,
6375,
4756,
368,
341,
262,
1077,
5206,
575,
332,
284,
23071,
66154,
643,
45809,
486,
5366,
26787,
486,
931,
5304,
3444,
641,
486,
931,
7,
15,
87,
23,
15,
1106,
262,
575,
332... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pool_swap_with_fees() {
let one_near = 10u128.pow(24);
let mut context = VMContextBuilder::new();
context.predecessor_account_id(accounts(0));
testing_env!(context.build());
let mut pool = SimplePool::new(0, vec![accounts(1), accounts(2)], 100, 100, 0);
let mut amounts = vec![to_yocto("5"), to_yocto("10")];
let num_shares = pool.add_liquidity(accounts(0).as_ref(), &mut amounts);
assert_eq!(amounts, vec![to_yocto("5"), to_yocto("10")]);
assert_eq!(
pool.share_balance_of(accounts(0).as_ref()),
INIT_SHARES_SUPPLY
);
let out = pool.swap(
accounts(1).as_ref(),
one_near,
accounts(2).as_ref(),
1,
&AdminFees {
exchange_fee: 100,
exchange_id: accounts(3).as_ref().clone(),
referral_fee: 0,
referral_id: None,
},
);
assert_eq!(
pool.share_balance_of(accounts(0).as_ref()),
INIT_SHARES_SUPPLY
);
let liq1 = pool.remove_liquidity(accounts(0).as_ref(), num_shares, vec![1, 1]);
let num_shares2 = pool.share_balance_of(accounts(3).as_ref());
let liq2 = pool.remove_liquidity(accounts(3).as_ref(), num_shares2, vec![1, 1]);
assert_eq!(liq1[0] + liq2[0], to_yocto("6"));
assert_eq!(liq1[1] + liq2[1], to_yocto("10") - out);
} | rust_cleaned_test_functions.jsonl/90752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15709,
40991,
6615,
761,
5516,
368,
341,
286,
1077,
825,
76340,
284,
220,
16,
15,
84,
16,
17,
23,
25290,
7,
17,
19,
317,
286,
1077,
5206,
2266,
284,
17792,
1972,
3297,
486,
931,
543,
286,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.