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_keywrap_parsing() {
for test in wycheproof::keywrap::TestName::all() {
let _kat = wycheproof::keywrap::TestSet::load(test).unwrap();
}
} | rust_cleaned_test_functions.jsonl/5836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
10097,
620,
28598,
368,
341,
262,
369,
1273,
304,
289,
5641,
747,
75636,
486,
792,
10097,
486,
2271,
675,
486,
541,
368,
341,
286,
1077,
716,
33755,
284,
289,
5641,
747,
75636,
486,
792,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_parse_spec() {
assert_eq!(parse_spec(":"), Ok((None, None)));
assert!(parse_spec("::")
.err()
.unwrap()
.starts_with("invalid group: "));
} | rust_cleaned_test_functions.jsonl/25010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
13594,
368,
341,
286,
2060,
10714,
10297,
6400,
13594,
445,
2974,
701,
7622,
1188,
4064,
11,
2240,
4945,
286,
2060,
10297,
6400,
13594,
445,
486,
1138,
310,
659,
615,
741,
310,
659,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_trigrams_with_positions() {
let res = get_trigrams_with_positions("xaaaaabbbbd");
assert_eq!(res["aaa"], 0);
assert_eq!(res["bbb"], 1);
} | rust_cleaned_test_functions.jsonl/73151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3547,
83109,
6615,
37219,
368,
341,
286,
1077,
592,
284,
633,
3547,
83109,
6615,
37219,
445,
87,
28458,
370,
6066,
8940,
797,
286,
2060,
10714,
10297,
416,
1183,
32646,
7914,
220,
15,
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 |
#[test]
fn test_tuple_struct() {
#[derive(Tsify)]
struct Tuple(i32, String);
#[derive(Tsify)]
struct EmptyTuple();
assert_eq!(Tuple::DECL, "export type Tuple = [number, string];");
assert_eq!(EmptyTuple::DECL, "export type EmptyTuple = [];");
} | rust_cleaned_test_functions.jsonl/121072 | {
"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,
21773,
15126,
368,
341,
262,
11506,
27098,
4140,
82,
1437,
5563,
262,
2036,
24622,
1956,
18,
17,
11,
923,
317,
262,
11506,
27098,
4140,
82,
1437,
5563,
262,
2036,
22228,
28681,
1428,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exit_status_valid_target() {
let mut subprocess = start_c_program("./multi_pipe_test");
assert_eq!(
Command::new("./target/debug/inspect-fds")
.args(&[&subprocess.id().to_string()])
.status()
.expect("Could not find target/debug/inspect-fds. Is the binary compiled?")
.code()
.expect("Program was unexpectedly terminated by a signal"),
0,
"We expected the program to exit normally, but it didn't."
);
let _ = subprocess.kill();
} | rust_cleaned_test_functions.jsonl/41238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16880,
4773,
8337,
11123,
368,
341,
286,
1077,
5206,
23514,
284,
1191,
666,
25096,
13988,
26268,
41862,
4452,
797,
286,
2060,
10714,
33673,
310,
7348,
486,
931,
13988,
5657,
67479,
14,
82054,
2220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool_array_or() {
let a = BooleanArray::from(vec![false, false, true, true]);
let b = BooleanArray::from(vec![false, true, false, true]);
let c = or(&a, &b).unwrap();
let expected = BooleanArray::from(vec![false, true, true, true]);
assert_eq!(c, expected);
} | rust_cleaned_test_functions.jsonl/45013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
3858,
8734,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
25592,
20703,
3849,
11,
895,
11,
830,
11,
830,
2558,
286,
1077,
293,
284,
6992,
1857,
486,
1499,
25592,
20703,
3849,
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_trailers_with_fin_after_headers() {
// Make a new connection.
let (mut client, mut server, request_stream_id) = connect_and_send_request(true);
// Send HEADER frame.
server_send_response_and_exchange_packet(
&mut client,
&mut server,
request_stream_id,
HTTP_HEADER_FRAME_0,
false,
);
// Check response headers.
let mut response_headers = false;
while let Some(e) = client.next_event() {
if let Http3ClientEvent::HeaderReady {
stream_id,
headers,
interim,
fin,
} = e
{
assert_eq!(stream_id, request_stream_id);
check_response_header_0(&headers);
assert!(!fin);
assert!(!interim);
response_headers = true;
}
}
assert!(response_headers);
// Send trailers
server_send_response_and_exchange_packet(
&mut client,
&mut server,
request_stream_id,
HTTP_HEADER_FRAME_0,
true,
);
let events: Vec<Http3ClientEvent> = client.events().collect();
// We already had HeaderReady
let header_ready: fn(&Http3ClientEvent) -> _ =
|e| matches!(*e, Http3ClientEvent::HeaderReady { .. });
assert!(!events.iter().any(header_ready));
let data_readable: fn(&Http3ClientEvent) -> _ =
|e| matches!(*e, Http3ClientEvent::DataReadable { .. });
assert!(events.iter().any(data_readable));
let mut buf = [0_u8; 100];
let (len, fin) = client
.read_response_data(now(), request_stream_id, &mut buf)
.unwrap();
assert_eq!(0, len);
assert!(fin);
} | rust_cleaned_test_functions.jsonl/101922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 987
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
604,
388,
6615,
39737,
19844,
26719,
368,
341,
286,
442,
7405,
264,
501,
3633,
624,
286,
1077,
320,
6984,
2943,
11,
5206,
3538,
11,
1681,
12673,
842,
8,
284,
4564,
8378,
13565,
7893,
3715,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_daead_parsing() {
for test in wycheproof::daead::TestName::all() {
let _kat = wycheproof::daead::TestSet::load(test).unwrap();
}
} | rust_cleaned_test_functions.jsonl/5830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47070,
3149,
620,
28598,
368,
341,
262,
369,
1273,
304,
289,
5641,
747,
75636,
486,
3235,
3149,
486,
2271,
675,
486,
541,
368,
341,
286,
1077,
716,
33755,
284,
289,
5641,
747,
75636,
486,
3235,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_coordinate_types() {
let p: Point<u8> = Point::new(0, 0);
assert_eq!(p.x(), 0u8);
let p: Point<i64> = Point::new(1_000_000, 0);
assert_eq!(p.x(), 1_000_000i64);
} | rust_cleaned_test_functions.jsonl/99953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68649,
9763,
368,
341,
286,
1077,
281,
25,
5126,
34837,
23,
29,
284,
5126,
486,
931,
7,
15,
11,
220,
15,
317,
286,
2060,
10714,
10297,
79,
1993,
1507,
220,
15,
84,
23,
626,
286,
1077,
281,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_agent_can_execute_multi_agent_one_task() {
let mut context = get_context(accounts(1));
testing_env!(context.build());
let mut contract = Contract::new();
// Move forward time and blocks to get more accurate bps
testing_env!(context
.is_view(false)
.attached_deposit(1000000000020000000100)
.block_timestamp(BLOCK_START_TS)
.build());
// create a some tasks
contract.create_task(
accounts(3),
"increment".to_string(),
"*/1 * * * * *".to_string(),
Some(false),
Some(U128::from(0)),
Some(200),
None,
);
contract.create_task(
accounts(3),
"increment".to_string(),
"*/2 * * * * *".to_string(),
Some(false),
Some(U128::from(0)),
Some(200),
None,
);
contract.create_task(
accounts(3),
"increment".to_string(),
"*/3 * * * * *".to_string(),
Some(false),
Some(U128::from(0)),
Some(200),
None,
);
contract.create_task(
accounts(3),
"increment".to_string(),
"*/4 * * * * *".to_string(),
Some(false),
Some(U128::from(0)),
Some(200),
None,
);
testing_env!(context
.is_view(false)
.block_timestamp(BLOCK_START_TS + (120 * NANO))
.build());
// Register an agent
testing_env!(context
.is_view(false)
.attached_deposit(AGENT_STORAGE_FEE)
.predecessor_account_id(accounts(4))
.build());
contract.register_agent(Some(accounts(4)));
testing_env!(context
.is_view(false)
.attached_deposit(AGENT_STORAGE_FEE)
.predecessor_account_id(accounts(5))
.build());
contract.register_agent(Some(accounts(5)));
contract.tick();
testing_env!(context.is_view(true).build());
let (can_exec, index, _) = contract.check_agent_can_execute(accounts(4).to_string(), 1);
assert_eq!(can_exec, true, "Can execute: Multi Agent: True");
assert_eq!(index, 0, "Can execute: Multi Agent: Index 0");
let (can_exec_2, index_2, _) = contract.check_agent_can_execute(accounts(5).to_string(), 1);
assert_eq!(can_exec_2, false, "Can execute: Multi Agent: False");
assert_eq!(index_2, 1, "Can execute: Multi Agent: Index 0");
// active index shift
testing_env!(context
.is_view(false)
.block_timestamp(BLOCK_START_TS + (240 * NANO))
.build());
contract.agent_active_index = 1;
testing_env!(context.is_view(true).build());
let (can_exec, index, _) = contract.check_agent_can_execute(accounts(4).to_string(), 1);
assert_eq!(can_exec, false, "Can execute: Multi Agent: True");
assert_eq!(index, 0, "Can execute: Multi Agent: Index 0");
let (can_exec_2, index_2, _) = contract.check_agent_can_execute(accounts(5).to_string(), 1);
assert_eq!(can_exec_2, true, "Can execute: Multi Agent: False");
assert_eq!(index_2, 1, "Can execute: Multi Agent: Index 0");
} | rust_cleaned_test_functions.jsonl/6280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
25730,
27421,
44329,
25133,
25730,
11667,
12184,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
16,
1106,
286,
7497,
15879,
10297,
2147,
13239,
1423,
286,
1077,
5206,
5116,
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_node_check() {
let meta = Meta::default();
let address = Address::new("address");
let payload = Payload::new("payload");
let mut node = Node::new(&meta, &address, &payload).unwrap();
let res = node.check();
assert!(res.is_ok());
let invalid_size = 0;
node.meta.set_size(invalid_size);
let res = node.check();
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/56010 | {
"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,
5084,
7200,
368,
341,
262,
1077,
8823,
284,
15819,
486,
2258,
543,
262,
1077,
2621,
284,
9177,
486,
931,
445,
4995,
797,
262,
1077,
7729,
284,
52916,
486,
931,
445,
19427,
797,
1066,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binding_modes() {
let output = "[\"resize\",\"default\"]";
let o: Result<BindingModes, serde_json::error::Error> = serde_json::from_str(output);
assert!(o.is_ok());
} | rust_cleaned_test_functions.jsonl/56069 | {
"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,
60815,
59724,
368,
341,
286,
1077,
2550,
284,
10545,
2105,
17347,
34333,
2258,
75104,
876,
286,
1077,
297,
25,
5714,
27,
15059,
70035,
11,
61570,
9455,
486,
841,
486,
1454,
29,
284,
61570,
9455,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_root() -> Result<(), Box<dyn Error>> {
let joined_at = Timestamp::from_str("2021-09-19T14:17:32.000000+00:00")?;
let cache = InMemoryCache::new();
let permissions = cache.permissions();
cache.update(&GuildCreate(base_guild()));
cache.update(&MemberAdd(test::member(USER_ID, GUILD_ID)));
cache.update(&MemberUpdate {
avatar: None,
communication_disabled_until: None,
guild_id: GUILD_ID,
deaf: None,
joined_at,
mute: None,
nick: None,
pending: false,
premium_since: None,
roles: Vec::from([OTHER_ROLE_ID]),
user: test::user(USER_ID),
});
cache.update(&role_create(
GUILD_ID,
role_with_permissions(
OTHER_ROLE_ID,
Permissions::SEND_MESSAGES | Permissions::BAN_MEMBERS,
),
));
let expected = Permissions::CREATE_INVITE
| Permissions::BAN_MEMBERS
| Permissions::VIEW_AUDIT_LOG
| Permissions::SEND_MESSAGES;
assert_eq!(expected, permissions.root(USER_ID, GUILD_ID)?);
Ok(())
} | rust_cleaned_test_functions.jsonl/98885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 647
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12993,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
10859,
3752,
284,
32758,
486,
1499,
2895,
445,
17,
15,
17,
16,
12,
15,
24,
12,
16,
24,
51,
16,
19,
25,
16,
22,
25,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_dual_vec_sqrt() {
let res = DualVec64::<2>::new(1.2, StaticVec::new_vec([1.0, 1.0])).sqrt();
assert!((res.re - 1.09544511501033).abs() < 1e-12);
assert!((res.eps[0] - 0.456435464587638).abs() < 1e-12);
assert!((res.eps[1] - 0.456435464587638).abs() < 1e-12);
} | rust_cleaned_test_functions.jsonl/28602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96772,
13251,
92199,
368,
341,
262,
1077,
592,
284,
33659,
10050,
21,
19,
27638,
17,
6831,
931,
7,
16,
13,
17,
11,
23105,
10050,
486,
931,
13251,
2561,
16,
13,
15,
11,
220,
16,
13,
15,
54697... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sanitize_txs() {
let key = Keypair::new();
let id0 = Pubkey::default();
let program_id = solana_sdk::pubkey::new_rand();
let ix = Instruction::new_with_bincode(
program_id,
&0,
vec![
AccountMeta::new(key.pubkey(), true),
AccountMeta::new(id0, true),
],
);
let mut tx = Transaction::new_with_payer(&[ix], Some(&key.pubkey()));
let o = tx.clone();
assert_eq!(tx.sanitize(), Ok(()));
assert_eq!(tx.message.account_keys.len(), 3);
tx = o.clone();
tx.message.header.num_required_signatures = 3;
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
tx = o.clone();
tx.message.header.num_readonly_signed_accounts = 4;
tx.message.header.num_readonly_unsigned_accounts = 0;
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
tx = o.clone();
tx.message.header.num_readonly_signed_accounts = 2;
tx.message.header.num_readonly_unsigned_accounts = 2;
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
tx = o.clone();
tx.message.header.num_readonly_signed_accounts = 0;
tx.message.header.num_readonly_unsigned_accounts = 4;
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
tx = o.clone();
tx.message.instructions[0].program_id_index = 3;
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
tx = o.clone();
tx.message.instructions[0].accounts[0] = 3;
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
tx = o.clone();
tx.message.instructions[0].program_id_index = 0;
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
tx = o.clone();
tx.message.header.num_readonly_signed_accounts = 2;
tx.message.header.num_readonly_unsigned_accounts = 3;
tx.message.account_keys.resize(4, Pubkey::default());
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
tx = o;
tx.message.header.num_readonly_signed_accounts = 2;
tx.message.header.num_required_signatures = 1;
assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds));
} | rust_cleaned_test_functions.jsonl/11233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
58652,
17805,
82,
368,
341,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
877,
15,
284,
22611,
792,
486,
2258,
543,
286,
1077,
2025,
842,
284,
2048,
3362,
61783,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deref_mut() {
let str_pool : Pool<String> = Pool::with_size(1);
let mut rstring = str_pool.new_from("cat");
rstring.push_str("s love eating mice");
assert_eq!("cats love eating mice", *rstring);
} | rust_cleaned_test_functions.jsonl/121185 | {
"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,
814,
43970,
29523,
368,
341,
414,
1077,
607,
15709,
549,
22728,
3464,
29,
284,
22728,
486,
4197,
2368,
7,
16,
317,
414,
1077,
5206,
435,
917,
284,
607,
15709,
4618,
5673,
445,
4616,
797,
414,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_result_from_ffi_result_err() {
let ffi_res: FfiResult<*mut i32> = FfiResult::Err(util::into_raw(FfiError {
variant: "FailedFunction".to_char_p(),
message: "Eat my shorts!".to_char_p(),
backtrace: "".to_char_p(),
}));
let res = Fallible::from(ffi_res);
assert_eq!(res, fallible!(FailedFunction, "Eat my shorts!"));
} | rust_cleaned_test_functions.jsonl/31443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5287,
5673,
62,
53799,
5287,
9266,
368,
341,
286,
1077,
76956,
4918,
25,
434,
9983,
2077,
78822,
6984,
600,
18,
17,
29,
284,
434,
9983,
2077,
486,
7747,
67811,
486,
18122,
16067,
7832,
9983,
145... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concat_num_column() {
let xs = vec![make_num_column(), make_num_column()];
let actual = ConcatColumnData::concat(xs);
assert_eq!(u32::from(actual.at(0)), 1_u32);
assert_eq!(u32::from(actual.at(1)), 2_u32);
assert_eq!(u32::from(actual.at(2)), 1_u32);
assert_eq!(u32::from(actual.at(3)), 2_u32);
assert_eq!(actual.len(), 4);
} | rust_cleaned_test_functions.jsonl/64640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
4273,
8744,
368,
341,
262,
1077,
11943,
284,
7486,
20703,
6927,
4273,
8744,
1507,
1281,
4273,
8744,
33800,
262,
1077,
5042,
284,
78195,
2933,
1043,
486,
20164,
53322,
626,
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_hover_path_link_field() {
check(
r#"
pub struct Foo;
pub struct Bar {
/// [Foo](struct.Foo.html)
fie<|>ld: ()
}
"#,
expect
"#]],
);
} | rust_cleaned_test_functions.jsonl/66140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
2638,
7233,
5013,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9585,
2036,
33428,
280,
9585,
2036,
4716,
341,
262,
1048,
508,
40923,
9533,
1235,
991,
2624,
2564,
340,
262,
62305,
27,
91,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proof_of_possession() {
let issuer = CredentialIssuer::new();
let proof = issuer.create_proof_of_possession();
let pk = issuer.get_public_key();
assert!(CredentialVerifier::verify_proof_of_possession(pk, proof));
} | rust_cleaned_test_functions.jsonl/32382 | {
"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,
86757,
3575,
620,
3662,
1338,
368,
341,
286,
1077,
54835,
284,
93379,
98902,
486,
931,
1428,
286,
1077,
11064,
284,
54835,
2520,
86757,
3575,
620,
3662,
1338,
543,
286,
1077,
22458,
284,
54835,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_to_quarter() {
let a: PrimitiveArray<Date16Type> =
vec![Some(1), Some(59), None, Some(364)].into();
let b = date16_to_quarter(&a).unwrap();
assert_eq!(1, b.value(0));
assert_eq!(1, b.value(1));
assert_eq!(false, b.is_valid(2));
assert_eq!(4, b.value(3));
} | rust_cleaned_test_functions.jsonl/109396 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
11280,
5295,
368,
341,
286,
1077,
264,
25,
51460,
1857,
98879,
16,
21,
929,
29,
4035,
310,
7486,
20703,
8373,
7,
16,
701,
4329,
7,
20,
24,
701,
2240,
11,
4329,
7,
18,
21,
19,
26169,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_translate_slice() {
// zero len
let good_data = vec![1u8, 2, 3, 4, 5];
let data: Vec<u8> = vec![];
assert_eq!(0x1 as *const u8, data.as_ptr());
let addr = good_data.as_ptr() as *const _ as u64;
let config = Config::default();
let memory_mapping = MemoryMapping::new::<UserError>(
vec![
MemoryRegion::default(),
MemoryRegion {
host_addr: addr,
vm_addr: 0x100000000,
len: good_data.len() as u64,
vm_gap_shift: 63,
is_writable: false,
},
],
&config,
)
.unwrap();
let translated_data =
translate_slice::<u8>(&memory_mapping, data.as_ptr() as u64, 0, true, true).unwrap();
assert_eq!(data, translated_data);
assert_eq!(0, translated_data.len());
// u8
let mut data = vec![1u8, 2, 3, 4, 5];
let addr = data.as_ptr() as *const _ as u64;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![
MemoryRegion::default(),
MemoryRegion {
host_addr: addr,
vm_addr: 0x100000000,
len: data.len() as u64,
vm_gap_shift: 63,
is_writable: false,
},
],
&config,
)
.unwrap();
let translated_data =
translate_slice::<u8>(&memory_mapping, 0x100000000, data.len() as u64, true, true)
.unwrap();
assert_eq!(data, translated_data);
*data.first_mut().unwrap() = 10;
assert_eq!(data, translated_data);
assert!(
translate_slice::<u8>(&memory_mapping, data.as_ptr() as u64, u64::MAX, true, true)
.is_err()
);
assert!(translate_slice::<u8>(
&memory_mapping,
0x100000000 - 1,
data.len() as u64,
true,
true
)
.is_err());
// u64
let mut data = vec![1u64, 2, 3, 4, 5];
let addr = data.as_ptr() as *const _ as u64;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![
MemoryRegion::default(),
MemoryRegion {
host_addr: addr,
vm_addr: 0x100000000,
len: (data.len() * size_of::<u64>()) as u64,
vm_gap_shift: 63,
is_writable: false,
},
],
&config,
)
.unwrap();
let translated_data =
translate_slice::<u64>(&memory_mapping, 0x100000000, data.len() as u64, true, true)
.unwrap();
assert_eq!(data, translated_data);
*data.first_mut().unwrap() = 10;
assert_eq!(data, translated_data);
assert!(
translate_slice::<u64>(&memory_mapping, 0x100000000, u64::MAX, true, true).is_err()
);
// Pubkeys
let mut data = vec![solana_sdk::pubkey::new_rand(); 5];
let addr = data.as_ptr() as *const _ as u64;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![
MemoryRegion::default(),
MemoryRegion {
host_addr: addr,
vm_addr: 0x100000000,
len: (data.len() * std::mem::size_of::<Pubkey>()) as u64,
vm_gap_shift: 63,
is_writable: false,
},
],
&config,
)
.unwrap();
let translated_data =
translate_slice::<Pubkey>(&memory_mapping, 0x100000000, data.len() as u64, true, true)
.unwrap();
assert_eq!(data, translated_data);
*data.first_mut().unwrap() = solana_sdk::pubkey::new_rand(); // Both should point to same place
assert_eq!(data, translated_data);
} | rust_cleaned_test_functions.jsonl/69883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66381,
26488,
368,
341,
286,
442,
7168,
2422,
198,
286,
1077,
1661,
1769,
284,
7486,
20703,
16,
84,
23,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
821,
25,
11312,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_region_collection_seek_region() {
let mut cluster = new_node_cluster(0, 3);
let (tx, rx) = channel();
cluster
.sim
.wl()
.post_create_coprocessor_host(Box::new(move |id, host| {
let p = RegionInfoAccessor::new(host);
tx.send((id, p)).unwrap()
}));
cluster.run();
let region_info_providers: HashMap<_, _> = rx.try_iter().collect();
assert_eq!(region_info_providers.len(), 3);
test_seek_region_impl(cluster, region_info_providers.clone());
for (_, p) in region_info_providers {
p.stop();
}
} | rust_cleaned_test_functions.jsonl/120375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20627,
25019,
74473,
20627,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
626,
262,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
543,
262,
10652,
198,
286,
659,
147... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_learner_respond_vote() -> Result<()> {
let l = default_logger();
let mut n1 = new_test_learner_raft(1, vec![1, 2], vec![3], 10, 1, new_storage(), &l);
n1.become_follower(1, INVALID_ID);
n1.reset_randomized_election_timeout();
let mut n3 = new_test_learner_raft(3, vec![1, 2], vec![3], 10, 1, new_storage(), &l);
n3.become_follower(1, INVALID_ID);
n3.reset_randomized_election_timeout();
let do_campaign = |nw: &mut Network| {
let msg = new_message(1, 1, MessageType::MsgHup, 0);
nw.send(vec![msg]);
};
let mut network = Network::new(vec![Some(n1), None, Some(n3)], &l);
network.isolate(2);
// Can't elect new leader because 1 won't send MsgRequestVote to 3.
do_campaign(&mut network);
assert_eq!(network.peers[&1].state, StateRole::Candidate);
network.peers.get_mut(&1).unwrap().add_node(3)?;
do_campaign(&mut network);
assert_eq!(network.peers[&1].state, StateRole::Leader);
Ok(())
} | rust_cleaned_test_functions.jsonl/30346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
93595,
4918,
3511,
54360,
368,
1464,
5714,
71698,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
308,
16,
284,
501,
4452,
62,
93595,
62,
2944,
7,
16,
11,
7486,
20703,
16,
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_drained_created_account() {
let GenesisConfigInfo {
mut genesis_config,
mint_keypair,
..
} = create_genesis_config_with_leader(sol_to_lamports(100.), &Pubkey::new_unique(), 42);
genesis_config.rent = Rent::default();
activate_all_features(&mut genesis_config);
let mock_program_id = Pubkey::new_unique();
// mechanism
let data_size_no_rent = 100;
let data_size_rent = 10000;
let lamports_to_transfer = 100;
// Create legacy accounts of various kinds
let created_keypair = Keypair::new();
let mut bank = Bank::new_for_tests(&genesis_config);
bank.add_builtin(
"mock_program",
&mock_program_id,
mock_transfer_process_instruction,
);
let recent_blockhash = bank.last_blockhash();
// Create and drain a small data size account
let create_instruction = system_instruction::create_account(
&mint_keypair.pubkey(),
&created_keypair.pubkey(),
lamports_to_transfer,
data_size_no_rent,
&mock_program_id,
);
let account_metas = vec![
AccountMeta::new(mint_keypair.pubkey(), true),
AccountMeta::new(created_keypair.pubkey(), true),
AccountMeta::new(mint_keypair.pubkey(), false),
];
let transfer_from_instruction = Instruction::new_with_bincode(
mock_program_id,
&MockTransferInstruction::Transfer(lamports_to_transfer),
account_metas,
);
let tx = Transaction::new_signed_with_payer(
&[create_instruction, transfer_from_instruction],
Some(&mint_keypair.pubkey()),
&[&mint_keypair, &created_keypair],
recent_blockhash,
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
// account data is not stored because of zero balance even though its
// data wasn't cleared
assert!(bank.get_account(&created_keypair.pubkey()).is_none());
// Create and drain a large data size account
let create_instruction = system_instruction::create_account(
&mint_keypair.pubkey(),
&created_keypair.pubkey(),
lamports_to_transfer,
data_size_rent,
&mock_program_id,
);
let account_metas = vec![
AccountMeta::new(mint_keypair.pubkey(), true),
AccountMeta::new(created_keypair.pubkey(), true),
AccountMeta::new(mint_keypair.pubkey(), false),
];
let transfer_from_instruction = Instruction::new_with_bincode(
mock_program_id,
&MockTransferInstruction::Transfer(lamports_to_transfer),
account_metas,
);
let tx = Transaction::new_signed_with_payer(
&[create_instruction, transfer_from_instruction],
Some(&mint_keypair.pubkey()),
&[&mint_keypair, &created_keypair],
recent_blockhash,
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
// account data is not stored because of zero balance
assert!(bank.get_account(&created_keypair.pubkey()).is_none());
} | rust_cleaned_test_functions.jsonl/29014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1569
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
2627,
27288,
13500,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
6615,
79991,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_async_delayed_ops() {
run_in_task(|cx| {
let (mut isolate, dispatch_count) = setup(Mode::Async);
js_check(isolate.execute(
"setup2.js",
r#"
let nrecv = 0;
Deno.core.setAsyncHandler(1, (buf) => {
nrecv++;
});
"#,
));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 0);
js_check(isolate.execute(
"check1.js",
r#"
assert(nrecv == 0);
let control = new Uint8Array([42]);
Deno.core.send(1, control);
assert(nrecv == 0);
"#,
));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
js_check(isolate.execute(
"check2.js",
r#"
assert(nrecv == 1);
Deno.core.send(1, control);
assert(nrecv == 1);
"#,
));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 2);
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
js_check(isolate.execute("check3.js", "assert(nrecv == 2)"));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 2);
assert!(match isolate.poll_unpin(cx) {
Poll::Ready(Ok(_)) => true,
_ => false,
});
});
} | rust_cleaned_test_functions.jsonl/970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 785
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40002,
28346,
22198,
291,
21959,
368,
341,
262,
1598,
1243,
12184,
22428,
25844,
91,
341,
414,
1077,
320,
6984,
42123,
11,
6845,
3180,
8,
284,
6505,
3189,
534,
486,
6525,
626,
414,
6994,
7200,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_ccsds_parser_push_bytes() {
let mut parser = CcsdsParser::new();
parser.recv_slice(&[0x1F,0xFF,0xFF,0xFF,0x00,0x03,0xFF,0xFF]);
assert_eq!(parser.current_status(), CcsdsParserStatus::NotEnoughBytesPacketLength);
assert_eq!(parser.pull_packet(), None);
parser.recv_slice(&[0, 0]);
assert_eq!(parser.current_status(), CcsdsParserStatus::ValidPacket);
assert_ne!(parser.pull_packet(), None);
} | rust_cleaned_test_functions.jsonl/105742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28955,
82,
5356,
18517,
14218,
12524,
368,
972,
262,
1077,
5206,
6729,
284,
356,
4837,
5356,
6570,
486,
931,
1647,
262,
6729,
40433,
26488,
2099,
58,
15,
87,
16,
37,
11,
15,
9264,
11,
15,
9264... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_term_with_float() {
test_parse_query_to_ast_helper("abc:1.1", "\"abc\":\"1.1\"");
test_parse_query_to_ast_helper("a.b.c:1.1", "\"a.b.c\":\"1.1\"");
test_parse_query_to_ast_helper("a\\ b\\ c:1.1", "\"a b c\":\"1.1\"");
} | rust_cleaned_test_functions.jsonl/64419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
17464,
6615,
17586,
368,
341,
286,
1273,
21039,
5738,
2346,
48019,
10418,
445,
13683,
25,
16,
13,
16,
497,
15898,
13683,
23488,
16,
13,
16,
88385,
286,
1273,
21039,
5738,
2346,
48019,
10418... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zip_composes() {
let h1 = hlist![1, "1", 1.0];
let h2 = hlist![2, "2", 2.0];
let h3 = hlist![3, "3", 3.0];
let zipped = h1.zip(h2).zip(h3);
assert_eq!(
zipped,
hlist![((1, 2), 3), (("1", "2"), "3"), ((1.0, 2.0), 3.0)],
);
} | rust_cleaned_test_functions.jsonl/41580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
2965,
8285,
368,
341,
286,
1077,
305,
16,
284,
305,
1607,
20703,
16,
11,
330,
16,
497,
220,
16,
13,
15,
935,
286,
1077,
305,
17,
284,
305,
1607,
20703,
17,
11,
330,
17,
497,
220,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_asn1_too_short_signature() {
assert!(Signature::from_asn1(&[]).is_err());
assert!(Signature::from_asn1(&[SEQUENCE_TAG]).is_err());
assert!(Signature::from_asn1(&[SEQUENCE_TAG, 0x00]).is_err());
assert!(Signature::from_asn1(&[SEQUENCE_TAG, 0x03, INTEGER_TAG, 0x01, 0x01]).is_err());
} | rust_cleaned_test_functions.jsonl/31928 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
77,
16,
2346,
78,
16673,
39859,
368,
341,
286,
2060,
10297,
25088,
486,
1499,
11898,
77,
16,
2099,
1294,
568,
285,
9266,
1423,
286,
2060,
10297,
25088,
486,
1499,
11898,
77,
16,
2099,
58,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_range_int_max() {
assert_eq!(isize::MAX.to_int(), Some(isize::MAX as isize));
assert_eq!(isize::MAX.to_i8(), None);
assert_eq!(isize::MAX.to_i16(), None);
assert_eq!(isize::MAX.to_i64(), Some(isize::MAX as i64));
assert_eq!(isize::MAX.to_u8(), None);
assert_eq!(isize::MAX.to_u16(), None);
assert_eq!(isize::MAX.to_u64(), Some(isize::MAX as u64));
#[cfg(target_pointer_width = "32")]
fn check_word_size() {
assert_eq!(isize::MAX.to_i32(), Some(isize::MAX as i32));
assert_eq!(isize::MAX.to_u32(), Some(isize::MAX as u32));
}
#[cfg(target_pointer_width = "64")]
fn check_word_size() {
assert_eq!(isize::MAX.to_i32(), None);
assert_eq!(isize::MAX.to_u32(), None);
}
check_word_size();
} | rust_cleaned_test_functions.jsonl/25356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
9698,
4042,
6345,
368,
341,
286,
2060,
10714,
10297,
285,
551,
486,
10586,
2389,
4042,
1507,
220,
4329,
9623,
551,
486,
10586,
438,
91373,
1106,
286,
2060,
10714,
10297,
285,
551,
486,
10586... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timeseries() {
use super::TimeUnit;
let start = Epoch::from_gregorian_utc_at_midnight(2017, 1, 14);
let end = Epoch::from_gregorian_utc_at_noon(2017, 1, 14);
let step = TimeUnit::Hour * 2;
let mut count = 0;
let time_series = TimeSeries::exclusive(start, end, step);
for epoch in time_series {
println!("{}", epoch);
count += 1;
}
assert_eq!(count, 6, "Should have five items in this iterator");
count = 0;
let time_series = TimeSeries::inclusive(start, end, step);
for epoch in time_series {
println!("{}", epoch);
count += 1;
}
assert_eq!(count, 7, "Should have six items in this iterator");
} | rust_cleaned_test_functions.jsonl/17793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22353,
4699,
368,
341,
262,
990,
2256,
486,
1462,
4562,
280,
262,
1077,
1191,
284,
87379,
486,
1499,
1889,
1580,
22090,
84259,
3752,
43733,
9287,
7,
17,
15,
16,
22,
11,
220,
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... | 3 |
#[test]
fn test_split_vfio_option() {
assert_eq!(
split_vfio_option("0000:01:00.0=02/01"),
Some(("0000:01:00.0", "02/01"))
);
assert_eq!(split_vfio_option("0000:01:00.0=02/01=rubbish"), None);
assert_eq!(split_vfio_option("0000:01:00.0"), None);
} | rust_cleaned_test_functions.jsonl/66441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
2273,
69,
815,
9672,
368,
341,
286,
2060,
10714,
33673,
310,
6718,
2273,
69,
815,
9672,
445,
15,
15,
15,
15,
25,
15,
16,
25,
15,
15,
13,
15,
28,
15,
17,
14,
15,
16,
4461,
310,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_collection() {
let mut collection = setup_collection();
collection.set().unwrap();
let create_data = collection.data.clone().unwrap();
// Cleanup stored data to make sure load work
collection.data = json!({}).into();
collection.load().unwrap();
let load_data = collection.data.unwrap();
assert_eq!(create_data, load_data);
} | rust_cleaned_test_functions.jsonl/63498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
25019,
368,
341,
286,
1077,
5206,
4426,
284,
6505,
25019,
543,
286,
4426,
980,
1005,
15454,
543,
286,
1077,
1855,
1769,
284,
4426,
2196,
15997,
1005,
15454,
1428,
286,
442,
53512,
9768,
821... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_version() {
let version: SystemVersion =
serde_json::from_str(r#""not a real version number""#).unwrap();
assert_eq!(version, SystemVersion::Opaque("not a real version number".to_owned()));
let version: SystemVersion = serde_json::from_str(r#""1.2.3""#).unwrap();
assert_eq!(version, SystemVersion::Semantic(SemanticVersion::from([1, 2, 3])));
} | rust_cleaned_test_functions.jsonl/126051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
9438,
368,
341,
286,
1077,
2319,
25,
739,
5637,
4035,
310,
61570,
9455,
486,
1499,
2895,
2601,
2,
3014,
1921,
264,
1931,
2319,
1372,
3014,
2,
568,
15454,
543,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_after_importing_wallet_success() {
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE, "false");
let wallet_name = "test_init_after_importing_wallet_success";
settings::set_config_value(settings::CONFIG_WALLET_NAME,wallet_name);
let exported_path = format!(r#"/tmp/{}"#, wallet_name);
let wallet_key = settings::get_config_value(settings::CONFIG_WALLET_KEY).unwrap();
let backup_key = settings::get_config_value(settings::CONFIG_WALLET_BACKUP_KEY).unwrap();
let different_wallet_name = "different_wallet_name";
let dir = export_test_wallet();
vcx_shutdown(true);
let import_config = json!({
settings::CONFIG_WALLET_NAME: wallet_name,
settings::CONFIG_WALLET_KEY: wallet_key,
settings::CONFIG_EXPORTED_WALLET_PATH: exported_path,
settings::CONFIG_WALLET_BACKUP_KEY: backup_key,
}).to_string();
import(&import_config).unwrap();
let content = json!({
"wallet_name": wallet_name,
"wallet_key": wallet_key,
}).to_string();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
delete_import_wallet_path(dir);
vcx_shutdown(true);
} | rust_cleaned_test_functions.jsonl/19805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 780
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
19844,
18434,
287,
62308,
18632,
368,
341,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
11,
330,
3849,
797,
286,
1077,
15085,
1269... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_initialize_bad_recent_blockhash_state_fail() {
let nonce_address = Pubkey::new_unique();
let nonce_account = nonce_account::create_account(1_000_000).into_inner();
#[allow(deprecated)]
let blockhash_id = sysvar::recent_blockhashes::id();
process_instruction(
&serialize(&SystemInstruction::InitializeNonceAccount(nonce_address)).unwrap(),
vec![
(nonce_address, nonce_account),
(blockhash_id, create_default_account()),
],
vec![
AccountMeta {
pubkey: nonce_address,
is_signer: true,
is_writable: true,
},
AccountMeta {
pubkey: blockhash_id,
is_signer: false,
is_writable: false,
},
],
Err(InstructionError::InvalidArgument),
);
} | rust_cleaned_test_functions.jsonl/106224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 556
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
40889,
34199,
62361,
7113,
8296,
4387,
22121,
368,
341,
286,
1077,
39676,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
39676,
13500,
284,
39676,
13500,
486,
3182,
13500,
7,
16,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_relay_avrcp_ends() -> Result<(), Error> {
let mut exec = fasync::Executor::new().expect("executor needed");
let (pubisher_requests, avrcp_requests, _stop_sender, relay_fut) = setup_media_relay(None)?;
pin_mut!(relay_fut);
let res = exec.run_until_stalled(&mut relay_fut);
assert!(res.is_pending());
let (player_client, controller_requests) =
finish_relay_setup(&mut relay_fut, &mut exec, pubisher_requests, avrcp_requests, None)?;
// Closing the AVRCP controller should end the relay.
drop(controller_requests);
let res = exec.run_until_stalled(&mut relay_fut);
assert!(res.is_ready());
// The MediaSession should also drop based on this.
let mut watch_info_fut = player_client.watch_info_change();
match exec.run_until_stalled(&mut watch_info_fut) {
Poll::Ready(Err(_e)) => {}
x => panic!("Expected player to be disconnected, but got {:?} from watch_info", x),
};
Ok(())
} | rust_cleaned_test_functions.jsonl/45973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
6651,
26173,
1287,
79,
90729,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
17119,
445,
80787,
4362,
3071,
286,
1077,
320,
9585,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_force_leader_on_healthy_region() {
let mut cluster = new_node_cluster(0, 5);
cluster.cfg.raft_store.raft_base_tick_interval = ReadableDuration::millis(30);
cluster.cfg.raft_store.raft_election_timeout_ticks = 5;
cluster.cfg.raft_store.raft_store_max_leader_lease = ReadableDuration::millis(40);
cluster.pd_client.disable_default_operator();
cluster.run();
cluster.must_put(b"k1", b"v1");
let region = cluster.get_region(b"k1");
cluster.must_split(®ion, b"k9");
let region = cluster.get_region(b"k2");
let peer_on_store5 = find_peer(®ion, 5).unwrap();
cluster.must_transfer_leader(region.get_id(), peer_on_store5.clone());
cluster.enter_force_leader(region.get_id(), 1, vec![3, 4, 5]);
// make sure it leaves pre force leader state.
std::thread::sleep(Duration::from_millis(
cluster.cfg.raft_store.raft_election_timeout_ticks as u64
* cluster.cfg.raft_store.raft_base_tick_interval.as_millis()
* 3,
));
// put and get can propose successfully.
assert_eq!(cluster.must_get(b"k1"), Some(b"v1".to_vec()));
cluster.must_put(b"k2", b"v2");
cluster.exit_force_leader(region.get_id(), 1);
cluster.must_put(b"k4", b"v4");
assert_eq!(cluster.must_get(b"k4"), Some(b"v4".to_vec()));
} | rust_cleaned_test_functions.jsonl/6007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 567
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40739,
79991,
4470,
62,
37028,
20627,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
20,
317,
262,
10652,
30481,
13,
2944,
14809,
13,
2944,
7651,
43612,
20541,
284,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixed_size_list_array_builder_empty() {
let values_builder = Int32Array::builder(5);
let mut builder = FixedSizeListBuilder::new(values_builder, 3);
let arr = builder.finish();
assert_eq!(0, arr.len());
assert_eq!(0, builder.len());
} | rust_cleaned_test_functions.jsonl/30985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2368,
2019,
3858,
28532,
15124,
368,
341,
286,
1077,
2750,
28532,
284,
1333,
18,
17,
1857,
486,
17850,
7,
20,
317,
286,
1077,
5206,
7363,
284,
20149,
1695,
852,
3297,
486,
931,
20103,
285... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concurrent() {
let runtime = Builder::new_current_thread().enable_all().build().unwrap();
runtime.block_on(async move {
let pool = Arc::new(WorkerPool::<Message, Response, Processor>::new(
4,
Duration::from_millis(1000),
));
let pool_to_move = pool.clone();
cube_ext::spawn(async move { pool_to_move.wait_processing_loops().await });
let mut futures = Vec::new();
for i in 0..10 {
futures.push((i, pool.process(Message::Delay(i * 100))));
}
for (i, f) in futures {
println!("Testing {} future", i);
assert_eq!(f.await.unwrap(), Response::Foo(i * 100));
}
pool.stop_workers().await.unwrap();
});
} | rust_cleaned_test_functions.jsonl/37996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3231,
368,
341,
286,
1077,
15592,
284,
20626,
486,
931,
11080,
10814,
1005,
12552,
5705,
1005,
5834,
1005,
15454,
1428,
286,
15592,
15697,
4470,
18285,
3271,
341,
310,
1077,
7314,
284,
19689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_qtime_chrono() {
let chrono_time = NaiveTime::from_hms(10, 30, 50);
let qtime: QTime = chrono_time.into();
let actual_chrono_time: NaiveTime = qtime.into();
assert_eq!((10, 30, 50, 0), qtime.get_h_m_s_ms());
assert_eq!(chrono_time, actual_chrono_time);
} | rust_cleaned_test_functions.jsonl/45521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
1678,
4138,
2248,
78,
368,
341,
262,
1077,
80372,
3009,
284,
12812,
533,
1462,
486,
1499,
1523,
1011,
7,
16,
15,
11,
220,
18,
15,
11,
220,
20,
15,
317,
262,
1077,
2804,
1678,
25,
1207,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_too_long() {
let line = "a".repeat(8193);
assert_eq!(line.parse::<KeyEntry>().unwrap_err(), ParseKeyError::KeyTooLong);
} | rust_cleaned_test_functions.jsonl/31213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
2346,
78,
17799,
368,
341,
286,
1077,
1555,
284,
330,
64,
3263,
30624,
7,
23,
16,
24,
18,
317,
286,
2060,
10714,
10297,
1056,
4632,
27638,
1592,
5874,
10483,
15454,
9266,
1507,
14775,
1592... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_timeout_query_tcp() {
env_logger::try_init().ok();
let mut io_loop = Runtime::new().unwrap();
let addr: SocketAddr = ("203.0.113.0", 53)
.to_socket_addrs()
.unwrap()
.next()
.unwrap();
let (stream, sender) =
TcpClientStream::<TokioTcpStream>::with_timeout(addr, std::time::Duration::from_millis(1));
let (bg, client) = ClientFuture::with_timeout(
Box::new(stream),
sender,
std::time::Duration::from_millis(1),
None,
);
io_loop.spawn(bg);
test_timeout_query(client, io_loop);
} | rust_cleaned_test_functions.jsonl/33948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20537,
5738,
45562,
368,
341,
262,
6105,
27413,
486,
1539,
6137,
1005,
562,
543,
262,
1077,
5206,
6399,
17198,
284,
10954,
486,
931,
1005,
15454,
1428,
1066,
262,
1077,
10789,
25,
20954,
13986,
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_peer_stream_start_success() {
let mut exec = fasync::TestExecutor::new().expect("failed to create an executor");
let (remote, mut profile_request_stream, _, peer) = setup_peer_test();
let remote_seid = 2_u8.try_into().unwrap();
let codec_params = ServiceCapability::MediaCodec {
media_type: avdtp::MediaType::Audio,
codec_type: avdtp::MediaCodecType::AUDIO_SBC,
codec_extra: vec![0x11, 0x45, 51, 51],
};
let start_future = peer.stream_start(remote_seid, codec_params);
pin_mut!(start_future);
assert!(exec.run_until_stalled(&mut start_future).is_pending());
receive_simple_accept(&remote, 0x03); // Set Configuration
assert!(exec.run_until_stalled(&mut start_future).is_pending());
receive_simple_accept(&remote, 0x06); // Open
match exec.run_until_stalled(&mut start_future) {
Poll::Pending => {}
Poll::Ready(Err(e)) => panic!("Expected to be pending but error: {:?}", e),
Poll::Ready(Ok(_)) => panic!("Expected to be pending but finished!"),
};
// Should connect the media channel after open.
let (_, transport) = Channel::create();
let request = exec.run_until_stalled(&mut profile_request_stream.next());
match request {
Poll::Ready(Some(Ok(ProfileRequest::Connect { peer_id, connection, responder }))) => {
assert_eq!(PeerId(1), peer_id.into());
assert_eq!(connection, ConnectParameters::L2cap(Peer::TRANSPORT_CHANNEL_PARAMS));
let channel = transport.try_into().unwrap();
responder.send(&mut Ok(channel)).expect("responder sends");
}
x => panic!("Should have sent a open l2cap request, but got {:?}", x),
};
match exec.run_until_stalled(&mut start_future) {
Poll::Pending => {}
Poll::Ready(Err(e)) => panic!("Expected to be pending but error: {:?}", e),
Poll::Ready(Ok(_)) => panic!("Expected to be pending but finished!"),
};
receive_simple_accept(&remote, 0x07); // Start
match exec.run_until_stalled(&mut start_future) {
Poll::Pending => panic!("Should be ready after start succeeds"),
Poll::Ready(Err(e)) => panic!("Shouldn't be an error but returned {:?}", e),
// TODO: confirm the stream is usable
Poll::Ready(Ok(_stream)) => {}
}
} | rust_cleaned_test_functions.jsonl/91780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
12673,
4906,
18632,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
1077,
320,
18147,
11,
5206,
5526,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_partitioned_index_filters() {
let path = tempdir_with_prefix("_rust_rocksdb_set_cache_and_index");
let mut opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
opts.create_if_missing(true);
let mut block_opts = BlockBasedOptions::new();
// See https://github.com/facebook/rocksdb/wiki/Partitioned-Index-Filters#how-to-use-it
block_opts.set_index_type(IndexType::TwoLevelIndexSearch);
block_opts.set_partition_filters(true);
block_opts.set_bloom_filter(10, false);
block_opts.set_metadata_block_size(4096);
block_opts.set_cache_index_and_filter_blocks(true);
block_opts.set_pin_top_level_index_and_filter(true);
block_opts.set_cache_index_and_filter_blocks_with_high_priority(true);
block_opts.set_pin_l0_filter_and_index_blocks_in_cache(true);
cf_opts.set_block_based_table_factory(&block_opts);
DB::open_cf(
opts,
path.path().to_str().unwrap(),
vec![("default", cf_opts)],
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/34098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43840,
291,
3560,
22481,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
2602,
11529,
8378,
3560,
797,
262,
1077,
5206,
12185,
284,
5952,
3798,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_union() {
let got = parse!(
r#"
union createhow4 switch (createmode4 mode) {
case GUARDED4:
fattr4 createattrs;
case EXCLUSIVE4:
verifier4 createverf;
};"#
);
assert_eq!(got.name, "createhow4");
assert_eq!(got.default, None);
assert_eq!(got.void_cases.len(), 0);
assert_eq!(got.cases.len(), 2);
assert_eq!(&got.cases[0].case_values, &["GUARDED4"]);
assert_eq!(got.cases[0].field_name, "createattrs");
assert_eq!(
got.cases[0].field_value,
ArrayType::None(BasicType::Ident("fattr4".to_string()))
);
assert_eq!(&got.cases[1].case_values, &["EXCLUSIVE4"]);
assert_eq!(got.cases[1].field_name, "createverf");
assert_eq!(
got.cases[1].field_value,
ArrayType::None(BasicType::Ident("verifier4".to_string()))
);
assert_eq!(got.switch.var_name, "mode");
assert_eq!(
got.switch.var_type,
BasicType::Ident("createmode4".to_string())
);
} | rust_cleaned_test_functions.jsonl/7406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51621,
368,
341,
286,
1077,
2684,
284,
4715,
33673,
310,
435,
2,
698,
197,
73924,
1855,
5158,
19,
3398,
320,
837,
37246,
534,
19,
3856,
8,
341,
298,
2722,
45272,
934,
11490,
19,
510,
464,
1166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raster_direct_creation_and_clear_in_memory() {
let info = ImageInfo::new((2, 2), ColorType::RGBA8888, AlphaType::Unpremul, None);
assert_eq!(8, info.min_row_bytes());
let mut bytes: [u8; 8 * 2] = Default::default();
{
let mut canvas = Canvas::from_raster_direct(&info, bytes.as_mut(), None, None).unwrap();
canvas.clear(Color::RED);
}
assert_eq!(0xff, bytes[0]);
assert_eq!(0x00, bytes[1]);
assert_eq!(0x00, bytes[2]);
assert_eq!(0xff, bytes[3]);
} | rust_cleaned_test_functions.jsonl/125497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
2300,
32871,
46163,
8378,
21811,
1243,
19195,
368,
972,
286,
1077,
3546,
284,
4654,
1731,
486,
931,
1188,
17,
11,
220,
17,
701,
3478,
929,
486,
58927,
23,
23,
23,
23,
11,
24708,
929,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_header_and_dicom_tags_no_columns() {
let mut header = vec!["foo", "bar", "baz"];
let mut dicom_tags = vec!["qux", "quux", "quuz"];
get_header_and_dicom_tags(&mut header, &mut dicom_tags, None).unwrap();
assert_eq!(header, vec!["foo", "bar", "baz"]);
assert_eq!(dicom_tags, vec!["qux", "quux", "quuz"]);
} | rust_cleaned_test_functions.jsonl/76511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8757,
8378,
39154,
316,
16333,
6536,
22590,
368,
341,
286,
1077,
5206,
4247,
284,
7486,
0,
1183,
7975,
497,
330,
2257,
497,
330,
42573,
6332,
286,
1077,
5206,
21249,
316,
16333,
284,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fetch_hdu_name() {
duplicate_test_file(|filename| {
let mut f = FitsFile::open(filename).unwrap();
let hdu = f.hdu("TESTEXT").unwrap();
assert_eq!(hdu.name(&mut f).unwrap(), "TESTEXT".to_string());
});
} | rust_cleaned_test_functions.jsonl/119000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
1523,
1054,
1269,
368,
341,
286,
22513,
4452,
2458,
22428,
8404,
91,
341,
310,
1077,
5206,
282,
284,
78245,
1703,
486,
2508,
10961,
568,
15454,
543,
310,
1077,
305,
1054,
284,
282,
860,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_emphasis_pattern() {
let output = inline_parse(&String::from("*hoge*"));
assert_eq!(output, String::from(r#"<em class="flav-md-em">hoge</em>"#));
} | rust_cleaned_test_functions.jsonl/22204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22504,
54149,
21260,
368,
341,
310,
1077,
2550,
284,
7381,
21039,
2099,
703,
486,
1499,
29592,
71,
40532,
9,
4010,
310,
2060,
10714,
10297,
3006,
11,
923,
486,
1499,
2601,
2,
22476,
336,
536,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_case_1() {
let input = "mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X
mem[8] = 11
mem[7] = 101
mem[8] = 0";
let memory = apply_mask_to_inputs(input);
assert_eq!(2, memory.len());
assert_eq!(&101, memory.get(&7).unwrap());
assert_eq!(&64, memory.get(&8).unwrap());
} | rust_cleaned_test_functions.jsonl/90591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
16,
368,
341,
286,
1077,
1946,
284,
330,
11258,
284,
19975,
61516,
61516,
61516,
6148,
16,
23830,
15,
55,
198,
10536,
58,
23,
60,
284,
220,
16,
16,
198,
10536,
58,
22,
60,
284,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_sig() {
verify_signature("", &jwk_from_tezos_key("edpkvRWhuk5cLe5vwR7TGfSJxVLmVDk5og45WAhsAAvfqQXmYKNPve").unwrap(), "edsigtk2FRtmFKJR125SZH3vRNgv6DNm4HqjBdzb736GptFRbj4Zj9fuURJQeaPyaDWT8QYv4w8scSPyTRXKSoeffpXGeagyW9G").unwrap()
} | rust_cleaned_test_functions.jsonl/76522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
29252,
368,
341,
262,
10146,
39859,
19814,
609,
73,
50522,
5673,
528,
10125,
436,
3097,
445,
291,
20819,
85,
49,
1639,
3101,
20,
66,
2304,
20,
34431,
49,
22,
76787,
69,
97489,
87,
30698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multi_const() {
let segments = PathParser::new("/hello/world").parse().unwrap();
assert_eq!(format!("{:?}", segments), r#"[ConstPart("hello"), ConstPart("world")]"#);
} | rust_cleaned_test_functions.jsonl/63586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25133,
13610,
368,
341,
286,
1077,
20632,
284,
7933,
6570,
486,
931,
4283,
14990,
78892,
1827,
6400,
1005,
15454,
543,
286,
2060,
10714,
10297,
2243,
88928,
25,
52652,
20632,
701,
435,
2,
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 |
#[test]
fn test_fn_precedence_in_where_clause() {
let sig = quote! {
fn f<G>()
where
G: FnOnce() -> i32 + Send,
{
}
};
let fun = syn::parse2::<ItemFn>(sig).unwrap();
let where_clause = fun.decl.generics.where_clause.as_ref().unwrap();
assert_eq!(where_clause.predicates.len(), 1);
let predicate = match where_clause.predicates[0] {
WherePredicate::Type(ref pred) => pred,
_ => panic!("wrong predicate kind"),
};
assert_eq!(predicate.bounds.len(), 2, "{:#?}", predicate.bounds);
let first_bound = &predicate.bounds[0];
assert_eq!(quote!(#first_bound).to_string(), "FnOnce ( ) -> i32");
let second_bound = &predicate.bounds[1];
assert_eq!(quote!(#second_bound).to_string(), "Send");
} | rust_cleaned_test_functions.jsonl/36689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
10442,
1998,
763,
1243,
36814,
57530,
368,
341,
1066,
262,
1077,
8366,
284,
12641,
0,
341,
286,
5168,
282,
59727,
18949,
286,
1380,
198,
310,
479,
25,
50182,
12522,
368,
1464,
600,
18,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_generic_list_set() {
let gil = Python::acquire_gil();
let py = gil.python();
let list = PyCell::new(py, GenericList { items: vec![] }).unwrap();
py_run!(py, list, "list.items = [1, 2, 3]");
assert!(list
.borrow()
.items
.iter()
.zip(&[1u32, 2, 3])
.all(|(a, b)| a.as_ref(py).eq(&b.into_py(py)).unwrap()));
} | rust_cleaned_test_functions.jsonl/46922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
2019,
2602,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
1428,
262,
1077,
1140,
284,
5355,
3599,
486,
931,
46827,
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_eval_literals() {
let state = Rc::new(RefCell::new(init_gc()));
assert_eq!(JsType::JsNum(5.0f64), eval_string("5.0;\n", state.clone()).unwrap().0.t);
assert_eq!(JsType::JsNum(0.0f64), eval_string("0.0;\n", state.clone()).unwrap().0.t);
assert_eq!(JsType::JsUndef, eval_string("undefined;\n", state.clone()).unwrap().0.t);
} | rust_cleaned_test_functions.jsonl/118084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
49643,
368,
341,
286,
1077,
1584,
284,
81463,
486,
931,
7,
3945,
3599,
486,
931,
38250,
49423,
7392,
286,
2060,
10714,
10297,
30480,
929,
486,
30480,
4651,
7,
20,
13,
15,
69,
21,
19,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mapper() {
let mut builder = RomBuilder::new();
assert_eq!(builder.build_rom().mapper(), 0x00u8);
builder.set_mapper(0x0Au8);
assert_eq!(builder.build_rom().mapper(), 0x0Au8);
builder.set_mapper(0xF0u8);
assert_eq!(builder.build_rom().mapper(), 0xF0u8);
} | rust_cleaned_test_functions.jsonl/104410 | {
"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,
76664,
368,
972,
286,
1077,
5206,
7363,
284,
11774,
3297,
486,
931,
1647,
286,
2060,
10714,
10297,
17850,
13239,
81383,
1005,
38076,
1507,
220,
15,
87,
15,
15,
84,
23,
3079,
286,
7363,
980,
7666... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_box_slice_writer() {
let mut writer = Cursor::new(vec![0u8; 9].into_boxed_slice());
assert_eq!(writer.position(), 0);
assert_eq!(writer.write(&[0]).unwrap(), 1);
assert_eq!(writer.position(), 1);
assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3);
assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4);
assert_eq!(writer.position(), 8);
assert_eq!(writer.write(&[]).unwrap(), 0);
assert_eq!(writer.position(), 8);
assert_eq!(writer.write(&[8, 9]).unwrap(), 1);
assert_eq!(writer.write(&[10]).unwrap(), 0);
let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8];
assert_eq!(&**writer.get_ref(), b);
} | rust_cleaned_test_functions.jsonl/4220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10194,
26488,
28908,
368,
341,
286,
1077,
5206,
6916,
284,
28067,
486,
931,
25592,
20703,
15,
84,
23,
26,
220,
24,
936,
18122,
10194,
291,
26488,
1423,
286,
2060,
10714,
10297,
18189,
6187,
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... | 1 |
#[test]
fn test_wait_duration_is_capped() {
let config = config_generator();
let mut timer = MockTimer::new();
// The timer should be capped at 1 hour. The MockTimer will assert if it's asked to wait
// a different amount of time.
timer.expect(Duration::from_secs(1 * 60 * 60));
let now = clock::now();
let policy_engine = MockPolicyEngine {
check_schedule: UpdateCheckSchedule {
last_update_time: now + Duration::from_secs(24 * 60 * 60),
next_update_time: now
+ Duration::from_secs(24 * 60 * 60)
+ Duration::from_secs(1 * 60 * 60),
next_update_window_start: now
+ Duration::from_secs(24 * 60 * 60)
+ Duration::from_secs(1 * 60 * 60),
},
..MockPolicyEngine::default()
};
let state_machine = block_on(StateMachine::new(
policy_engine,
StubHttpRequest,
StubInstaller::default(),
&config,
timer,
StubMetricsReporter,
Rc::new(Mutex::new(StubStorage)),
make_test_app_set(),
));
let state_machine = Rc::new(RefCell::new(state_machine));
let spawn_state_machine = Rc::clone(&state_machine);
let mut pool = LocalPool::new();
pool.spawner()
.spawn_local(async move {
StateMachine::start(spawn_state_machine).await;
})
.unwrap();
pool.run_until_stalled();
state_machine.borrow().timer.assert_durations_waited();
} | rust_cleaned_test_functions.jsonl/104623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 861
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18760,
25454,
6892,
666,
5677,
368,
341,
286,
1077,
2193,
284,
2193,
25813,
543,
286,
1077,
5206,
9021,
284,
14563,
10105,
486,
931,
543,
286,
442,
576,
9021,
1265,
387,
60146,
518,
220,
16,
646... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_get() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
sender
.write_all(http_request("GET", "/mmds", Some("body")).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
if let Err(Error::Generic(StatusCode::BadRequest, err_msg)) =
ParsedRequest::try_from_request(&req)
{
assert_eq!(err_msg, "GET request cannot have a body.");
} else {
panic!("GET request with body failed the tests.")
}
} | rust_cleaned_test_functions.jsonl/106565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
3062,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
317,
286,
4646,
198,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_machine() {
let mut factory = MockLoop::new(());
let m = M(10);
let mut value = None;
Machine::wakeup(m, &mut factory.scope(1)).wrap(|x| value = Some(x));
assert_eq!(value, Some(M(11)));
} | rust_cleaned_test_functions.jsonl/24454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38695,
368,
341,
286,
1077,
5206,
8633,
284,
14563,
14620,
486,
931,
7,
1423,
286,
1077,
296,
284,
386,
7,
16,
15,
317,
286,
1077,
5206,
897,
284,
2240,
280,
286,
12960,
486,
86,
62744,
1255,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_subtract_ristretto() {
// identity
let identity = PodRistrettoPoint(RistrettoPoint::identity().compress().to_bytes());
let point = PodRistrettoPoint([
210, 174, 124, 127, 67, 77, 11, 114, 71, 63, 168, 136, 113, 20, 141, 228, 195, 254,
232, 229, 220, 249, 213, 232, 61, 238, 152, 249, 83, 225, 206, 16,
]);
assert_eq!(add_ristretto(&point, &identity).unwrap(), point);
assert_eq!(subtract_ristretto(&point, &identity).unwrap(), point);
// associativity
let point_a = PodRistrettoPoint([
208, 165, 125, 204, 2, 100, 218, 17, 170, 194, 23, 9, 102, 156, 134, 136, 217, 190, 98,
34, 183, 194, 228, 153, 92, 11, 108, 103, 28, 57, 88, 15,
]);
let point_b = PodRistrettoPoint([
208, 241, 72, 163, 73, 53, 32, 174, 54, 194, 71, 8, 70, 181, 244, 199, 93, 147, 99,
231, 162, 127, 25, 40, 39, 19, 140, 132, 112, 212, 145, 108,
]);
let point_c = PodRistrettoPoint([
250, 61, 200, 25, 195, 15, 144, 179, 24, 17, 252, 167, 247, 44, 47, 41, 104, 237, 49,
137, 231, 173, 86, 106, 121, 249, 245, 247, 70, 188, 31, 49,
]);
assert_eq!(
add_ristretto(&add_ristretto(&point_a, &point_b).unwrap(), &point_c),
add_ristretto(&point_a, &add_ristretto(&point_b, &point_c).unwrap()),
);
assert_eq!(
subtract_ristretto(&subtract_ristretto(&point_a, &point_b).unwrap(), &point_c),
subtract_ristretto(&point_a, &add_ristretto(&point_b, &point_c).unwrap()),
);
// commutativity
assert_eq!(
add_ristretto(&point_a, &point_b).unwrap(),
add_ristretto(&point_b, &point_a).unwrap(),
);
// subtraction
let point = PodRistrettoPoint(G.compress().to_bytes());
let point_negated = PodRistrettoPoint((-G).compress().to_bytes());
assert_eq!(
point_negated,
subtract_ristretto(&identity, &point).unwrap(),
)
} | rust_cleaned_test_functions.jsonl/15618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1058
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5228,
2144,
1710,
380,
2122,
983,
368,
341,
286,
442,
9569,
198,
286,
1077,
9569,
284,
16821,
49,
380,
2122,
983,
2609,
2785,
380,
2122,
983,
2609,
486,
16912,
1005,
38360,
1005,
983,
1252... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_setter() {
let mut a = Ts {jaf: 4, field_1: 0, field_2: String::from("hello")};
a.set_field_1(14);
assert_eq!(a.field_1, 14);
} | rust_cleaned_test_functions.jsonl/24666 | {
"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,
2891,
2602,
465,
368,
341,
262,
1077,
5206,
264,
284,
25076,
314,
73,
2577,
25,
220,
19,
11,
2070,
62,
16,
25,
220,
15,
11,
2070,
62,
17,
25,
923,
486,
1499,
445,
14990,
899,
2440,
262,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug_impl() {
let secret_key = SecretKey::generate();
let initial_state = HmacSha256::new(&secret_key);
let debug = format!("{:?}", initial_state);
let expected = "HmacSha256 { _state: Hmac { working_hasher: [***OMITTED***], opad_hasher: [***OMITTED***], ipad_hasher: [***OMITTED***], is_finalized: false } }";
assert_eq!(debug, expected);
} | rust_cleaned_test_functions.jsonl/63000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
21007,
368,
341,
310,
1077,
6234,
3097,
284,
8599,
1592,
486,
19366,
543,
310,
1077,
2856,
4387,
284,
472,
11948,
62316,
17,
20,
21,
486,
931,
2099,
20474,
3097,
317,
310,
1077,
7390,
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_iltag_serialize() {
let mut writer = VecWriter::new();
let tag = DummyTag::new(15, 4);
assert!(tag.serialize(writer.as_writer()).is_ok());
assert_eq!(writer.as_slice(), &[0x0F, 0x00, 0x01, 0x02, 0x03]);
// Explicity tag
let mut writer = VecWriter::new();
let tag = DummyTag::new(16, 4);
assert!(tag.serialize(writer.as_writer()).is_ok());
assert_eq!(writer.as_slice(), &[0x10, 0x04, 0x00, 0x01, 0x02, 0x03]);
// Explicity tag - long
let mut writer = VecWriter::new();
let tag = DummyTag::new(255, 256);
assert!(tag.serialize(writer.as_writer()).is_ok());
let mut exp: Vec<u8> = Vec::new();
exp.extend_from_slice(&[248, 7, 248, 8]);
for i in 0..256 {
exp.push(i as u8);
}
assert_eq!(writer.as_slice(), exp);
} | rust_cleaned_test_functions.jsonl/25689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2963,
351,
88686,
368,
341,
262,
1077,
5206,
6916,
284,
11312,
6492,
486,
931,
1428,
262,
1077,
4772,
284,
50567,
5668,
486,
931,
7,
16,
20,
11,
220,
19,
317,
262,
2060,
10297,
4578,
33969... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_session2_domain() -> Result<(), Error> {
let mut exec = fasync::Executor::new().expect("executor needed");
let domain = Some("domain://test".to_string());
let (pubisher_requests, avrcp_requests, _stop_sender, relay_fut) =
setup_media_relay(domain.clone())?;
pin_mut!(relay_fut);
assert!(exec.run_until_stalled(&mut relay_fut).is_pending());
let (_player, _controller_requests) = finish_relay_setup(
&mut relay_fut,
&mut exec,
pubisher_requests,
avrcp_requests,
domain,
)?;
assert!(exec.run_until_stalled(&mut relay_fut).is_pending());
Ok(())
} | rust_cleaned_test_functions.jsonl/45978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12316,
17,
20111,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
17119,
445,
80787,
4362,
3071,
286,
1077,
7947,
284,
4329,
445,
12204,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nfc_chars() {
macro_rules! t {
($input: expr, $expected: expr) => {
assert_eq!($input.nfc_chars().collect::<String>(), $expected.into_string());
}
}
t!("abc", "abc");
t!("\u1e0b\u01c4", "\u1e0b\u01c4");
t!("\u2026", "\u2026");
t!("\u2126", "\u03a9");
t!("\u1e0b\u0323", "\u1e0d\u0307");
t!("\u1e0d\u0307", "\u1e0d\u0307");
t!("a\u0301", "\xe1");
t!("\u0301a", "\u0301a");
t!("\ud4db", "\ud4db");
t!("\uac1c", "\uac1c");
t!("a\u0300\u0305\u0315\u05aeb", "\xe0\u05ae\u0305\u0315b");
} | rust_cleaned_test_functions.jsonl/56857 | {
"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,
1089,
8316,
37418,
368,
341,
286,
18072,
21407,
0,
259,
341,
310,
1711,
1355,
25,
15169,
11,
400,
7325,
25,
15169,
8,
589,
341,
394,
2060,
10714,
0,
699,
1355,
1253,
8316,
37418,
1005,
17384,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_ip_address_config() {
let test_config = create_test_config_no_paths();
let ipconfig = IpAddress {
dhcp_client: Some(false),
cidr_address: Some(CidrAddress {
ip: NetIpAddr("127.0.0.1".parse().unwrap()),
prefix_length: 32,
}),
};
let mut properties: lifmgr::LIFProperties = lifmgr::LIFProperties::default();
test_config.set_ip_address_config(&mut properties, Some(&ipconfig));
// `enabled` field.
assert_eq!(properties.enabled, false);
assert_eq!(properties.dhcp, lifmgr::Dhcp::None);
assert_eq!(
properties.address_v4,
Some(LifIpAddr { address: "127.0.0.1".parse().unwrap(), prefix: 32 })
);
// Make sure DHCP client can be enabled when no static IP configuration is present.
let ipconfig = IpAddress { dhcp_client: Some(true), cidr_address: None };
let mut properties: lifmgr::LIFProperties =
lifmgr::LIFProperties { enabled: true, ..Default::default() };
test_config.set_ip_address_config(&mut properties, Some(&ipconfig));
assert_eq!(properties.enabled, true);
assert_eq!(properties.dhcp, lifmgr::Dhcp::Client);
assert_eq!(properties.address_v4, None);
// is turned off when both are set.
let ipconfig = IpAddress {
dhcp_client: Some(true),
cidr_address: Some(CidrAddress {
ip: NetIpAddr("127.0.0.1".parse().unwrap()),
prefix_length: 32,
}),
};
let mut properties: lifmgr::LIFProperties =
lifmgr::LIFProperties { enabled: true, ..Default::default() };
test_config.set_ip_address_config(&mut properties, Some(&ipconfig));
assert_eq!(properties.enabled, true);
assert_eq!(properties.dhcp, lifmgr::Dhcp::None);
assert_eq!(
properties.address_v4,
Some(LifIpAddr { address: "127.0.0.1".parse().unwrap(), prefix: 32 })
);
} | rust_cleaned_test_functions.jsonl/83816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1004
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
10385,
6744,
5332,
368,
341,
286,
1077,
1273,
5332,
284,
1855,
4452,
5332,
6536,
24152,
543,
286,
1077,
5997,
1676,
284,
35033,
4286,
341,
310,
85787,
8179,
25,
4329,
3576,
1326,
310,
32141,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_div() {
let vals = vec![
("2", "1", "2"),
("2e1", "1", "20"),
("1", "2", "0.5"),
("1", "2e-2", "5e1"),
("5", "4", "1.25"),
("5", "4", "125e-2"),
("100", "5", "20"),
("-50", "5", "-10"),
("200", "5", "40."),
("1", "3", ".3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"),
("12.34", "1.233", "10.008110300081103000811030008110300081103000811030008110300081103000811030008110300081103000811030008"),
];
for &(x, y, z) in vals.iter() {
let a = BigDecimal::from_str(x).unwrap();
let b = BigDecimal::from_str(y).unwrap();
let c = BigDecimal::from_str(z).unwrap();
let q = a / b;
assert_eq!(q, c)
}
} | rust_cleaned_test_functions.jsonl/75814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 517
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
368,
341,
286,
1077,
28356,
284,
7486,
90515,
310,
3489,
17,
497,
330,
16,
497,
330,
17,
4461,
310,
3489,
17,
68,
16,
497,
330,
16,
497,
330,
17,
15,
4461,
310,
3489,
16,
497,
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... | 2 |
#[test]
fn test_bytewise_carriage_return_is_not_word_boundary() {
new_ucmd!()
.args(&["-w6", "-s", "-b"])
.pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line
.succeeds()
.stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); // spell-checker:disable-line
} | rust_cleaned_test_functions.jsonl/74358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3710,
83,
24350,
26616,
8775,
12511,
6892,
7913,
13533,
54004,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
21,
497,
6523,
82,
497,
6523,
65,
14108,
286,
659,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multipart() {
run_on(|| {
let (sender, payload) = create_stream();
let (bytes, headers) = create_simple_request_with_header();
sender.unbounded_send(Ok(bytes)).unwrap();
let mut multipart = Multipart::new(&headers, payload);
match multipart.poll().unwrap() {
Async::Ready(Some(mut field)) => {
let cd = field.content_disposition().unwrap();
assert_eq!(cd.disposition, DispositionType::FormData);
assert_eq!(cd.parameters[0], DispositionParam::Name("file".into()));
assert_eq!(field.content_type().type_(), mime::TEXT);
assert_eq!(field.content_type().subtype(), mime::PLAIN);
match field.poll().unwrap() {
Async::Ready(Some(chunk)) => assert_eq!(chunk, "test"),
_ => unreachable!(),
}
match field.poll().unwrap() {
Async::Ready(None) => (),
_ => unreachable!(),
}
}
_ => unreachable!(),
}
match multipart.poll().unwrap() {
Async::Ready(Some(mut field)) => {
assert_eq!(field.content_type().type_(), mime::TEXT);
assert_eq!(field.content_type().subtype(), mime::PLAIN);
match field.poll() {
Ok(Async::Ready(Some(chunk))) => assert_eq!(chunk, "data"),
_ => unreachable!(),
}
match field.poll() {
Ok(Async::Ready(None)) => (),
_ => unreachable!(),
}
}
_ => unreachable!(),
}
match multipart.poll().unwrap() {
Async::Ready(None) => (),
_ => unreachable!(),
}
});
} | rust_cleaned_test_functions.jsonl/43763 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
18204,
368,
341,
286,
1598,
4470,
79453,
341,
310,
1077,
320,
11644,
11,
7729,
8,
284,
1855,
12673,
543,
310,
1077,
320,
9651,
11,
7102,
8,
284,
1855,
30015,
7893,
6615,
8757,
1428,
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... | 9 |
#[test]
fn test_subprocesses() {
#[cfg(target_os="macos")]
{
// We need root permissions here to run this on OSX
if unsafe { libc::geteuid() } != 0 {
return;
}
}
// We used to not be able to create a sampler object if one of the child processes
// was in a zombie state. Verify that this works now
let process = ScriptRunner::new("./tests/scripts/subprocesses.py");
std::thread::sleep(std::time::Duration::from_millis(400));
let config = Config{subprocesses: true, ..Default::default()};
let sampler = py_spy::sampler::Sampler::new(process.id(), &config).unwrap();
std::thread::sleep(std::time::Duration::from_millis(1000));
for sample in sampler {
let traces = sample.traces;
assert_eq!(traces.len(), 3);
assert!(traces[0].pid != traces[1].pid);
assert!(traces[1].pid != traces[2].pid);
break;
}
} | rust_cleaned_test_functions.jsonl/11295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
4630,
288,
368,
341,
262,
11506,
14072,
8637,
29387,
428,
11948,
436,
5422,
262,
341,
286,
442,
1205,
1184,
3704,
8541,
1588,
311,
1598,
419,
389,
87746,
198,
286,
421,
19860,
314,
42142,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_include_subdomains() {
let r: Raw = "max-age=15768000 ; includeSubDomains".into();
let h = Header::parse_header(&r);
assert_eq!(h.ok(), Some(StrictTransportSecurity { include_subdomains: true, max_age: 15768000u64 }));
} | rust_cleaned_test_functions.jsonl/58564 | {
"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,
21039,
37878,
5228,
59621,
368,
341,
286,
1077,
435,
25,
23022,
284,
330,
2810,
42941,
28,
16,
20,
22,
21,
23,
15,
15,
15,
2587,
2924,
3136,
74713,
3263,
18122,
543,
286,
1077,
305,
284,
12104... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unbound_parameters_are_reused() {
let db = Connection::open_in_memory().unwrap();
let sql = "CREATE TABLE test (x TEXT, y TEXT)";
db.execute_batch(sql).unwrap();
let mut stmt = db
.prepare("INSERT INTO test (x, y) VALUES (:x, :y)")
.unwrap();
stmt.execute_named(&[(":x", &"one")]).unwrap();
stmt.execute_named(&[(":y", &"two")]).unwrap();
let result: String = db
.query_row("SELECT x FROM test WHERE y = 'two'", NO_PARAMS, |row| {
row.get(0)
})
.unwrap();
assert_eq!(result, "one");
} | rust_cleaned_test_functions.jsonl/57178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
10891,
18263,
56855,
1288,
2591,
368,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
1005,
15454,
543,
286,
1077,
5704,
284,
330,
22599,
14363,
1273,
320,
87,
15762,
11,
379,
1576... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_coinbase_and_bip34() {
let block_hex = "0200000035ab154183570282ce9afc0b494c9fc6a3cfea05aa8c1add2ecc56490000000038ba3d78e4500a5a7570dbe61960398add4410d278b21cd9708e6d9743f374d544fc055227f1001c29c1ea3b0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff3703a08601000427f1001c046a510100522cfabe6d6d0000000000000000000068692066726f6d20706f6f6c7365727665726aac1eeeed88ffffffff0100f2052a010000001976a914912e2b234f941f30b18afbb4fa46171214bf66c888ac00000000";
let block: Block = deserialize(&Vec::<u8>::from_hex(block_hex).unwrap()).unwrap();
let cb_txid = "d574f343976d8e70d91cb278d21044dd8a396019e6db70755a0a50e4783dba38";
assert_eq!(block.coinbase().unwrap().txid().to_string(), cb_txid);
assert_eq!(block.bip34_block_height(), Ok(100_000));
// block with 9-byte bip34 push
let bad_hex = "0200000035ab154183570282ce9afc0b494c9fc6a3cfea05aa8c1add2ecc56490000000038ba3d78e4500a5a7570dbe61960398add4410d278b21cd9708e6d9743f374d544fc055227f1001c29c1ea3b0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff3d09a08601112233445566000427f1001c046a510100522cfabe6d6d0000000000000000000068692066726f6d20706f6f6c7365727665726aac1eeeed88ffffffff0100f2052a010000001976a914912e2b234f941f30b18afbb4fa46171214bf66c888ac00000000";
let bad: Block = deserialize(&Vec::<u8>::from_hex(bad_hex).unwrap()).unwrap();
let push = Vec::<u8>::from_hex("a08601112233445566").unwrap();
assert_eq!(bad.bip34_block_height(), Err(super::Bip34Error::UnexpectedPush(push)));
} | rust_cleaned_test_functions.jsonl/116650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75718,
3152,
8378,
880,
573,
18,
19,
368,
341,
1789,
286,
1077,
2504,
32655,
284,
330,
15,
17,
15,
15,
15,
15,
15,
15,
18,
20,
370,
16,
20,
19,
16,
23,
18,
20,
22,
15,
17,
23,
17,
346,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hour_24_clock_under_12() {
let context = build_context(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 10, 11)));
let constraint = Hour::clock_24(11);
let walker = constraint.unwrap().to_walker(&context.reference, &context);
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 25).and_hms(11, 0, 0)),
Grain::Hour)),
walker.forward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 26).and_hms(11, 0, 0)),
Grain::Hour)),
walker.forward.clone().skip(1).next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 24).and_hms(11, 0, 0)),
Grain::Hour)),
walker.backward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 23).and_hms(11, 0, 0)),
Grain::Hour)),
walker.backward.clone().skip(1).next());
} | rust_cleaned_test_functions.jsonl/114668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 628
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32292,
62,
17,
19,
23062,
58228,
62,
16,
17,
368,
341,
286,
1077,
2266,
284,
1936,
8467,
3189,
12913,
7,
59604,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
568,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_truncated_client_extension_is_detected() {
let chp = get_sample_clienthellopayload();
for ext in &chp.extensions {
let mut enc = ext.get_encoding();
println!("testing {:?} enc {:?}", ext, enc);
// the input
for l in 0..enc.len() {
assert!(ClientExtension::read_bytes(&enc[..l]).is_none());
}
// these extension types don't have any internal encoding that rustls validates:
match ext.get_type() {
ExtensionType::TransportParameters | ExtensionType::Unknown(_) => {
continue;
}
_ => {}
};
for l in 0..(enc.len() - 4) {
put_u16(l as u16, &mut enc[2..]);
println!(" encoding {:?} len {:?}", enc, l);
assert!(ClientExtension::read_bytes(&enc).is_none());
}
}
} | rust_cleaned_test_functions.jsonl/100972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
38007,
8179,
31035,
6892,
98876,
368,
341,
262,
1077,
521,
79,
284,
633,
17491,
8179,
14990,
19427,
1428,
262,
369,
1303,
304,
609,
331,
79,
48439,
341,
286,
1077,
5206,
3209,
284,
1303,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_try_from_message() {
let legacy_message_with_no_signers = LegacyMessage {
account_keys: vec![Pubkey::new_unique()],
..LegacyMessage::default()
};
assert_eq!(
SanitizedMessage::try_from(legacy_message_with_no_signers).err(),
Some(SanitizeMessageError::IndexOutOfBounds),
);
} | rust_cleaned_test_functions.jsonl/119821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
6462,
368,
341,
286,
1077,
19588,
6462,
6615,
6536,
11172,
388,
284,
37887,
2052,
341,
310,
2692,
12631,
25,
7486,
20703,
29162,
792,
486,
931,
21218,
73845,
310,
5241,
77415,
2052,
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_stft_pad_truncate_basic_2() {
_test_stft(10, 7, Some(2), None, None, PadMode::Truncate).unwrap();
} | rust_cleaned_test_functions.jsonl/104783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 62
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
723,
30290,
3547,
26900,
34729,
62,
17,
368,
341,
262,
716,
1944,
1261,
723,
7,
16,
15,
11,
220,
22,
11,
4329,
7,
17,
701,
2240,
11,
2240,
11,
25299,
3636,
486,
1282,
26900,
568,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_updates() -> Result<(), Box<dyn Error>> {
setup();
let client = JsonClient::new();
let updates = client.updates()?;
log::debug!("updates = {:?}", updates);
Ok(())
} | rust_cleaned_test_functions.jsonl/106543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57829,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
6505,
1428,
286,
1077,
2943,
284,
8308,
2959,
486,
931,
543,
286,
1077,
8837,
284,
2943,
17652,
6394,
94136,
286,
1487,
486,
8349,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_parse_str() {
let inputs = vec![
String::from("\"hello\""),
String::from("\"a\""),
String::from("\"\\\\\""),
];
let expected_tokens = inputs
.iter()
.map(|s| Token::new(TokenKind::STRING, s, 0, s.len()))
.collect::<Vec<Token>>();
for (i, _) in inputs.iter().enumerate() {
let expected_ast = StringLiteral::new(expected_tokens[i].clone());
let result = lexer::lex(&inputs[i]);
let ast = parse_str_exp(&mut result.into_iter().peekable()).unwrap();
assert_eq!(ast, Str(expected_ast));
}
} | rust_cleaned_test_functions.jsonl/83956 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
2895,
368,
341,
286,
1077,
11127,
284,
7486,
90515,
310,
923,
486,
1499,
38915,
14990,
2105,
4461,
310,
923,
486,
1499,
38915,
64,
2105,
4461,
310,
923,
486,
1499,
38915,
51007,
2105,
4461,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cast_enum_as_time() {
test_none_with_ctx_and_extra(cast_enum_as_time);
let mut ctx = EvalContext::default();
let cs = vec![
(
EnumRef::new("20190916101112".as_bytes(), &1),
Time::parse(
&mut ctx,
"2019-09-16 10:11:12",
TimeType::DateTime,
0,
false,
)
.unwrap(),
0,
),
(
EnumRef::new("190916101112.111".as_bytes(), &2),
Time::parse(
&mut ctx,
"2019-09-16 10:11:12.111",
TimeType::DateTime,
3,
false,
)
.unwrap(),
3,
),
(
EnumRef::new("20190916101112.111".as_bytes(), &3),
Time::parse(
&mut ctx,
"2019-09-16 10:11:12.111",
TimeType::DateTime,
3,
false,
)
.unwrap(),
3,
),
(
EnumRef::new("2019-12-31 23:59:59.99".as_bytes(), &3),
Time::parse(
&mut ctx,
"2020-01-01 00:00:00.0",
TimeType::DateTime,
1,
false,
)
.unwrap(),
1,
),
];
for (input, expect, fsp) in cs {
let rft = FieldTypeConfig {
decimal: fsp as isize,
..FieldTypeConfig::default()
}
.into();
let extra = make_extra(&rft);
let r = cast_enum_as_time(&mut ctx, &extra, Some(input));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
let cs = vec![
EnumRef::new("2019-12-31 23:59:59.99".as_bytes(), &0),
EnumRef::new("abcdefg".as_bytes(), &0),
EnumRef::new("20199999-12-31 23:59:59.99".as_bytes(), &0),
];
for input in cs {
let rft = FieldTypeConfig::default().into();
let extra = make_extra(&rft);
let r = cast_enum_as_time(&mut ctx, &extra, Some(input));
assert_eq!(r.unwrap().is_none(), true)
}
} | rust_cleaned_test_functions.jsonl/103221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1677
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
31054,
11898,
3009,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
31054,
11898,
3009,
317,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
543,
286,
1077,
10532,
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... | 3 |
#[test]
fn test_query_and_then_custom_error_fails() -> Result<()> {
let db = checked_memory_handle();
let sql = "BEGIN;
CREATE TABLE foo(x INTEGER, y TEXT);
INSERT INTO foo VALUES(4, 'hello');
INSERT INTO foo VALUES(3, ', ');
INSERT INTO foo VALUES(2, 'world');
INSERT INTO foo VALUES(1, '!');
END;";
db.execute_batch(sql)?;
let mut query = db.prepare("SELECT x, y FROM foo ORDER BY x DESC")?;
let bad_type: CustomResult<Vec<f64>> = query
.query_and_then([], |row| row.get(1).map_err(CustomError::Sqlite))?
.collect();
match bad_type.unwrap_err() {
CustomError::Sqlite(Error::InvalidColumnType(..)) => (),
err => panic!("Unexpected error {}", err),
}
let bad_idx: CustomResult<Vec<String>> = query
.query_and_then([], |row| row.get(3).map_err(CustomError::Sqlite))?
.collect();
match bad_idx.unwrap_err() {
CustomError::Sqlite(Error::InvalidColumnIndex(_)) => (),
err => panic!("Unexpected error {}", err),
}
let non_sqlite_err: CustomResult<Vec<String>> =
query.query_and_then([], |_| Err(CustomError::SomeError))?.collect();
match non_sqlite_err.unwrap_err() {
CustomError::SomeError => (),
err => panic!("Unexpected error {}", err),
}
Ok(())
} | rust_cleaned_test_functions.jsonl/113071 | {
"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,
5738,
8378,
68367,
15875,
4096,
761,
6209,
368,
1464,
5714,
71698,
341,
310,
1077,
2927,
284,
10067,
19195,
10630,
543,
310,
1077,
5704,
284,
330,
37588,
280,
5180,
30776,
14363,
15229,
2075,
30381,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_keywords() {
let source = "and
class
else
for
fun
if
or
print
return
super
this
var
while"
.to_owned();
let scanner = Scanner::new();
assert_eq!(
Ok(vec![
Token {
t: TokenType::And,
line: 1,
lexeme: "and".to_owned(),
literal: Some(Literal::Identifier("and".to_owned())),
},
Token {
t: TokenType::Class,
line: 2,
lexeme: "class".to_owned(),
literal: Some(Literal::Identifier("class".to_owned())),
},
Token {
t: TokenType::Else,
line: 3,
lexeme: "else".to_owned(),
literal: Some(Literal::Identifier("else".to_owned())),
},
Token {
t: TokenType::For,
line: 4,
lexeme: "for".to_owned(),
literal: Some(Literal::Identifier("for".to_owned())),
},
Token {
t: TokenType::Fun,
line: 5,
lexeme: "fun".to_owned(),
literal: Some(Literal::Identifier("fun".to_owned())),
},
Token {
t: TokenType::If,
line: 6,
lexeme: "if".to_owned(),
literal: Some(Literal::Identifier("if".to_owned())),
},
Token {
t: TokenType::Or,
line: 7,
lexeme: "or".to_owned(),
literal: Some(Literal::Identifier("or".to_owned())),
},
Token {
t: TokenType::Print,
line: 8,
lexeme: "print".to_owned(),
literal: Some(Literal::Identifier("print".to_owned())),
},
Token {
t: TokenType::Return,
line: 9,
lexeme: "return".to_owned(),
literal: Some(Literal::Identifier("return".to_owned())),
},
Token {
t: TokenType::Super,
line: 10,
lexeme: "super".to_owned(),
literal: Some(Literal::Identifier("super".to_owned())),
},
Token {
t: TokenType::This,
line: 11,
lexeme: "this".to_owned(),
literal: Some(Literal::Identifier("this".to_owned())),
},
Token {
t: TokenType::Var,
line: 12,
lexeme: "var".to_owned(),
literal: Some(Literal::Identifier("var".to_owned())),
},
Token {
t: TokenType::While,
line: 13,
lexeme: "while".to_owned(),
literal: Some(Literal::Identifier("while".to_owned())),
},
Token {
t: TokenType::Eof,
line: 13,
lexeme: String::new(),
literal: None,
},
]),
scanner.scan_tokens(source)
);
} | rust_cleaned_test_functions.jsonl/92094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
368,
341,
286,
1077,
2530,
284,
330,
437,
198,
286,
536,
198,
286,
770,
198,
286,
369,
198,
286,
2464,
198,
286,
421,
198,
286,
476,
198,
286,
1173,
198,
286,
470,
198,
286,
2256,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_tags_and_categories() -> Result<()> {
let temp_dir = tempdir::TempDir::new(&format!(
"temp_rand_index_{}",
uuid::Uuid::new_v4().to_string()
))?;
let (posts, index) = build_random_posts_index(10, temp_dir.path())?;
let (mut tags, mut categories) = get_tags_and_categories(&index)?;
let mut rand_tags = BTreeSet::new();
let mut rand_categories = BTreeSet::new();
for post in posts.iter() {
rand_categories.insert(post.category());
if let Some(tags) = post.tags() {
for tag in tags.iter() {
rand_tags.insert(tag.to_owned());
}
}
}
let mut rand_tags: Vec<String> = rand_tags.into_iter().collect();
let mut rand_categories: Vec<String> = rand_categories.into_iter().collect();
tags.sort_unstable();
categories.sort_unstable();
rand_tags.sort_unstable();
rand_categories.sort_unstable();
assert_eq!(tags, rand_tags);
assert_eq!(categories, rand_categories);
Ok(())
} | rust_cleaned_test_functions.jsonl/67718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
16333,
8378,
27542,
368,
1464,
5714,
71698,
341,
286,
1077,
2730,
4334,
284,
2730,
3741,
486,
12151,
6184,
486,
931,
2099,
2243,
33673,
310,
330,
3888,
33864,
3560,
62,
6257,
756,
310,
16040... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_convert_timestamp_to_string() {
fn check_datetime_conversion(y: u32, m: u32, d: u32, h: u32, mi: u32, s: u32) {
let datetime = chrono::NaiveDate::from_ymd(y as i32, m, d).and_hms(h, mi, s);
let dt = Local.from_utc_datetime(&datetime);
let res = convert_timestamp_to_string(dt.timestamp_millis() as u64);
let exp = format!("{}", dt.format("%Y-%m-%d %H:%M:%S %:z"));
assert_eq!(res, exp);
}
check_datetime_conversion(2010, 01, 02, 13, 12, 54);
check_datetime_conversion(2011, 01, 03, 08, 23, 01);
check_datetime_conversion(2012, 04, 05, 11, 06, 32);
check_datetime_conversion(2013, 05, 12, 16, 38, 00);
check_datetime_conversion(2014, 11, 28, 21, 15, 12);
} | rust_cleaned_test_functions.jsonl/43803 | {
"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,
34910,
23073,
2346,
3904,
368,
341,
262,
5168,
1779,
28943,
64132,
7021,
25,
575,
18,
17,
11,
296,
25,
575,
18,
17,
11,
294,
25,
575,
18,
17,
11,
305,
25,
575,
18,
17,
11,
9497,
25,
575,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_waypoint_li_verification() {
let empty_li = LedgerInfo::new(BlockInfo::empty(), HashValue::zero());
assert!(Waypoint::new(&empty_li).is_err()); // no validator set in empty LI
let li = LedgerInfo::new(
BlockInfo::new(
1,
10,
HashValue::random(),
HashValue::random(),
123,
1000,
Some(ValidatorSet::new(vec![])),
),
HashValue::zero(),
);
let waypoint = Waypoint::new(&li).unwrap();
assert!(waypoint.verify(&li).is_ok());
} | rust_cleaned_test_functions.jsonl/17488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48936,
2768,
50450,
84245,
368,
341,
286,
1077,
4287,
50450,
284,
70306,
1731,
486,
931,
55243,
1731,
486,
3194,
1507,
6531,
1130,
486,
14154,
1423,
286,
2060,
10297,
35054,
2768,
486,
931,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_openwall_test_vectors() {
let tests = openwall_test_vectors();
let mut output = [0u8; 24];
for test in tests.iter() {
bcrypt(test.cost, &test.salt[..], &test.input[..], &mut output[..]);
assert!(output[0..23] == test.output[..]);
}
} | rust_cleaned_test_functions.jsonl/99227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
16431,
4452,
49158,
368,
341,
286,
1077,
7032,
284,
1787,
16431,
4452,
49158,
543,
286,
1077,
5206,
2550,
284,
508,
15,
84,
23,
26,
220,
17,
19,
935,
286,
369,
1273,
304,
7032,
19471,
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... | 2 |
#[test]
fn test_scalar_add() {
fn check(x: &BigUint, y: &BigUint, z: &BigUint) {
let (x, y, z) = (x.clone(), y.clone(), z.clone());
assert_unsigned_scalar_op!(x + y == z);
}
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);
check(&a, &b, &c);
check(&b, &a, &c);
}
} | rust_cleaned_test_functions.jsonl/114162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
2891,
368,
341,
262,
5168,
1779,
2075,
25,
609,
15636,
21570,
11,
379,
25,
609,
15636,
21570,
11,
1147,
25,
609,
15636,
21570,
8,
341,
286,
1077,
320,
87,
11,
379,
11,
1147,
8,
284,
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_normal_transfer() {
let mut status = MigrationStatus::None;
// None to Setup.
assert!(status.transfer(MigrationStatus::Setup).is_ok());
status = status.transfer(MigrationStatus::Setup).unwrap();
// Setup to Active.
assert!(status.transfer(MigrationStatus::Active).is_ok());
status = status.transfer(MigrationStatus::Active).unwrap();
// Active to Completed.
assert!(status.transfer(MigrationStatus::Completed).is_ok());
status = status.transfer(MigrationStatus::Completed).unwrap();
// Completed to Active.
assert!(status.transfer(MigrationStatus::Active).is_ok());
status = status.transfer(MigrationStatus::Active).unwrap();
// Any to Failed.
assert!(status.transfer(MigrationStatus::Failed).is_ok());
status = status.transfer(MigrationStatus::Failed).unwrap();
// Failed to Active.
assert!(status.transfer(MigrationStatus::Active).is_ok());
status = status.transfer(MigrationStatus::Active).unwrap();
// Any to Failed.
assert!(status.transfer(MigrationStatus::Failed).is_ok());
status = status.transfer(MigrationStatus::Failed).unwrap();
// Failed to Setup.
assert!(status.transfer(MigrationStatus::Setup).is_ok());
status = status.transfer(MigrationStatus::Setup).unwrap();
assert_eq!(status, MigrationStatus::Setup);
} | rust_cleaned_test_functions.jsonl/88595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13973,
35403,
368,
341,
286,
1077,
5206,
2639,
284,
21248,
2522,
486,
4064,
401,
286,
442,
2240,
311,
18626,
624,
286,
2060,
10297,
2829,
49428,
3189,
5033,
2522,
486,
21821,
568,
285,
19817,
1423... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_welcome_commit_process() {
let (creator_kp, creator_secret) = get_fake_keypackage();
let (to_be_added, to_be_added_secret) = get_fake_keypackage();
let (mut creator_group, adds, commit, welcome) = GroupAux::init_group(
creator_kp,
creator_secret,
&[to_be_added.clone()],
&MockVerifier {},
0,
)
.expect("group init");
let added_group = GroupAux::init_group_from_welcome(
to_be_added,
to_be_added_secret,
welcome,
&MockVerifier {},
0,
)
.expect("group init from welcome");
creator_group
.process_commit(commit, &adds, &MockVerifier {}, 0)
.expect("commit ok");
// they should get to the same context
assert_eq!(&added_group.context, &creator_group.context);
} | rust_cleaned_test_functions.jsonl/25583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
5717,
36346,
11305,
368,
341,
286,
1077,
320,
32398,
4698,
79,
11,
19919,
21962,
8,
284,
633,
56881,
3097,
1722,
543,
286,
1077,
320,
983,
21263,
37653,
11,
311,
21263,
37653,
21962,
8,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detect_static_or_dynamic_property() {
use azul_css::{CssProperty, StyleTextAlignmentHorz};
use css_parser::InvalidValueErr;
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, " center "),
Ok(CssDeclaration::Static(CssProperty::TextAlign(StyleTextAlignmentHorz::Center)))
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ 400px ]]"),
Err(DynamicCssParseError::NoDefaultCase)
);
assert_eq!(determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ 400px"),
Err(DynamicCssParseError::UnclosedBraces)
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ 400px | center ]]"),
Err(DynamicCssParseError::InvalidId)
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ hello | center ]]"),
Ok(CssDeclaration::Dynamic(DynamicCssProperty {
property_type: CssPropertyType::TextAlign,
default: DynamicCssPropertyDefault::Exact(CssProperty::TextAlign(StyleTextAlignmentHorz::Center)),
dynamic_id: String::from("hello"),
}))
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ hello | auto ]]"),
Ok(CssDeclaration::Dynamic(DynamicCssProperty {
property_type: CssPropertyType::TextAlign,
default: DynamicCssPropertyDefault::Auto,
dynamic_id: String::from("hello"),
}))
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ abc | hello ]]"),
Err(DynamicCssParseError::UnexpectedValue(
CssParsingError::InvalidValueErr(InvalidValueErr("hello"))
))
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ ]]"),
Err(DynamicCssParseError::EmptyBraces)
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[]]"),
Err(DynamicCssParseError::EmptyBraces)
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ center ]]"),
Err(DynamicCssParseError::NoId)
);
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ hello | ]]"),
Err(DynamicCssParseError::NoDefaultCase)
);
// debatable if this is a suitable error for this case:
assert_eq!(
determine_static_or_dynamic_css_property(CssPropertyType::TextAlign, "[[ | ]]"),
Err(DynamicCssParseError::EmptyBraces)
);
} | rust_cleaned_test_functions.jsonl/79849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56457,
25360,
8734,
45992,
16638,
368,
972,
262,
990,
12376,
360,
25924,
22964,
40275,
3052,
11,
11913,
1178,
7033,
39601,
89,
15414,
262,
990,
15877,
18517,
486,
7928,
1130,
7747,
463,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_deserialisation_raises_error_if_hash_changed() {
let nonce = vec![1,2,3,4,5];
let salt = _get_test_salt();
let header = Header::new(1, "TEST_ENCRYPTION_METHOD", &nonce, salt);
let mut serialised_header = header.serialise().unwrap();
let index = serialised_header.len() - 5;
let mut byte_value = serialised_header[index];
if byte_value == 255 {
byte_value = 0;
} else {
byte_value += 1;
}
serialised_header[index] = byte_value;
let res = Header::deserialise(&serialised_header);
assert_match!(Err(WalletError::CommonError(_)), res);
} | rust_cleaned_test_functions.jsonl/106125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
15768,
2848,
7923,
88840,
4096,
11119,
8950,
25213,
368,
341,
286,
1077,
39676,
284,
7486,
20703,
16,
11,
17,
11,
18,
11,
19,
11,
20,
935,
286,
1077,
12021,
284,
716,
455,
4452,
92280,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_receiving_router_solicitation_validity_check() {
let config = get_dummy_config::<Ipv6Addr>();
let src_ip = Ipv6Addr::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 10]);
let src_mac = [10, 11, 12, 13, 14, 15];
let options = vec![NdpOption::SourceLinkLayerAddress(&src_mac[..])];
let mut ctx = DummyEventDispatcherBuilder::from_config(config.clone())
.build::<DummyEventDispatcher>();
let device = Some(DeviceId::new_ethernet(0));
let mut icmpv6_packet_buf = OptionsSerializer::new(options.iter())
.into_serializer()
.encapsulate(IcmpPacketBuilder::<Ipv6, &[u8], _>::new(
src_ip,
config.local_ip,
IcmpUnusedCode,
RouterSolicitation::default(),
))
.serialize_vec_outer()
.unwrap();
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
receive_ndp_packet(&mut ctx, device, src_ip, config.local_ip, icmpv6_packet);
assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_solicitation"), 0);
let mut state_builder = StackStateBuilder::default();
state_builder.ip_builder().forward(true);
let mut ctx = DummyEventDispatcherBuilder::from_config(config.clone())
.build_with(state_builder, DummyEventDispatcher::default());
icmpv6_packet_buf.reset();
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
receive_ndp_packet(&mut ctx, device, src_ip, config.local_ip, icmpv6_packet);
assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_solicitation"), 1);
let unspecified_source = Ipv6Addr::default();
let mut icmpv6_packet_buf = OptionsSerializer::new(options.iter())
.into_serializer()
.encapsulate(IcmpPacketBuilder::<Ipv6, &[u8], _>::new(
unspecified_source,
config.local_ip,
IcmpUnusedCode,
RouterSolicitation::default(),
))
.serialize_vec_outer()
.unwrap();
println!("{:?}", icmpv6_packet_buf);
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(
unspecified_source,
config.local_ip,
))
.unwrap();
receive_ndp_packet(&mut ctx, device, unspecified_source, config.local_ip, icmpv6_packet);
assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_solicitation"), 1);
} | rust_cleaned_test_functions.jsonl/16141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
46344,
55587,
643,
7762,
7556,
8337,
487,
7200,
368,
341,
286,
1077,
2193,
284,
633,
60321,
5332,
27638,
80656,
21,
13986,
3913,
286,
1077,
2286,
10385,
284,
358,
30168,
21,
13986,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_u32() {
fn get_written(num: u32) -> Vec<u8> {
let mut buf = io::Cursor::new(Vec::new());
buf.write_u32(num).unwrap();
buf.into_inner()
}
assert_eq!(get_written(0x0), vec![0, 0, 0, 0]);
assert_eq!(get_written(0x1), vec![0, 0, 0, 1]);
assert_eq!(get_written(0x10), vec![0, 0, 0, 0x10]);
assert_eq!(get_written(0x10AB00CC), vec![0x10, 0xAB, 0, 0xCC]);
assert_eq!(get_written(0xFFFFFFFF), vec![0xFF, 0xFF, 0xFF, 0xFF]);
assert_eq!(get_written(0xEFFFFFFF), vec![0xEF, 0xFF, 0xFF, 0xFF]);
assert_eq!(get_written(0x7FFFFFFF), vec![0x7F, 0xFF, 0xFF, 0xFF]);
assert_eq!(get_written(0xFFFFFF7F), vec![0xFF, 0xFF, 0xFF, 0x7F]);
} | rust_cleaned_test_functions.jsonl/76521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
7300,
18,
17,
368,
341,
286,
5168,
633,
72403,
8068,
25,
575,
18,
17,
8,
1464,
11312,
34837,
23,
29,
341,
310,
1077,
5206,
6607,
284,
6399,
486,
14543,
486,
931,
49923,
486,
931,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_out_chain_6() {
let config1 = r#"
{
"inbounds": [
{
"protocol": "socks",
"address": "127.0.0.1",
"port": 1086
}
],
"outbounds": [
{
"protocol": "chain",
"tag": "chain",
"settings": {
"actors": [
"server1-ws",
"server1-trojan",
"server2"
]
}
},
{
"protocol": "ws",
"tag": "server1-ws",
"settings": {
"path": "/leaf"
}
},
{
"protocol": "trojan",
"tag": "server1-trojan",
"settings": {
"address": "127.0.0.1",
"port": 3001,
"password": "password"
}
},
{
"protocol": "shadowsocks",
"tag": "server2",
"settings": {
"address": "127.0.0.1",
"port": 3002,
"method": "aes-128-gcm",
"password": "password"
}
}
]
}
"#;
let config2 = r#"
{
"inbounds": [
{
"protocol": "chain",
"tag": "server1",
"address": "127.0.0.1",
"port": 3001,
"settings": {
"actors": [
"ws",
"trojan"
]
}
},
{
"protocol": "ws",
"tag": "ws",
"settings": {
"path": "/leaf"
}
},
{
"protocol": "trojan",
"tag": "trojan",
"settings": {
"password": "password"
}
}
],
"outbounds": [
{
"protocol": "direct"
}
]
}
"#;
let config3 = r#"
{
"inbounds": [
{
"protocol": "shadowsocks",
"address": "127.0.0.1",
"port": 3002,
"settings": {
"method": "aes-128-gcm",
"password": "password"
}
}
],
"outbounds": [
{
"protocol": "direct"
}
]
}
"#;
let configs = vec![
config1.to_string(),
config2.to_string(),
config3.to_string(),
];
common::test_configs(configs, "127.0.0.1", 1086);
} | rust_cleaned_test_functions.jsonl/95208 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2056
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6068,
30583,
62,
21,
368,
341,
262,
1077,
2193,
16,
284,
435,
2,
698,
262,
341,
286,
330,
258,
34019,
788,
2278,
310,
341,
394,
330,
17014,
788,
330,
13199,
82,
756,
394,
330,
4995,
788,
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_uint256() {
assert_eq!(BIGGEST_UINT.bits(), 256);
assert!(
BIGGEST_UINT.checked_add(&Uint256::from(1u32)).is_none(),
"should return None adding 1 to biggest"
);
assert!(
BIGGEST_UINT.checked_add(&Uint256::from(0u32)).is_some(),
"should return Some adding 0 to biggest"
);
assert!(
&Uint256::from(1u32)
.checked_sub(&Uint256::from(2u32))
.is_none(),
"should return None if RHS is larger than LHS"
);
assert!(
&Uint256::from(1u32)
.checked_sub(&Uint256::from(1u32))
.is_some(),
"should return Some if RHS is not larger than LHS"
);
let num = &Uint256::from(1u32)
.checked_sub(&Uint256::from(1u32))
.unwrap()
.to_u32()
.unwrap();
assert_eq!(*num, 0, "1 - 1 should = 0");
let num2 = &Uint256::from(346u32)
.checked_sub(&Uint256::from(23u32))
.unwrap()
.to_u32()
.unwrap();
assert_eq!(*num2, 323, "346 - 23 should = 323");
} | rust_cleaned_test_functions.jsonl/118527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
17,
20,
21,
368,
341,
262,
2060,
10714,
10297,
67017,
81757,
27241,
38440,
1507,
220,
17,
20,
21,
317,
262,
2060,
33673,
286,
36854,
81757,
27241,
29101,
2891,
2099,
21570,
17,
20,
21,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_implied_am() {
let mut cpu = setup(0x0000, false, 0x08, None);
cpu.regset_mut().set_accumulator(0x1A);
let result = implied_am(&mut cpu);
assert_eq!(result.ok(), Some(ValueOnly(0x1A)));
assert_eq!(cpu.pc(), 0x0000);
} | rust_cleaned_test_functions.jsonl/26572 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17895,
3440,
22880,
368,
341,
286,
1077,
5206,
17319,
284,
6505,
7,
15,
87,
15,
15,
15,
15,
11,
895,
11,
220,
15,
87,
15,
23,
11,
2240,
317,
286,
17319,
7031,
746,
29523,
1005,
746,
75837,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fifo_line_writer() {
let log_file_temp =
TempFile::new().expect("Failed to create temporary output logging file.");
let good_file = log_file_temp.as_path().to_path_buf();
let maybe_fifo = open_file_nonblock(&good_file);
assert!(maybe_fifo.is_ok());
let mut fw = FcLineWriter::new(maybe_fifo.unwrap());
let msg = String::from("some message");
assert!(fw.write(&msg.as_bytes()).is_ok());
assert!(fw.flush().is_ok());
} | rust_cleaned_test_functions.jsonl/4582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56590,
6528,
28908,
368,
341,
286,
1077,
1487,
2458,
11771,
4035,
310,
19944,
1703,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
13340,
2550,
8392,
1034,
7320,
286,
1077,
1661,
2458,
284,
1487,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.