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_eval_binary_function_scalar_scalar() {
#[rpn_fn(nullable)]
fn foo(v1: Option<&Real>, v2: Option<&i64>) -> Result<Option<Real>> {
Ok(Some(*v1.unwrap() + *v2.unwrap() as f64 - 1.0))
}
let exp = RpnExpressionBuilder::new_for_test()
.push_constant_for_test(1.5f64)
.push_constant_for_test(3i64)
.push_fn_call_for_test(foo_fn_meta(), 2, FieldTypeTp::Double)
.build_for_test();
let mut ctx = EvalContext::default();
let mut columns = LazyBatchColumnVec::empty();
let result = exp.eval(&mut ctx, &[], &mut columns, &[], 3);
let val = result.unwrap();
assert!(val.is_vector());
assert_eq!(
val.vector_value().unwrap().as_ref().to_real_vec(),
[
Real::new(3.5).ok(),
Real::new(3.5).ok(),
Real::new(3.5).ok()
]
);
assert_eq!(val.vector_value().unwrap().logical_rows(), &[0, 1, 2]);
assert_eq!(val.field_type().as_accessor().tp(), FieldTypeTp::Double);
} | rust_cleaned_test_functions.jsonl/92665 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 606
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
31761,
9174,
41652,
41652,
368,
341,
394,
11506,
81,
19958,
15246,
34885,
5563,
286,
5168,
15229,
3747,
16,
25,
6959,
52244,
12768,
8066,
348,
17,
25,
6959,
52244,
72,
21,
19,
9231,
1464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_return_statement() {
let n = ReturnStmt {
base: BaseNode::default(),
argument: Expression::StringLit(StringLit {
base: BaseNode::default(),
value: "hello".to_string(),
}),
};
let serialized = serde_json::to_string(&n).unwrap();
assert_eq!(
serialized,
r#"{"type":"ReturnStatement","argument":{"type":"StringLiteral","value":"hello"}}"#
);
let deserialized: ReturnStmt = serde_json::from_str(serialized.as_str()).unwrap();
assert_eq!(deserialized, n)
} | rust_cleaned_test_functions.jsonl/40419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
12511,
37404,
368,
341,
262,
1077,
308,
284,
3411,
31063,
341,
286,
2331,
25,
5351,
1955,
486,
2258,
3148,
286,
5693,
25,
16378,
486,
703,
68954,
2242,
68954,
341,
310,
2331,
25,
5351,
195... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_channel_reserve() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 95000000, InitFeatures::known(), InitFeatures::known());
let logger = test_utils::TestLogger::new();
let chan_stat = get_channel_value_stat!(nodes[0], chan.2);
let channel_reserve = chan_stat.channel_reserve_msat;
// The 2* and +1 are for the fee spike reserve.
let (_, our_payment_hash, our_payment_secret) = get_payment_preimage_hash!(nodes[1]);
let commit_tx_fee = 2 * commit_tx_fee_msat(get_feerate!(nodes[0], chan.2), 1 + 1);
let max_can_send = 5000000 - channel_reserve - commit_tx_fee;
let net_graph_msg_handler = &nodes[0].net_graph_msg_handler;
let route = get_route(&nodes[0].node.get_our_node_id(), &net_graph_msg_handler.network_graph, &nodes.last().unwrap().node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &Vec::new(), max_can_send + 1, TEST_FINAL_CLTV, &logger).unwrap();
let err = nodes[0].node.send_payment(&route, our_payment_hash, &Some(our_payment_secret)).err().unwrap();
match err {
PaymentSendFailure::AllFailedRetrySafe(ref fails) => {
match &fails[0] {
&APIError::ChannelUnavailable{ref err} =>
assert!(regex::Regex::new(r"Cannot send value that would put our balance under counterparty-announced channel reserve value \(\d+\)").unwrap().is_match(err)),
_ => panic!("Unexpected error variant"),
}
},
_ => panic!("Unexpected error variant"),
}
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager".to_string(), "Cannot send value that would put our balance under counterparty-announced channel reserve value".to_string(), 1);
send_payment(&nodes[0], &vec![&nodes[1]], max_can_send);
} | rust_cleaned_test_functions.jsonl/16869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
14571,
89591,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
18343,
82,
7,
17,
11,
609,
5658,
1645,
18343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compound_with_ground() {
let schemaReplicant = prepopulated_schemaReplicant();
// Verify that we can use the resulting CCs as children in compound CCs.
let causetq = r#"[:find ?x :where (or [(ground "yyy") ?x]
[(ground "zzz") ?x])]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT DISTINCT `c00`.`?x` AS `?x` FROM (\
SELECT $v0 AS `?x` UNION \
SELECT $v1 AS `?x`) AS `c00`");
assert_eq!(args, vec![make_arg("$v0", "yyy"),
make_arg("$v1", "zzz"),]);
// Verify that we can use ground to constrain the ConstrainedEntss produced by earlier gerunds.
let causetq = r#"[:find ?x . :where [_ :foo/bar ?x] [(ground "yyy") ?x]]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT $v0 AS `?x` FROM `causets` AS `Causets00` \
WHERE `Causets00`.a = 99 AND `Causets00`.v = $v0 LIMIT 1");
assert_eq!(args, vec![make_arg("$v0", "yyy")]);
// Verify that we can further constrain the ConstrainedEntss produced by our gerund.
let causetq = r#"[:find ?x . :where [(ground "yyy") ?x] [_ :foo/bar ?x]]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT $v0 AS `?x` FROM `causets` AS `Causets00` \
WHERE `Causets00`.a = 99 AND `Causets00`.v = $v0 LIMIT 1");
assert_eq!(args, vec![make_arg("$v0", "yyy")]);
} | rust_cleaned_test_functions.jsonl/90723 | {
"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,
18177,
795,
6615,
72492,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
855,
8374,
7757,
25371,
18327,
35237,
1428,
262,
442,
25429,
429,
582,
646,
990,
279,
12942,
13534,
82,
438,
2841,
304,
2362... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two_unbalanced_stakes() {
solana_logger::setup_with_default(RUST_LOG_FILTER);
error!("test_two_unbalanced_stakes");
let validator_config = ValidatorConfig::default();
let num_ticks_per_second = 100;
let num_ticks_per_slot = 10;
let num_slots_per_epoch = MINIMUM_SLOTS_PER_EPOCH as u64;
let mut cluster = LocalCluster::new(
&mut ClusterConfig {
node_stakes: vec![999_990, 3],
cluster_lamports: 1_000_000,
validator_configs: make_identical_validator_configs(&validator_config, 2),
ticks_per_slot: num_ticks_per_slot,
slots_per_epoch: num_slots_per_epoch,
stakers_slot_offset: num_slots_per_epoch,
poh_config: PohConfig::new_sleep(Duration::from_millis(1000 / num_ticks_per_second)),
..ClusterConfig::default()
},
SocketAddrSpace::Unspecified,
);
cluster_tests::sleep_n_epochs(
10.0,
&cluster.genesis_config.poh_config,
num_ticks_per_slot,
num_slots_per_epoch,
);
cluster.close_preserve_ledgers();
let leader_pubkey = cluster.entry_point_info.id;
let leader_ledger = cluster.validators[&leader_pubkey].info.ledger_path.clone();
cluster_tests::verify_ledger_ticks(&leader_ledger, num_ticks_per_slot as usize);
} | rust_cleaned_test_functions.jsonl/31900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 619
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
4907,
58402,
1261,
2050,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
6615,
9993,
2785,
8553,
8419,
23728,
317,
262,
1465,
17223,
1944,
23241,
4907,
58402,
1261,
2050,
797,
262,
1077,
22935,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_game_play() {
new_test_ext().execute_with(|| {
let mut current_block:u64 = 100;
// start from block 100
run_to_block(current_block);
// Test game creation between to different players
assert_ok!(ConnectFour::new_game(Origin::signed(PLAYER_1 as u64), PLAYER_2 as u64));
let board_id = ConnectFour::player_board(PLAYER_1 as u64);
let board = ConnectFour::boards(board_id);
assert_eq!(board.last_turn, current_block);
run_next_block();
current_block = current_block + 1;
assert_eq!(System::block_number(), current_block);
if board.next_player == PLAYER_1 {
assert_ok!(ConnectFour::play_turn(Origin::signed(PLAYER_1 as u64), 0));
let board = ConnectFour::boards(board_id);
assert!(board.board_state == BoardState::Running);
assert!(board.next_player == PLAYER_2);
assert_eq!(board.last_turn, current_block);
run_next_block();
current_block = current_block + 1;
}
assert_ok!(ConnectFour::play_turn(Origin::signed(PLAYER_2 as u64), 1));
let board = ConnectFour::boards(board_id);
assert_eq!(board.last_turn, current_block);
assert!(board.board_state == BoardState::Running);
assert!(board.next_player == PLAYER_1);
run_next_block();
current_block = current_block + 1;
assert_ok!(ConnectFour::play_turn(Origin::signed(PLAYER_1 as u64), 2));
let board = ConnectFour::boards(board_id);
assert!(board.board_state == BoardState::Running);
run_next_block();
current_block = current_block + 1;
assert_ok!(ConnectFour::play_turn(Origin::signed(PLAYER_2 as u64), 1));
let board = ConnectFour::boards(board_id);
assert!(board.board_state == BoardState::Running);
run_next_block();
current_block = current_block + 1;
assert_ok!(ConnectFour::play_turn(Origin::signed(PLAYER_1 as u64), 3));
let board = ConnectFour::boards(board_id);
assert!(board.board_state == BoardState::Running);
run_next_block();
current_block = current_block + 1;
assert_ok!(ConnectFour::play_turn(Origin::signed(PLAYER_2 as u64), 1));
let board = ConnectFour::boards(board_id);
assert!(board.board_state == BoardState::Running);
run_next_block();
current_block = current_block + 1;
assert_ok!(ConnectFour::play_turn(Origin::signed(PLAYER_1 as u64), 4));
let board = ConnectFour::boards(board_id);
assert!(board.board_state == BoardState::Running);
run_next_block();
current_block = current_block + 1;
assert_ok!(ConnectFour::play_turn(Origin::signed(PLAYER_2 as u64), 1));
let board = ConnectFour::boards(board_id);
assert!(board.board_state == BoardState::Finished(board.blue));
assert_eq!(board.last_turn, current_block);
});
} | rust_cleaned_test_functions.jsonl/8681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1007
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18547,
22144,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
1476,
197,
10217,
5206,
1482,
7113,
25,
84,
21,
19,
284,
220,
16,
15,
15,
401,
197,
197,
322,
1191,
504,
2504,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_try_from() {
let data: Vec<u8> = vec![0x00];
let val = HeaderIdentOsAbi::try_from(data.as_ref()).unwrap();
println!("value: {:?}", val);
let expected = HeaderIdentOsAbi::new();
assert_eq!(expected, val);
let val: Vec<u8> = val.try_into().unwrap();
assert_eq!(data, val);
} | rust_cleaned_test_functions.jsonl/4090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
368,
341,
286,
1077,
821,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
87,
15,
15,
4821,
286,
1077,
1044,
284,
12104,
28301,
28867,
5830,
72,
486,
1539,
5673,
2592,
5357,
7793,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_ndarray1_0() {
let hw = RefCell::new(CpuHardware::new());
let src = ndarray::arr1(&[]);
let dest = src.into_array(&hw);
assert_eq!(*dest.shape(), Shape::new([0]));
assert_eq!(dest.get_values_f32(), vec![]);
} | rust_cleaned_test_functions.jsonl/73985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
43544,
1653,
16,
62,
15,
368,
341,
262,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
262,
1077,
2286,
284,
66883,
486,
1118,
16,
2099,
56703,
262,
1077,
3201,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_readable_duration() {
#[derive(Serialize, Deserialize)]
struct DurHolder {
d: ReadableDuration,
}
let legal_cases = vec![
(0, 0, "0s"),
(0, 1, "1ms"),
(2, 0, "2s"),
(24 * 3600, 0, "1d"),
(2 * 24 * 3600, 10, "2d10ms"),
(4 * 60, 0, "4m"),
(5 * 3600, 0, "5h"),
(3600 + 2 * 60, 0, "1h2m"),
(5 * 24 * 3600 + 3600 + 2 * 60, 0, "5d1h2m"),
(3600 + 2, 5, "1h2s5ms"),
(3 * 24 * 3600 + 7 * 3600 + 2, 5, "3d7h2s5ms"),
];
for (secs, ms, exp) in legal_cases {
let d = DurHolder {
d: ReadableDuration(Duration::new(secs, ms * 1_000_000)),
};
let res_str = toml::to_string(&d).unwrap();
let exp_str = format!("d = {:?}\n", exp);
assert_eq!(res_str, exp_str);
let res_dur: DurHolder = toml::from_str(&exp_str).unwrap();
assert_eq!(res_dur.d.0, d.d.0);
}
let decode_cases = vec![(" 0.5 h2m ", 3600 / 2 + 2 * 60, 0)];
for (src, secs, ms) in decode_cases {
let src = format!("d = {:?}", src);
let res: DurHolder = toml::from_str(&src).unwrap();
assert_eq!(res.d.0, Duration::new(secs, ms * 1_000_000));
}
let illegal_cases = vec!["1H", "1M", "1S", "1MS", "1h1h", "h"];
for src in illegal_cases {
let src_str = format!("d = {:?}", src);
assert!(toml::from_str::<DurHolder>(&src_str).is_err(), "{}", src);
}
assert!(toml::from_str::<DurHolder>("d = 23").is_err());
} | rust_cleaned_test_functions.jsonl/4780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 984
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
91232,
25454,
368,
341,
286,
11506,
27098,
3759,
9050,
11,
48440,
5563,
286,
2036,
20138,
8589,
341,
310,
294,
25,
4457,
480,
12945,
345,
286,
555,
286,
1077,
5777,
41427,
284,
7486,
90515,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_confirm_user_email() {
use cargo_registry::schema::emails;
let (app, _) = TestApp::init().empty();
// email directly into the database and we want to test the verification flow here.
let email = "potato2@example.com";
let user = app.db(|conn| {
let u = NewUser {
..new_user("arbitrary_username")
};
let u = u
.create_or_update(Some(email), &app.as_inner().emails, conn)
.unwrap();
MockCookieUser::new(&app, u)
});
let user_model = user.as_model();
let email_token: String = app.db(|conn| {
Email::belonging_to(user_model)
.select(emails::token)
.first(&*conn)
.unwrap()
});
user.confirm_email(&email_token);
let json = user.show_me();
assert_eq!(json.user.email.unwrap(), "potato2@example.com");
assert!(json.user.email_verified);
assert!(json.user.email_verification_sent);
} | rust_cleaned_test_functions.jsonl/34238 | {
"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,
23800,
3317,
9172,
368,
341,
262,
990,
25652,
50650,
486,
17349,
486,
51376,
401,
262,
1077,
320,
676,
11,
27439,
284,
3393,
2164,
486,
2327,
1005,
3194,
1428,
1066,
262,
442,
2551,
5961,
1119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_leq_diff_num_digits_true() {
// Given:
let a = Counter::from(vec![9]);
let b = Counter::from(vec![0, 1]);
// Then:
assert!(a <= b);
} | rust_cleaned_test_functions.jsonl/79525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
80,
15850,
4273,
41432,
16082,
368,
341,
310,
442,
16246,
510,
310,
1077,
264,
284,
19735,
486,
1499,
25592,
20703,
24,
2558,
310,
1077,
293,
284,
19735,
486,
1499,
25592,
20703,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_source_code_hash() {
assert_eq!(
"a3e29aece8d35a19bf9da2bb1c086af71fb36ed5",
source_code_hash("hello.ts", "1+2")
);
// Different source_code should result in different hash.
assert_eq!(
"914352911fc9c85170908ede3df1128d690dda41",
source_code_hash("hello.ts", "1")
);
// Different filename should result in different hash.
assert_eq!(
"2e396bc66101ecc642db27507048376d972b1b70",
source_code_hash("hi.ts", "1+2")
);
} | rust_cleaned_test_functions.jsonl/18029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10347,
4136,
8950,
368,
341,
220,
2060,
10714,
33673,
262,
330,
64,
18,
68,
17,
24,
5918,
346,
23,
67,
18,
20,
64,
16,
24,
13233,
24,
3235,
17,
6066,
16,
66,
15,
23,
21,
2577,
22,
16,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary() {
let tokens = vec![
token(Literal, "1"),
token(Plus, ""),
token(Literal, "2"),
token(Star, ""),
token(OpenParenthesis, ""),
token(Literal, "3"),
token(Minus, ""),
token(Literal, "4"),
token(Slash, ""),
token(Literal, "5"),
token(ClosedParenthesis, ""),
token(EOF, ""),
];
assert_eq!(
parse(tokens).unwrap(),
Stmt::Expr(binary(
literal(1f64),
Plus,
binary(
literal(2f64),
Star,
group(binary(
literal(3f64),
Minus,
binary(literal(4f64), Slash, literal(5f64))
))
)
))
);
} | rust_cleaned_test_functions.jsonl/120432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 635
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
368,
341,
1789,
286,
1077,
11211,
284,
7486,
90515,
310,
3950,
4957,
9953,
11,
330,
16,
4461,
310,
3950,
7,
21807,
11,
72712,
310,
3950,
4957,
9953,
11,
330,
17,
4461,
310,
3950,
7,
126... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_heap_oom() {
let mut heap = Heap::<32>::new();
let space: [usize; 100] = [0; 100];
unsafe {
heap.add_to_heap(space.as_ptr() as usize, space.as_ptr().add(100) as usize);
}
assert!(heap
.alloc(Layout::from_size_align(100 * size_of::<usize>(), 1).unwrap())
.is_err());
assert!(heap.alloc(Layout::from_size_align(1, 1).unwrap()).is_ok());
} | rust_cleaned_test_functions.jsonl/99751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33059,
62,
4191,
368,
341,
262,
1077,
5206,
17364,
284,
47307,
27638,
18,
17,
6831,
931,
543,
262,
1077,
3550,
25,
508,
51878,
26,
220,
16,
15,
15,
60,
284,
508,
15,
26,
220,
16,
15,
15,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enrich_valid_tensors() {
let tensors = vec![
pb::TensorProto {
dtype: pb::DataType::DtFloat.into(),
tensor_shape: Some(tensor_shape(&[])),
float_val: vec![0.125],
..Default::default()
},
pb::TensorProto {
dtype: pb::DataType::DtFloat.into(),
tensor_shape: Some(tensor_shape(&[])),
tensor_content: f32::to_le_bytes(0.125).to_vec(),
..Default::default()
},
pb::TensorProto {
dtype: pb::DataType::DtFloat.into(),
tensor_shape: None, // no explicit tensor shape; treated as rank 0
tensor_content: f32::to_le_bytes(0.125).to_vec(),
..Default::default()
},
];
for tensor in tensors {
let v = EventValue::Summary(SummaryValue(Box::new(Value::Tensor(tensor.clone()))));
let expected = Ok(ScalarValue(0.125));
let actual = v.into_scalar();
assert_eq!(
actual, expected,
"into_scalar for {:?}: got {:?}, expected {:?}",
&tensor, actual, expected
)
}
} | rust_cleaned_test_functions.jsonl/105064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 851
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
8337,
91067,
368,
341,
310,
1077,
77087,
284,
7486,
90515,
394,
17310,
486,
25336,
31549,
341,
503,
13231,
25,
17310,
486,
22653,
486,
69079,
5442,
39860,
3148,
503,
15626,
13597,
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... | 2 |
#[test]
fn test_top_score_collector_inital_state() {
let collector = TopScoreCollector::new(10);
let docs = collector.into_sorted_vec();
assert_eq!(docs.len(), 0);
} | rust_cleaned_test_functions.jsonl/96803 | {
"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,
10426,
10405,
10211,
27669,
1243,
2174,
4387,
368,
341,
286,
1077,
31953,
284,
6909,
10570,
53694,
486,
931,
7,
16,
15,
626,
286,
1077,
26340,
284,
31953,
39860,
41277,
13251,
543,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_spaceless() {
let tests = vec![
("<p>\n<a>test</a>\r\n </p>", "<p><a>test</a></p>"),
("<p>\n<a> </a>\r\n </p>", "<p><a></a></p>"),
("<p> </p>", "<p></p>"),
("<p> <a>", "<p><a>"),
("<p> test</p>", "<p> test</p>"),
("<p>\r\n</p>", "<p></p>"),
];
for (input, expected) in tests {
let result = spaceless(&to_value(input).unwrap(), &HashMap::new());
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(expected).unwrap());
}
} | rust_cleaned_test_functions.jsonl/119657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14663,
1717,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
90276,
79,
8449,
77,
9312,
29,
1944,
522,
64,
8449,
81,
1699,
690,
79,
21156,
4055,
79,
1784,
64,
29,
1944,
522,
64,
1472,
79,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_node_store() {
let meta = Meta::default();
let address = Address::new("address");
let payload = Payload::new("payload");
let mut node = Node::new(&meta, &address, &payload).unwrap();
let mut store = Store::new();
let res = node.store_create(&mut store);
assert!(res.is_ok());
let res = node.store_create(&mut store);
assert!(res.is_err());
let invalid_size = 0;
let mut invalid_node = node.clone();
invalid_node.meta.set_size(invalid_size);
let res = invalid_node.store_create(&mut store);
assert!(res.is_err());
let res = Node::store_lookup(&mut store, &node.address);
assert!(res.is_ok());
assert!(res.unwrap());
let unknown_address = Address::default();
let res = Node::store_lookup(&mut store, &unknown_address);
assert!(res.is_ok());
assert!(!res.unwrap());
let res = Node::store_get(&mut store, &node.address);
assert!(res.is_ok());
let found_node = res.unwrap();
assert_eq!(found_node, node);
let res = Node::store_get(&mut store, &unknown_address);
assert!(res.is_err());
let mut from = Some(node.address.clone());
let mut to = Some(node.address.clone());
let res = Node::store_count(&mut store, from.clone(), to.clone());
assert!(res.is_err());
from = None;
to = None;
let res = Node::store_count(&mut store, from.clone(), to.clone());
assert!(res.is_ok());
let count = res.unwrap();
assert_eq!(count, 1);
from = Some(node.address.clone());
let res = Node::store_count(&mut store, from.clone(), to.clone());
assert!(res.is_ok());
let count = res.unwrap();
assert_eq!(count, 1);
from = None;
to = Some(node.address.clone());
let res = Node::store_count(&mut store, from.clone(), to.clone());
assert!(res.is_ok());
let count = res.unwrap();
assert_eq!(count, 0);
let mut from = Some(node.address.clone());
let mut to = Some(node.address.clone());
let mut count = None;
let skip = 0;
let res = Node::store_list(&mut store, from.clone(), to.clone(), count, skip);
assert!(res.is_err());
count = Some(0);
let res = Node::store_list(&mut store, from.clone(), to.clone(), count, skip);
assert!(res.is_err());
from = None;
to = None;
count = None;
let res = Node::store_list(&mut store, from.clone(), to.clone(), count, skip);
assert!(res.is_ok());
let list = res.unwrap();
assert_eq!(list, vec![node.clone()]);
from = Some(node.address.clone());
let res = Node::store_list(&mut store, from.clone(), to.clone(), count, skip);
assert!(res.is_ok());
let list = res.unwrap();
assert_eq!(list, vec![node.clone()]);
from = None;
to = Some(node.address.clone());
let res = Node::store_list(&mut store, from.clone(), to.clone(), count, skip);
assert!(res.is_ok());
let list = res.unwrap();
assert_eq!(list, vec![]);
node.payload = Payload::new("An other one");
let res = node.store_update(&mut store);
assert!(res.is_err());
node.update_size();
let res = node.store_update(&mut store);
assert!(res.is_ok());
node.payload = Payload::new("Again");
node.update_size();
let res = node.store_update(&mut store);
assert!(res.is_ok());
let res = Node::store_get(&mut store, &node.address);
assert!(res.is_ok());
let found_node = res.unwrap();
assert_eq!(found_node, node);
let res = node.store_delete(&mut store);
assert!(res.is_ok());
let res = node.store_delete(&mut store);
assert!(res.is_err());
let res = Node::store_lookup(&mut store, &node.address);
assert!(res.is_ok());
assert!(!res.unwrap());
let res = Node::store_get(&mut store, &node.address);
assert!(res.is_err());
from = None;
to = None;
let res = Node::store_count(&mut store, to.clone(), from.clone());
assert!(res.is_ok());
let count = res.unwrap();
assert_eq!(count, 0);
let count = None;
let res = Node::store_list(&mut store, to.clone(), from.clone(), count, skip);
assert!(res.is_ok());
let list = res.unwrap();
assert_eq!(list, vec![]);
let res = node.store_upsert(&mut store);
assert!(res.is_ok());
let res = Node::store_count(&mut store, to.clone(), from.clone());
assert!(res.is_ok());
let count = res.unwrap();
assert_eq!(count, 1);
let count = None;
let res = Node::store_list(&mut store, to, from, count, skip);
assert!(res.is_ok());
let list = res.unwrap();
assert_eq!(list, vec![node.clone()]);
} | rust_cleaned_test_functions.jsonl/56015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1844
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
14809,
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_exchange_to_bigdecimal_works() {
assert_eq!(
to_bigdecimal(-123.0),
BigDecimal::from_str("-123.0000000000000").unwrap()
);
} | rust_cleaned_test_functions.jsonl/74672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
2346,
36386,
23289,
11498,
82,
368,
341,
286,
2060,
10714,
33673,
310,
311,
36386,
23289,
4080,
16,
17,
18,
13,
15,
1326,
310,
20618,
486,
1499,
2895,
13645,
16,
17,
18,
13,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_composition() {
struct Magi<T>(T);
struct Madoka {
god: bool,
}
struct Homura {
attempts: usize,
}
struct Mami {
guns: usize,
}
let mut map = Extensions::new();
map.insert(Magi(Madoka { god: false }));
map.insert(Magi(Homura { attempts: 0 }));
map.insert(Magi(Mami { guns: 999 }));
assert!(!map.get::<Magi<Madoka>>().unwrap().0.god);
assert_eq!(0, map.get::<Magi<Homura>>().unwrap().0.attempts);
assert_eq!(999, map.get::<Magi<Mami>>().unwrap().0.guns);
} | rust_cleaned_test_functions.jsonl/43508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
3487,
368,
341,
262,
2036,
6879,
72,
3125,
2235,
51,
626,
262,
2036,
9483,
30766,
341,
286,
9886,
25,
1807,
345,
262,
555,
262,
2036,
13222,
5690,
341,
286,
13553,
25,
22301,
345,
262,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_errorful_json_lifecycle_event_formatting() {
let json_schema = Data::for_lifecycle_event(
"a/b/c/d",
LifecycleType::DiagnosticsReady,
None,
TEST_URL,
123456u64,
vec![Error { message: "too much fun being had.".to_string() }],
);
let result_json =
serde_json::to_value(&json_schema).expect("serialization should succeed.");
let expected_json = json!({
"moniker": "a/b/c/d",
"version": 1,
"data_source": "LifecycleEvent",
"payload": null,
"metadata": {
"errors": ["too much fun being had."],
"lifecycle_event_type": "DiagnosticsReady",
"component_url": TEST_URL,
"timestamp": 123456,
}
});
pretty_assertions::assert_eq!(result_json, expected_json, "golden diff failed.");
} | rust_cleaned_test_functions.jsonl/71450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 482
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
1262,
9455,
907,
19517,
6748,
8955,
1280,
368,
341,
286,
1077,
2951,
25371,
284,
2885,
486,
1958,
907,
19517,
6748,
1006,
310,
330,
64,
3470,
2899,
3446,
756,
310,
74392,
929,
486,
35,
189... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_farmer_reward_update_variable() {
let mut r = FarmerReward::new();
assert_eq!(123, r.outstanding_reward().unwrap());
r.update_variable_reward(10, Number128::from(50u64))
.unwrap();
assert_eq!(133, r.outstanding_reward().unwrap());
assert_eq!(
Number128::from(50u64),
r.variable_rate
.last_recorded_accrued_reward_per_rarity_point
);
} | rust_cleaned_test_functions.jsonl/51350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67513,
1174,
38260,
8882,
14635,
368,
341,
286,
1077,
5206,
435,
284,
67464,
59622,
486,
931,
543,
286,
2060,
10714,
10297,
16,
17,
18,
11,
435,
2532,
10070,
38260,
1005,
15454,
5231,
286,
435,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_best_match_for_name() {
use crate::with_default_globals;
with_default_globals(|| {
let input = vec![Symbol::intern("aaab"), Symbol::intern("aaabc")];
assert_eq!(
find_best_match_for_name(input.iter(), "aaaa", None),
Some(Symbol::intern("aaab"))
);
assert_eq!(
find_best_match_for_name(input.iter(), "1111111111", None),
None
);
let input = vec![Symbol::intern("aAAA")];
assert_eq!(
find_best_match_for_name(input.iter(), "AAAA", None),
Some(Symbol::intern("aAAA"))
);
let input = vec![Symbol::intern("AAAA")];
// Returns None because `lev_distance > max_dist / 3`
assert_eq!(
find_best_match_for_name(input.iter(), "aaaa", None),
None
);
let input = vec![Symbol::intern("AAAA")];
assert_eq!(
find_best_match_for_name(input.iter(), "aaaa", Some(4)),
Some(Symbol::intern("AAAA"))
);
})
} | rust_cleaned_test_functions.jsonl/72390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
33101,
10708,
5478,
1269,
368,
341,
262,
990,
17717,
486,
4197,
9993,
58775,
280,
262,
448,
9993,
58775,
79453,
341,
286,
1077,
1946,
284,
7486,
20703,
15090,
486,
55444,
445,
5305,
370,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_incompatible_multiply() {
let m1 = matrix!([0, 1], [0, 1], [0, 1]);
let m2 = matrix!([0, 1, 2]);
m1.multiply(&m2);
} | rust_cleaned_test_functions.jsonl/22062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
34842,
93054,
368,
341,
286,
1077,
296,
16,
284,
6172,
0,
2561,
15,
11,
220,
16,
1125,
508,
15,
11,
220,
16,
1125,
508,
15,
11,
220,
16,
2558,
286,
1077,
296,
17,
284,
6172,
0,
2561,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rename_struct_field() {
test_rename(
r#"
struct Foo {
i<|>: i32,
}
impl Foo {
fn new(i: i32) -> Self {
Self { i: i }
}
}
"#,
"j",
r#"
struct Foo {
j: i32,
}
impl Foo {
fn new(i: i32) -> Self {
Self { j: i }
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/16216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79399,
15126,
5013,
368,
341,
286,
1273,
79399,
1006,
310,
435,
2,
698,
262,
2036,
33428,
341,
286,
600,
27,
91,
26818,
600,
18,
17,
345,
262,
555,
262,
11605,
33428,
341,
286,
5168,
501,
1956... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_to_string_value_create_tag_extension() {
let end = "a_string".to_string().len();
let tag = Tag {
anchor: None,
span: Span::new(0, end),
};
let expected = Value {
value: UntaggedValue::Primitive(Primitive::String("a_string".to_string())),
tag,
};
assert_eq!(
"a_string".to_string().to_string_value_create_tag(),
expected
);
} | rust_cleaned_test_functions.jsonl/124319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
2346,
3904,
3142,
8657,
9372,
31035,
368,
341,
286,
1077,
835,
284,
330,
64,
3904,
3263,
983,
3904,
1005,
2892,
543,
286,
1077,
4772,
284,
12353,
341,
310,
17105,
25,
2240,
345,
310,
9390,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_put_mmds_request() {
let body = r#"{
"foo": "bar"
}"#;
assert!(parse_put_mmds(&Body::new(body), None).is_ok());
let invalid_body = "invalid_body";
assert!(parse_put_mmds(&Body::new(invalid_body), None).is_err());
assert!(METRICS.put_api_requests.mmds_fails.count() > 0);
// Test `config` path.
let body = r#"{
"version": "V2",
"ipv4_address": "169.254.170.2",
"network_interfaces": []
}"#;
let config_path = "config";
assert!(parse_put_mmds(&Body::new(body), Some(&config_path)).is_ok());
let body = r#"{
"network_interfaces": []
}"#;
assert!(parse_put_mmds(&Body::new(body), Some(&config_path)).is_ok());
let body = r#"{
"version": "foo",
"ipv4_address": "169.254.170.2",
"network_interfaces": []
}"#;
assert!(parse_put_mmds(&Body::new(body), Some(&config_path)).is_err());
let body = r#"{
"version": "V2"
}"#;
assert!(parse_put_mmds(&Body::new(body), Some(&config_path)).is_err());
let body = r#"{
"ipv4_address": "",
"network_interfaces": []
}"#;
assert!(parse_put_mmds(&Body::new(body), Some(&config_path)).is_err());
let invalid_config_body = r#"{
"invalid_config": "invalid_value"
}"#;
assert!(parse_put_mmds(&Body::new(invalid_config_body), Some(&config_path)).is_err());
assert!(parse_put_mmds(&Body::new(body), Some(&"invalid_path")).is_err());
assert!(parse_put_mmds(&Body::new(invalid_body), Some(&config_path)).is_err());
} | rust_cleaned_test_functions.jsonl/53459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 992
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15557,
717,
2277,
82,
7893,
368,
341,
286,
1077,
2487,
284,
435,
55543,
515,
394,
330,
7975,
788,
330,
2257,
698,
1060,
335,
57676,
280,
286,
2060,
10297,
6400,
15557,
717,
2277,
82,
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_fq_is_valid() {
let mut a = MODULUS_LIMBS;
assert!(!a.is_valid());
a.sub_noborrow(&Fq([1, 0, 0, 0, 0, 0]));
assert!(a.is_valid());
assert!(Fq::from(0).is_valid());
assert!(Fq([
0xdf4671abd14dab3e,
0xe2dc0c9f534fbd33,
0x31ca6c880cc444a6,
0x257a67e70ef33359,
0xf9b29e493f899b36,
0x17c8be1800b9f059
])
.is_valid());
assert!(!Fq([
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff
])
.is_valid());
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
0xe5,
]);
for _ in 0..1000 {
let a = Fq::random(&mut rng);
assert!(a.is_valid());
}
} | rust_cleaned_test_functions.jsonl/79185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
6892,
8337,
368,
341,
262,
1077,
5206,
264,
284,
18669,
1094,
2034,
2351,
1791,
7347,
280,
262,
2060,
0,
3471,
64,
2079,
8337,
1423,
262,
264,
4309,
1089,
674,
7768,
2099,
37,
80,
256... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_delay_first_example() {
let first_line = "R8,U5,L5,D3";
let second_line = "U7,R6,D4,L4";
assert_eq!(30, get_minimum_signal_delay_intersection(first_line, second_line));
} | rust_cleaned_test_functions.jsonl/45004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22198,
12978,
39304,
368,
341,
286,
1077,
1156,
6528,
284,
330,
49,
23,
50481,
20,
30114,
20,
27266,
18,
876,
286,
1077,
2086,
6528,
284,
330,
52,
22,
23508,
21,
27266,
19,
30114,
19,
3302,
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 |
#[test]
fn test_sta() {
let mut state = State8080::empty_state();
state.memory = vec![0x32, 0x03, 0x00, 0x00];
state.a = 0x09;
state.set_program_counter(0);
emulate_8080_op(&mut state);
assert_eq!(state.read_memory(0x0003), 0x09);
assert_eq!(state.program_counter(), 0x03);
} | rust_cleaned_test_functions.jsonl/7769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79951,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
87,
18,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_does_not_intersect_with_full() {
let e1: EnumSet<Foo> = EnumSet::new();
let mut e2: EnumSet<Foo> = EnumSet::new();
e2.insert(A);
e2.insert(B);
e2.insert(C);
assert!(e1.is_disjoint(&e2));
} | rust_cleaned_test_functions.jsonl/2752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
96374,
7913,
72747,
6615,
16372,
368,
341,
286,
1077,
384,
16,
25,
14086,
1649,
30499,
2624,
29,
284,
14086,
1649,
486,
931,
1428,
286,
1077,
5206,
384,
17,
25,
14086,
1649,
30499,
2624,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_completions() {
let elvish_output = "
edit:completion:arg-completer[factomd-configuration] = [@words]{
fn spaces [n]{
repeat $n ' ' | joins ''
}
fn cand [text desc]{
edit:complex-candidate $text &display-suffix=' '(spaces (- 14 (wcswidth $text)))$desc
}
command = 'factomd-configuration'
for word $words[1:-1] {
if (has-prefix $word '-') {
break
}
command = $command';'$word
}
completions = [
&'factomd-configuration'= {
cand -c 'Custom configuration file location'
cand --config 'Custom configuration file location'
cand -n 'Set network to join'
cand --network 'Set network to join'
cand -r 'Environment variable to source for your node_key'
cand --role 'Environment variable to source for your node_key'
cand -k 'Environment variable to source for your node_key'
cand --node-key-env 'Environment variable to source for your node_key'
cand --port 'Port to run node on for P2P'
cand --bootnodes 'Bootnodes to get into the network'
cand -l 'l'
cand --log-level 'log-level'
cand --rpc-addr 'HTTP-RPC listening interface'
cand --rpc-port 'HTTP-RPC listening port'
cand --walletd-user 'Set walletd user for authentication'
cand --walletd-env-var 'Set env variable to get walletd password'
cand --completions 'Generate completions'
cand -d 'Disable RPC server'
cand --disable-rpc 'Disable RPC server'
cand -h 'Prints help information'
cand --help 'Prints help information'
cand -V 'Prints version information'
cand --version 'Prints version information'
}
]
$completions[$command]
}
";
let mut cmd1 = Command::cargo_bin("factomd").unwrap();
let mut cmd2 = Command::cargo_bin("factomd").unwrap();
let mut cmd3 = Command::cargo_bin("factomd").unwrap();
cmd1.arg("--completions").arg("bash").assert().success();
cmd2.arg("--completions")
.arg("not-a-shell")
.assert()
.failure();
cmd3.arg("--completions")
.arg("elvish")
.assert()
.stdout(elvish_output);
} | rust_cleaned_test_functions.jsonl/86578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1035
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
10819,
908,
368,
341,
262,
1077,
655,
85,
812,
7645,
284,
6228,
3587,
25,
43312,
25,
858,
11476,
694,
465,
24769,
531,
316,
67,
12,
21138,
60,
284,
73879,
5761,
60,
515,
262,
5168,
12621... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flatten_advance_by() {
let mut it = once(0..10).chain(once(10..30)).chain(once(30..40)).flatten();
it.advance_by(5).unwrap();
assert_eq!(it.next(), Some(5));
it.advance_by(9).unwrap();
assert_eq!(it.next(), Some(15));
it.advance_back_by(4).unwrap();
assert_eq!(it.next_back(), Some(35));
it.advance_back_by(9).unwrap();
assert_eq!(it.next_back(), Some(25));
assert_eq!(it.advance_by(usize::MAX), Err(9));
assert_eq!(it.advance_back_by(usize::MAX), Err(0));
assert_eq!(it.size_hint(), (0, Some(0)));
} | rust_cleaned_test_functions.jsonl/105241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5081,
14456,
98093,
3710,
368,
341,
262,
1077,
5206,
432,
284,
3055,
7,
15,
496,
16,
15,
568,
8819,
7,
13184,
7,
16,
15,
496,
18,
15,
4579,
8819,
7,
13184,
7,
18,
15,
496,
19,
15,
4579,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_already_logging() {
let mut runner = Runner::new();
// Start the first logging task.
let mut query = runner.proxy.start_logging(100, 200);
assert_matches!(runner.executor.run_until_stalled(&mut query), Poll::Ready(Ok(Ok(()))));
assert_eq!(runner.iterate_logging_task(), true);
// Attempt to start another logging task while the first one is still running. The request
// to start should fail.
let mut query = runner.proxy.start_logging(100, 200);
assert_matches!(
runner.executor.run_until_stalled(&mut query),
Poll::Ready(Ok(Err(fsysmetrics::SystemMetricsLoggerError::AlreadyLogging)))
);
assert_eq!(runner.iterate_logging_task(), true);
assert_eq!(runner.iterate_logging_task(), false);
// Starting a new logging task should succeed now.
let mut query = runner.proxy.start_logging(100, 200);
assert_matches!(runner.executor.run_until_stalled(&mut query), Poll::Ready(Ok(Ok(()))));
} | rust_cleaned_test_functions.jsonl/55739 | {
"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,
80772,
59982,
368,
341,
286,
1077,
5206,
22259,
284,
44946,
486,
931,
1428,
286,
442,
5145,
279,
1156,
8392,
3383,
624,
286,
1077,
5206,
3239,
284,
22259,
41103,
4962,
59982,
7,
16,
15,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_well_known_type_full() {
assert_eq!(
Some(ProtobufRelativePath::from("BoolValue")),
is_well_known_type_full(&ProtobufAbsolutePath::from(".google.protobuf.BoolValue"))
);
assert_eq!(
None,
is_well_known_type_full(&ProtobufAbsolutePath::from(".google.protobuf.Fgfg"))
);
} | rust_cleaned_test_functions.jsonl/68895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
1670,
613,
71690,
1819,
16372,
368,
341,
286,
2060,
10714,
33673,
310,
4329,
7,
12423,
18464,
28442,
1820,
486,
1499,
445,
11233,
1130,
30154,
310,
374,
1670,
613,
71690,
1819,
16372,
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_clone() {
let db_name = "target/tmp/test_dbu64/test_clone.abyssiniandb";
let _ = std::fs::remove_dir_all(db_name);
let db = abyssiniandb::open_file(db_name).unwrap();
let mut db_map = db
.db_map_u64_with_params(
"some_u64_1",
FileDbParams {
buckets_size: HashBucketsParam::Capacity(4),
..Default::default()
},
)
.unwrap();
assert_eq!(db_map.len().unwrap(), 0);
db_map.put(&1, &[2]).unwrap();
assert_eq!(db_map.len().unwrap(), 1);
db_map.put(&2, &[4]).unwrap();
assert_eq!(db_map.len().unwrap(), 2);
let mut db_map2 = db_map.clone();
assert_eq!(db_map2.get(&1).unwrap(), Some(vec![2]));
assert_eq!(db_map2.get(&2).unwrap(), Some(vec![4]));
assert_eq!(db_map2.len().unwrap(), 2);
} | rust_cleaned_test_functions.jsonl/3863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
368,
341,
286,
1077,
2927,
1269,
284,
330,
5657,
57008,
12697,
8685,
84,
21,
19,
12697,
54742,
13,
6115,
778,
6591,
437,
65,
876,
286,
1077,
716,
284,
1460,
486,
3848,
486,
5399,
4334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_class_validate_parity() {
let cases: [(u8, u8, bool, u8); 9] = [
(2, 4, true, 16),
(3, 3, true, 16),
(0, 0, true, 16),
(1, 4, false, 16),
(7, 6, false, 16),
(9, 0, false, 16),
(9, 9, false, 16),
(2, 9, false, 16),
(9, 2, false, 16),
];
for (rrs_parity, ss_parity, success, set_drive_count) in cases.iter() {
let result = validate_parity(*ss_parity, *rrs_parity, *set_drive_count);
match result {
Ok(_) => assert!(success),
Err(_) => assert!(!success),
}
}
} | rust_cleaned_test_functions.jsonl/44022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
4790,
42681,
620,
10748,
368,
341,
286,
1077,
5048,
25,
17826,
84,
23,
11,
575,
23,
11,
1807,
11,
575,
23,
1215,
220,
24,
60,
284,
2278,
310,
320,
17,
11,
220,
19,
11,
830,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_read_coils() {
let (_s, cfg) = start_dummy_server_with_cfg();
let mut trans = Transport::new_with_cfg("127.0.0.1", cfg).unwrap();
assert_eq!(trans.read_coils(0, 5).unwrap().len(), 5);
assert!(trans.read_coils(0, 5).unwrap().iter().all(|c| *c == Coil::Off));
} | rust_cleaned_test_functions.jsonl/46832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
11393,
8669,
368,
341,
286,
1077,
5453,
82,
11,
13286,
8,
284,
1191,
60321,
12015,
6615,
18343,
543,
286,
1077,
5206,
1356,
284,
16742,
486,
931,
6615,
18343,
445,
16,
17,
22,
13,
15,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_roundtrip_nested_dict() {
let inner: DictionaryArray<datatypes::Int32Type> =
vec!["a", "b", "a"].into_iter().collect();
let array = Arc::new(inner) as ArrayRef;
let dctfield = Field::new("dict", array.data_type().clone(), false);
let s = StructArray::from(vec![(dctfield, array)]);
let struct_array = Arc::new(s) as ArrayRef;
let schema = Arc::new(Schema::new(vec![Field::new(
"struct",
struct_array.data_type().clone(),
false,
)]));
let batch = RecordBatch::try_new(schema.clone(), vec![struct_array]).unwrap();
let mut buf = Vec::new();
let mut writer = ipc::writer::FileWriter::try_new(&mut buf, &schema).unwrap();
writer.write(&batch).unwrap();
writer.finish().unwrap();
drop(writer);
let reader = ipc::reader::FileReader::try_new(std::io::Cursor::new(buf)).unwrap();
let batch2: std::result::Result<Vec<_>, _> = reader.collect();
assert_eq!(batch, batch2.unwrap()[0]);
} | rust_cleaned_test_functions.jsonl/85159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
32981,
66279,
5243,
368,
341,
286,
1077,
9179,
25,
10466,
1857,
27,
5911,
60913,
486,
1072,
18,
17,
929,
29,
4035,
310,
7486,
0,
1183,
64,
497,
330,
65,
497,
330,
64,
5521,
18122,
11723... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rule() {
let rule: Rule = "target".parse().unwrap();
assert!(rule.test_purge("target"));
assert!(!rule.test_purge("-target"));
assert!(!rule.test_purge("target-"));
assert!(!rule.test_purge("Target"));
let rule: Rule = "^(Debug|Release)$@\\.sln$".parse().unwrap();
assert!(rule.test_purge("Debug"));
assert!(!rule.test_purge("Debug-"));
assert!(!rule.test_purge("-Debug"));
assert!(rule.test_check("App.sln"));
} | rust_cleaned_test_functions.jsonl/39889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21124,
368,
341,
286,
1077,
5912,
25,
18100,
284,
330,
5657,
3263,
6400,
1005,
15454,
543,
286,
2060,
10297,
12937,
5958,
620,
39823,
445,
5657,
4010,
286,
2060,
0,
3471,
12937,
5958,
620,
39823,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_foreign_types_map_mod() {
let mod_item = syn::parse_str::<ItemMod>(
r#"
mod swig_foreign_types_map {
#![swig_foreigner_type="boolean"]
#![swig_rust_type="jboolean"]
#![swig_foreigner_type="short"]
#![swig_rust_type="jshort"]
#![swig_foreigner_type="int"]
#![swig_rust_type="jint"]
}
"#,
)
.unwrap();
let map = parse_foreign_types_map_mod(SourceId::none(), &mod_item).unwrap();
assert_eq!(
vec![
("boolean".into(), "jboolean".into()),
("int".into(), "jint".into()),
("short".into(), "jshort".into()),
],
{
let mut ret = map
.into_iter()
.map(|v| (v.foreign_name.typename, v.rust_name.typename))
.collect::<Vec<_>>();
ret.sort_by(|a, b| a.0.cmp(&b.0));
ret
}
);
} | rust_cleaned_test_functions.jsonl/18727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
78983,
9763,
5376,
7480,
368,
341,
286,
1077,
1463,
5634,
284,
6782,
486,
6400,
2895,
27638,
1234,
4459,
17055,
310,
435,
2,
698,
2593,
2021,
343,
78983,
9763,
5376,
341,
262,
671,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concurrent_update_and_remove_add_bias() {
let mut m1 = TMap::new();
let mut m2 = TMap::new();
let op1 = map::Op::Rm {
clock: Dot::new(1, 1).into(),
keyset: vec![102].into_iter().collect(),
};
let op2 = m2.update(102, m2.get(&102).derive_add_ctx(2), |map, ctx| {
map.update(42, ctx, |reg, ctx| reg.write(7, ctx))
});
m1.apply(op1.clone());
m2.apply(op2.clone());
let mut m1_clone = m1.clone();
let mut m2_clone = m2.clone();
m1_clone.merge(m2.clone());
m2_clone.merge(m1.clone());
m1.apply(op2);
m2.apply(op1);
assert_eq!(m1_clone, m2_clone);
assert_eq!(m1, m2);
assert_eq!(m1, m1_clone);
// we bias towards adds
assert_eq!(
m1.get(&102)
.val
.and_then(|map| map.get(&42).val)
.map(|reg| reg.read().val),
Some(vec![7])
);
} | rust_cleaned_test_functions.jsonl/61626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3231,
8882,
8378,
18193,
2891,
36381,
368,
341,
262,
1077,
5206,
296,
16,
284,
350,
2227,
486,
931,
543,
262,
1077,
5206,
296,
17,
284,
350,
2227,
486,
931,
1428,
262,
1077,
1179,
16,
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_reader_huffman_be() {
use bitstream_io::huffman::compile_read_tree;
use bitstream_io::{BigEndian, BitReader, HuffmanRead};
let tree = compile_read_tree(vec![
(0, vec![1, 1]),
(1, vec![1, 0]),
(2, vec![0, 1]),
(3, vec![0, 0, 1]),
(4, vec![0, 0, 0]),
])
.unwrap();
let actual_data: [u8; 4] = [0xB1, 0xED, 0x3B, 0xC1];
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
assert_eq!(r.read_huffman(&tree).unwrap(), 1);
assert_eq!(r.read_huffman(&tree).unwrap(), 0);
assert_eq!(r.read_huffman(&tree).unwrap(), 4);
assert_eq!(r.read_huffman(&tree).unwrap(), 0);
assert_eq!(r.read_huffman(&tree).unwrap(), 0);
assert_eq!(r.read_huffman(&tree).unwrap(), 2);
assert_eq!(r.read_huffman(&tree).unwrap(), 1);
assert_eq!(r.read_huffman(&tree).unwrap(), 1);
assert_eq!(r.read_huffman(&tree).unwrap(), 2);
assert_eq!(r.read_huffman(&tree).unwrap(), 0);
assert_eq!(r.read_huffman(&tree).unwrap(), 2);
assert_eq!(r.read_huffman(&tree).unwrap(), 0);
assert_eq!(r.read_huffman(&tree).unwrap(), 1);
assert_eq!(r.read_huffman(&tree).unwrap(), 4);
assert_eq!(r.read_huffman(&tree).unwrap(), 2);
} | rust_cleaned_test_functions.jsonl/65118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
1523,
77708,
21263,
368,
341,
262,
990,
2699,
4027,
16939,
486,
71,
77708,
486,
20433,
6443,
11663,
280,
262,
990,
2699,
4027,
16939,
22964,
15636,
43231,
11,
6495,
5062,
11,
88497,
4418,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_options_nonzero_defaults_json_de() {
let act: Options = serde_json::value::from_value(json!({})).unwrap();
assert_eq!(act, Options::default());
} | rust_cleaned_test_functions.jsonl/18280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8743,
21637,
14154,
42290,
9455,
2259,
368,
341,
286,
1077,
1160,
25,
14566,
284,
61570,
9455,
486,
957,
486,
1499,
3142,
9304,
0,
2306,
92,
4579,
15454,
543,
286,
2060,
10714,
10297,
531,
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 |
#[test]
fn test_unwrap_pad_24_byte_key_20_byte_data() {
let ct = hex!("138bdeaa9b8fa7fc61f97742e72248ee5ae6ae5360d1ae6a5f54f373fa543b6a").to_vec();
let key = hex!("5840df6e29b02af1ab493b705bf16ea1ae8338f4dcc176a8").to_vec();
let pt = aes_unwrap_with_padding(&ct, &key);
assert!(pt.is_ok(), "Test unexpectantly failed: {:?}", pt);
assert_eq!(
pt.unwrap(),
hex!("c37b7e6492584340bed12207808941155068f738").to_vec()
);
} | rust_cleaned_test_functions.jsonl/49073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
10097,
30290,
62,
17,
19,
19737,
3097,
62,
17,
15,
19737,
1769,
368,
341,
286,
1077,
20251,
284,
12371,
17223,
16,
18,
23,
65,
450,
5305,
24,
65,
23,
3632,
22,
8316,
21,
16,
69,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_6() {
let string = "2.3*4";
let tokenizer = Tokenizer::new(string);
let tokens: Vec<Token> = tokenizer.iter().collect();
assert_eq!(
tokens,
vec![
Token::Unquoted("2".to_string()),
Token::Punctuation(".".to_string()),
Token::Unquoted("3".to_string()),
Token::Punctuation("*".to_string()),
Token::Unquoted("4".to_string()),
]
);
assert_eq!(
string,
tokens.iter().map(|x| x.to_string()).collect::<String>()
);
} | rust_cleaned_test_functions.jsonl/75870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
21,
368,
341,
286,
1077,
914,
284,
330,
17,
13,
18,
9,
19,
876,
286,
1077,
45958,
284,
9660,
3135,
486,
931,
3609,
317,
286,
1077,
11211,
25,
11312,
83416,
29,
284,
45958,
19471,
1005,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_zone_keys() {
use trust_dns_client::rr::dnssec::Algorithm;
use trust_dns_client::rr::Name;
let config: Config = "
[[zones]]
zone = \"example.com\"
zone_type = \"Primary\"
file = \"example.com.zone\"
\
[[zones.keys]]
key_path = \"/path/to/my_ed25519.pem\"
algorithm = \"ED25519\"
\
signer_name = \"ns.example.com.\"
is_zone_signing_key = false
is_zone_update_auth = true
[[zones.keys]]
key_path = \"/path/to/my_rsa.pem\"
algorithm = \
\"RSASHA256\"
signer_name = \"ns.example.com.\"
"
.parse()
.unwrap();
assert_eq!(
config.get_zones()[0].get_keys()[0].key_path(),
Path::new("/path/to/my_ed25519.pem")
);
assert_eq!(
config.get_zones()[0].get_keys()[0].algorithm().unwrap(),
Algorithm::ED25519
);
assert_eq!(
config.get_zones()[0].get_keys()[0]
.signer_name()
.unwrap()
.unwrap(),
Name::parse("ns.example.com.", None).unwrap()
);
assert!(!config.get_zones()[0].get_keys()[0].is_zone_signing_key(),);
assert!(config.get_zones()[0].get_keys()[0].is_zone_update_auth(),);
assert_eq!(
config.get_zones()[0].get_keys()[1].key_path(),
Path::new("/path/to/my_rsa.pem")
);
assert_eq!(
config.get_zones()[0].get_keys()[1].algorithm().unwrap(),
Algorithm::RSASHA256
);
assert_eq!(
config.get_zones()[0].get_keys()[1]
.signer_name()
.unwrap()
.unwrap(),
Name::parse("ns.example.com.", None).unwrap()
);
assert!(!config.get_zones()[0].get_keys()[1].is_zone_signing_key(),);
assert!(!config.get_zones()[0].get_keys()[1].is_zone_update_auth(),);
} | rust_cleaned_test_functions.jsonl/27755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 889
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
28692,
12631,
368,
341,
262,
990,
6950,
71125,
8179,
486,
634,
486,
45226,
5024,
486,
27847,
280,
262,
990,
6950,
71125,
8179,
486,
634,
486,
675,
401,
262,
1077,
2193,
25,
5532,
284,
622... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_units_usec() {
let vm = &mut VM::new();
vm.set_source("2.0E usec");
vm.evaluate_input();
assert_eq!(vm.last_error(), None);
assert_eq!(vm.f_stack().len(), 1);
let t = vm.f_stack().pop();
assert!(double_value_check(t, 0.000_002));
} | rust_cleaned_test_functions.jsonl/29594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28345,
43047,
368,
341,
286,
1077,
10995,
284,
609,
6984,
17792,
486,
931,
543,
286,
10995,
980,
10347,
445,
17,
13,
15,
36,
990,
66,
797,
286,
10995,
36036,
5898,
543,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sum() {
let metrics = ExecutionPlanMetricsSet::new();
let count1 = MetricBuilder::new(&metrics)
.with_new_label("foo", "bar")
.counter("my_counter", 1);
count1.add(1);
let count2 = MetricBuilder::new(&metrics).counter("my_counter", 2);
count2.add(2);
let metrics = metrics.clone_inner();
assert!(metrics.sum(|_| false).is_none());
let expected_count = Count::new();
expected_count.add(3);
let expected_sum = MetricValue::Count {
name: "my_counter".into(),
count: expected_count,
};
assert_eq!(metrics.sum(|_| true), Some(expected_sum));
} | rust_cleaned_test_functions.jsonl/28184 | {
"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,
10160,
368,
341,
286,
1077,
16734,
284,
30928,
20485,
27328,
1649,
486,
931,
1428,
286,
1077,
1760,
16,
284,
52458,
3297,
486,
931,
2099,
43262,
340,
310,
659,
4197,
5921,
6106,
445,
7975,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_csv() {
let schema = Schema::new(vec![
Field::new("c1", DataType::Utf8, false),
Field::new("c2", DataType::Float64, true),
Field::new("c3", DataType::UInt32, false),
Field::new("c4", DataType::Boolean, true),
Field::new("c5", DataType::Timestamp(TimeUnit::Millisecond, None), true),
Field::new("c6", DataType::Time32(TimeUnit::Second), false),
]);
let c1 = StringArray::from(vec![
"Lorem ipsum dolor sit amet",
"consectetur adipiscing elit",
"sed do eiusmod tempor",
]);
let c2 = PrimitiveArray::<Float64Type>::from(vec![
Some(123.564532),
None,
Some(-556132.25),
]);
let c3 = PrimitiveArray::<UInt32Type>::from(vec![3, 2, 1]);
let c4 = PrimitiveArray::<BooleanType>::from(vec![Some(true), Some(false), None]);
let c5 = TimestampMillisecondArray::from_opt_vec(
vec![None, Some(1555584887378), Some(1555555555555)],
None,
);
let c6 = Time32SecondArray::from(vec![1234, 24680, 85563]);
let batch = RecordBatch::try_new(
Arc::new(schema),
vec![
Arc::new(c1),
Arc::new(c2),
Arc::new(c3),
Arc::new(c4),
Arc::new(c5),
Arc::new(c6),
],
)
.unwrap();
let file = get_temp_file("columns.csv", &[]);
let mut writer = Writer::new(file);
let batches = vec![&batch, &batch];
for batch in batches {
writer.write(batch).unwrap();
}
// check that file was written successfully
let mut file = File::open("target/debug/testdata/columns.csv").unwrap();
let mut buffer: Vec<u8> = vec![];
file.read_to_end(&mut buffer).unwrap();
assert_eq!(
r#"c1,c2,c3,c4,c5,c6
Lorem ipsum dolor sit amet,123.564532,3,true,,00:20:34
consectetur adipiscing elit,,2,false,2019-04-18T10:54:47.378000000,06:51:20
sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03
Lorem ipsum dolor sit amet,123.564532,3,true,,00:20:34
consectetur adipiscing elit,,2,false,2019-04-18T10:54:47.378000000,06:51:20
sed do eiusmod tempor,-556132.25,1,,2019-04-18T02:45:55.555000000,23:46:03
"#
.to_string(),
String::from_utf8(buffer).unwrap()
);
} | rust_cleaned_test_functions.jsonl/39022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
14020,
368,
341,
286,
1077,
10802,
284,
12539,
486,
931,
25592,
90515,
310,
8601,
486,
931,
445,
66,
16,
497,
33172,
486,
38980,
23,
11,
895,
1326,
310,
8601,
486,
931,
445,
66,
17,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_multiple_tabs_args() {
new_ucmd!()
.args(&["--tabs=3", "--tabs=6", "--tabs=9"])
.pipe_in("a\tb\tc\td\te")
.succeeds()
.stdout_is("a b c d e");
} | rust_cleaned_test_functions.jsonl/121793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
57953,
8384,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
30993,
28,
18,
497,
14482,
30993,
28,
21,
497,
14482,
30993,
28,
24,
14108,
286,
659,
13768,
1243,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stdin_nonprinting_and_tabs() {
new_ucmd!()
.args(&["-t"])
.pipe_in("\t\0\n")
.succeeds()
.stdout_only("^I^@\n");
} | rust_cleaned_test_functions.jsonl/90937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
21637,
98831,
8378,
57953,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
83,
14108,
286,
659,
13768,
1243,
4921,
83,
59,
15,
1699,
1138,
286,
659,
82,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_num_levels() {
let path = tempdir_with_prefix("_rust_rocksdb_test_set_num_levels");
let mut opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
opts.create_if_missing(true);
cf_opts.set_num_levels(2);
assert_eq!(2, cf_opts.get_num_levels());
let db = DB::open_cf(
opts,
path.path().to_str().unwrap(),
vec![("default", cf_opts)],
)
.unwrap();
drop(db);
} | rust_cleaned_test_functions.jsonl/34081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
4273,
37819,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
4452,
2602,
4273,
37819,
797,
262,
1077,
5206,
12185,
284,
5952,
3798,
486,
931,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accounts_locks_multithreaded() {
let counter = Arc::new(AtomicU64::new(0));
let exit = Arc::new(AtomicBool::new(false));
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
let account0 = Account::new(1, 0, &Pubkey::default());
let account1 = Account::new(2, 0, &Pubkey::default());
let account2 = Account::new(3, 0, &Pubkey::default());
let accounts = Accounts::new(Vec::new());
accounts.store_slow(0, &keypair0.pubkey(), &account0);
accounts.store_slow(0, &keypair1.pubkey(), &account1);
accounts.store_slow(0, &keypair2.pubkey(), &account2);
let accounts_arc = Arc::new(accounts);
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let readonly_message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![keypair0.pubkey(), keypair1.pubkey(), native_loader::id()],
Hash::default(),
instructions,
);
let readonly_tx = Transaction::new(&[&keypair0], readonly_message, Hash::default());
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let writable_message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![keypair1.pubkey(), keypair2.pubkey(), native_loader::id()],
Hash::default(),
instructions,
);
let writable_tx = Transaction::new(&[&keypair1], writable_message, Hash::default());
let counter_clone = counter.clone();
let accounts_clone = accounts_arc.clone();
let exit_clone = exit.clone();
thread::spawn(move || {
let counter_clone = counter_clone.clone();
let exit_clone = exit_clone.clone();
loop {
let txs = vec![writable_tx.clone()];
let results = accounts_clone.clone().lock_accounts(&txs, None);
for result in results.iter() {
if result.is_ok() {
counter_clone.clone().fetch_add(1, Ordering::SeqCst);
}
}
accounts_clone.unlock_accounts(&txs, None, &results);
if exit_clone.clone().load(Ordering::Relaxed) {
break;
}
}
});
let counter_clone = counter.clone();
for _ in 0..5 {
let txs = vec![readonly_tx.clone()];
let results = accounts_arc.clone().lock_accounts(&txs, None);
if results[0].is_ok() {
let counter_value = counter_clone.clone().load(Ordering::SeqCst);
thread::sleep(time::Duration::from_millis(50));
assert_eq!(counter_value, counter_clone.clone().load(Ordering::SeqCst));
}
accounts_arc.unlock_accounts(&txs, None, &results);
thread::sleep(time::Duration::from_millis(50));
}
exit.store(true, Ordering::Relaxed);
} | rust_cleaned_test_functions.jsonl/50624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
9818,
82,
26290,
410,
878,
291,
368,
341,
286,
1077,
5546,
284,
19689,
486,
931,
7,
65857,
52,
21,
19,
486,
931,
7,
15,
1106,
286,
1077,
4869,
284,
19689,
486,
931,
7,
65857,
11233,
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... | 7 |
#[test]
fn test_emit_jcc_greater_or_equal() {
let mut buf = MacroAssembler::new();
let lbl = buf.create_label();
emit_jcc(&mut buf, CondCode::GreaterEq, lbl);
emit_nop(&mut buf);
buf.bind_label(lbl);
assert_eq!(vec![0x0f, 0x8D, 1, 0, 0, 0, 0x90], buf.data());
} | rust_cleaned_test_functions.jsonl/85428 | {
"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,
69082,
5374,
638,
97994,
8734,
11478,
368,
341,
286,
1077,
5206,
6607,
284,
53317,
77858,
486,
931,
543,
286,
1077,
16421,
284,
6607,
2520,
6106,
543,
286,
16691,
5374,
638,
2099,
6984,
6607,
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_update_twin_fails_if_signed_by_someone_else() {
ExternalityBuilder::build().execute_with(|| {
let document = "some_link".as_bytes().to_vec();
let hash = "some_hash".as_bytes().to_vec();
assert_ok!(TfgridModule::user_accept_tc(
Origin::signed(alice()),
document,
hash,
));
let mut ip = "some_ip".as_bytes().to_vec();
assert_ok!(TfgridModule::create_twin(Origin::signed(alice()), ip));
ip = "some_other_ip".as_bytes().to_vec();
assert_noop!(
TfgridModule::update_twin(Origin::signed(bob()), ip),
Error::<TestRuntime>::TwinNotExists
);
});
} | rust_cleaned_test_functions.jsonl/35364 | {
"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,
8882,
528,
7526,
761,
6209,
11119,
55617,
3710,
61855,
603,
62628,
368,
341,
262,
1374,
4160,
2719,
3297,
486,
5834,
1005,
10257,
6615,
79453,
341,
286,
1077,
2197,
284,
330,
14689,
7233,
3263,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hash_fromstr() {
let hash = hash(&[1u8]);
let mut hash_base58_str = bs58::encode(hash).into_string();
assert_eq!(hash_base58_str.parse::<Hash>(), Ok(hash));
hash_base58_str.push_str(&bs58::encode(hash.0).into_string());
assert_eq!(
hash_base58_str.parse::<Hash>(),
Err(ParseHashError::WrongSize)
);
hash_base58_str.truncate(hash_base58_str.len() / 2);
assert_eq!(hash_base58_str.parse::<Hash>(), Ok(hash));
hash_base58_str.truncate(hash_base58_str.len() / 2);
assert_eq!(
hash_base58_str.parse::<Hash>(),
Err(ParseHashError::WrongSize)
);
let input_too_big = bs58::encode(&[0xffu8; HASH_BYTES + 1]).into_string();
assert!(input_too_big.len() > MAX_BASE58_LEN);
assert_eq!(
input_too_big.parse::<Hash>(),
Err(ParseHashError::WrongSize)
);
let mut hash_base58_str = bs58::encode(hash.0).into_string();
assert_eq!(hash_base58_str.parse::<Hash>(), Ok(hash));
// throw some non-base58 stuff in there
hash_base58_str.replace_range(..1, "I");
assert_eq!(
hash_base58_str.parse::<Hash>(),
Err(ParseHashError::Invalid)
);
} | rust_cleaned_test_functions.jsonl/3943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 680
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
5673,
495,
368,
341,
286,
1077,
5175,
284,
5175,
2099,
58,
16,
84,
23,
10149,
286,
1077,
5206,
5175,
7651,
20,
23,
2895,
284,
17065,
20,
23,
486,
6180,
27580,
568,
18122,
3904,
1428,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_my_lesser_date() {
let my = Version::new("1.0.0-nightly.20180101T013059Z").unwrap();
let other = Version::new("1.0.0-nightly.20190101T013059Z").unwrap();
assert_eq!(my < other, true);
assert_eq!(my > other, false);
assert_eq!(my == other, false);
} | rust_cleaned_test_functions.jsonl/54498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35686,
62,
642,
799,
4164,
368,
341,
286,
1077,
847,
284,
6079,
486,
931,
445,
16,
13,
15,
13,
15,
44327,
398,
13,
17,
15,
16,
23,
15,
16,
15,
16,
51,
15,
16,
18,
15,
20,
24,
57,
1827,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_show() {
use super::*;
assert_eq!(format!("{}", USER_READ), "0400");
assert_eq!(format!("{}", USER_FILE), "0644");
assert_eq!(format!("{}", USER_EXEC), "0755");
assert_eq!(format!("{}", USER_RWX), "0700");
assert_eq!(format!("{}", GROUP_RWX), "0070");
assert_eq!(format!("{}", OTHER_RWX), "0007");
assert_eq!(format!("{}", ALL_PERMISSIONS), "0777");
assert_eq!(format!("{}", USER_READ | USER_WRITE | OTHER_WRITE), "0602");
} | rust_cleaned_test_functions.jsonl/32748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15267,
368,
341,
286,
990,
2256,
79304,
286,
2060,
10714,
10297,
2243,
79878,
13872,
13117,
701,
330,
15,
19,
15,
15,
797,
286,
2060,
10714,
10297,
2243,
79878,
13872,
8087,
701,
330,
15,
21,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interval_heap_vs_vec_deque() {
let size = 10000;
use rand::{Rng, SeedableRng, StdRng};
use std::collections::VecDeque;
let mut rng = StdRng::from_seed(&[1, 2, 3]);
let mut interval_heap = IntervalHeap::new();
let mut vec = Vec::new();
for _ in 0..size {
let x = rng.next_u64();
interval_heap.push(x);
vec.push(x);
}
vec.sort();
let mut vec_deque = vec.into_iter().collect::<VecDeque<_>>();
for _ in 0..size + 1 {
if rng.next_f64() < 0.5 {
assert_eq!(interval_heap.pop_min(), vec_deque.pop_front());
} else {
assert_eq!(interval_heap.pop_max(), vec_deque.pop_back());
}
}
} | rust_cleaned_test_functions.jsonl/92728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20541,
33059,
42434,
13251,
2259,
591,
368,
341,
262,
1077,
1379,
284,
220,
16,
15,
15,
15,
15,
401,
262,
990,
10382,
22964,
49,
968,
11,
35822,
480,
49,
968,
11,
42517,
49,
968,
2440,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_is_exhausted() {
let mut addrmgr =
AddressManager::new(Config::default(), fastrand::Rng::new(), HashMap::new(), ());
let time = LocalTime::now();
let source = Source::Dns;
let services = ServiceFlags::NETWORK;
addrmgr.initialize(LocalTime::now());
addrmgr.insert(
[(
time.block_time(),
Address::new(&net::SocketAddr::from(([33, 33, 33, 33], 8333)), services),
)],
source,
);
assert!(!addrmgr.is_exhausted());
addrmgr.peer_connected(&([33, 33, 33, 33], 8333).into(), LocalTime::now());
assert!(addrmgr.is_exhausted());
addrmgr.insert(
[(
time.block_time(),
Address::new(&net::SocketAddr::from(([44, 44, 44, 44], 8333)), services),
)],
source,
);
assert!(!addrmgr.is_exhausted());
// addresses.
addrmgr.peer_attempted(&([44, 44, 44, 44], 8333).into(), LocalTime::now());
assert!(addrmgr.is_exhausted());
addrmgr.peer_connected(&([44, 44, 44, 44], 8333).into(), LocalTime::now());
addrmgr.peer_negotiated(
&([44, 44, 44, 44], 8333).into(),
services,
Link::Outbound,
LocalTime::now(),
);
addrmgr.peer_disconnected(
&([44, 44, 44, 44], 8333).into(),
DisconnectReason::PeerTimeout("timeout"),
);
assert!(!addrmgr.is_exhausted());
assert!(addrmgr.sample(services).is_some());
assert!(addrmgr.sample(services).is_none());
assert!(addrmgr.is_exhausted());
addrmgr.insert(
[(
time.block_time(),
Address::new(&net::SocketAddr::from(([55, 55, 55, 55], 8333)), services),
)],
source,
);
addrmgr.sample(services);
addrmgr.peer_attempted(&([55, 55, 55, 55], 8333).into(), LocalTime::now());
addrmgr.peer_connected(&([55, 55, 55, 55], 8333).into(), LocalTime::now());
addrmgr.peer_disconnected(
&([55, 55, 55, 55], 8333).into(),
DisconnectReason::PeerTimeout("timeout"),
);
assert!(addrmgr.sample(services).is_none());
} | rust_cleaned_test_functions.jsonl/79208 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
2702,
15074,
291,
368,
341,
286,
1077,
5206,
912,
8719,
901,
4035,
310,
9177,
2043,
486,
931,
33687,
486,
2258,
1507,
2218,
85881,
486,
49,
968,
486,
931,
1507,
10528,
486,
931,
1507,
4932... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_icmp_echo_socket_worker_reply_over_capacity() {
let mut worker = create_worker_with_capacity(1);
let first_packet = EchoPacket { sequence_num: 1, payload: vec![0, 1, 2, 3, 4] };
let second_packet = EchoPacket { sequence_num: 2, payload: vec![5, 6, 7, 8, 9] };
worker.handle_reply(first_packet.clone()).unwrap();
worker.handle_reply(second_packet.clone()).unwrap_err();
worker.watch(TestResponder { expected: Ok(first_packet) }).unwrap();
worker.watch(TestResponder { expected: Err(zx::Status::IO_OVERRUN) }).unwrap();
} | rust_cleaned_test_functions.jsonl/98598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32747,
1307,
68628,
19555,
40385,
15323,
15431,
35603,
368,
341,
286,
1077,
5206,
11864,
284,
1855,
40385,
6615,
35603,
7,
16,
626,
286,
1077,
1156,
21078,
284,
37806,
16679,
314,
8500,
4273,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_distance_from_zero() {
let p = super::Point{x:3.0, y:4.0};
assert_eq!(p.distance_from_zero(), 5.0);
} | rust_cleaned_test_functions.jsonl/60438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19464,
5673,
19359,
368,
341,
414,
1077,
281,
284,
2256,
486,
2609,
45340,
25,
18,
13,
15,
11,
379,
25,
19,
13,
15,
2440,
414,
2060,
10714,
10297,
79,
31974,
5673,
19359,
1507,
220,
20,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_status_transtition() {
let mut status = ContainerStatus::new();
let status_table: [ContainerState; 4] = [
ContainerState::Created,
ContainerState::Running,
ContainerState::Paused,
ContainerState::Stopped,
];
for s in status_table.iter() {
let pre_status = status.status();
status.transition(*s);
assert_eq!(pre_status, status.pre_status);
}
} | rust_cleaned_test_functions.jsonl/16612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
3547,
61194,
680,
368,
341,
286,
1077,
5206,
2639,
284,
9678,
2522,
486,
931,
543,
286,
1077,
2639,
5237,
25,
508,
4502,
1397,
26,
220,
19,
60,
284,
2278,
310,
9678,
1397,
486,
11694,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_missing_target_redirects_to_search() {
wrapper(|env| {
env.fake_release()
.name("winapi")
.version("0.3.9")
.rustdoc_file("winapi/macro.ENUM.html")
.create()?;
assert_redirect(
"/winapi/0.3.9/x86_64-unknown-linux-gnu/winapi/macro.ENUM.html",
"/winapi/0.3.9/winapi/macro.ENUM.html",
env.frontend(),
)?;
assert_not_found("/winapi/0.3.9/winapi/struct.not_here.html", env.frontend())?;
Ok(())
})
} | rust_cleaned_test_functions.jsonl/57025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
11123,
30043,
82,
2346,
10716,
368,
341,
286,
13261,
22428,
3160,
91,
341,
310,
6105,
94624,
24577,
741,
394,
659,
606,
445,
7526,
2068,
1138,
394,
659,
4366,
445,
15,
13,
18,
13,
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... | 4 |
#[test]
fn test_ser_de_small_array_box() {
let vec: Vec<u8> = (0..100).collect();
let mut tokens = Vec::new();
for len in 0..vec.len() {
let slice = &vec[..len];
let array = SmallArrayBox::new(slice.iter().copied());
tokens.reserve_exact(len + 2);
tokens.push(Token::Seq { len: Some(len) });
for i in 0..(len as u8) {
tokens.push(Token::U8(i));
}
tokens.push(Token::SeqEnd);
assert_tokens(&array, &tokens);
tokens.clear();
}
} | rust_cleaned_test_functions.jsonl/126586 | {
"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,
75861,
2259,
31966,
3858,
10194,
368,
341,
286,
1077,
7486,
25,
11312,
34837,
23,
29,
284,
320,
15,
496,
16,
15,
15,
568,
17384,
1428,
286,
1077,
5206,
11211,
284,
11312,
486,
931,
1428,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_eval_pieces() {
// It's nice if an operation and its arguments can fit on a single
// line in the test program.
use self::AssemblerEntry::*;
use crate::constants::*;
#[rustfmt::skip]
let program = [
Op(DW_OP_reg3),
Op(DW_OP_piece), Uleb(4),
Op(DW_OP_reg4),
Op(DW_OP_piece), Uleb(2),
];
let result = [
Piece {
size_in_bits: Some(32),
bit_offset: None,
location: Location::Register {
register: Register(3),
},
},
Piece {
size_in_bits: Some(16),
bit_offset: None,
location: Location::Register {
register: Register(4),
},
},
];
check_eval(&program, Ok(&result), encoding4());
#[rustfmt::skip]
let program = [
Op(DW_OP_reg0),
Op(DW_OP_piece), Uleb(4),
Op(DW_OP_piece), Uleb(4),
Op(DW_OP_addr), U32(0x7fff_ffff),
Op(DW_OP_piece), Uleb(4),
];
let result = [
Piece {
size_in_bits: Some(32),
bit_offset: None,
location: Location::Register {
register: Register(0),
},
},
Piece {
size_in_bits: Some(32),
bit_offset: None,
location: Location::Empty,
},
Piece {
size_in_bits: Some(32),
bit_offset: None,
location: Location::Address {
address: 0x7fff_ffff,
},
},
];
check_eval_with_args(
&program,
Ok(&result),
encoding4(),
None,
None,
None,
|eval, mut result| {
while result != EvaluationResult::Complete {
result = match result {
EvaluationResult::RequiresRelocatedAddress(address) => {
eval.resume_with_relocated_address(address)?
}
_ => panic!(),
};
}
Ok(result)
},
);
#[rustfmt::skip]
let program = [
Op(DW_OP_implicit_value), Uleb(5),
U8(23), U8(24), U8(25), U8(26), U8(0),
];
const BYTES: &[u8] = &[23, 24, 25, 26, 0];
let result = [Piece {
size_in_bits: None,
bit_offset: None,
location: Location::Bytes {
value: EndianSlice::new(BYTES, LittleEndian),
},
}];
check_eval(&program, Ok(&result), encoding4());
#[rustfmt::skip]
let program = [
Op(DW_OP_lit7),
Op(DW_OP_stack_value),
Op(DW_OP_bit_piece), Uleb(5), Uleb(0),
Op(DW_OP_bit_piece), Uleb(3), Uleb(0),
];
let result = [
Piece {
size_in_bits: Some(5),
bit_offset: Some(0),
location: Location::Value {
value: Value::Generic(7),
},
},
Piece {
size_in_bits: Some(3),
bit_offset: Some(0),
location: Location::Empty,
},
];
check_eval(&program, Ok(&result), encoding4());
#[rustfmt::skip]
let program = [
Op(DW_OP_lit7),
];
let result = [Piece {
size_in_bits: None,
bit_offset: None,
location: Location::Address { address: 7 },
}];
check_eval(&program, Ok(&result), encoding4());
#[rustfmt::skip]
let program = [
Op(DW_OP_implicit_pointer), U32(0x1234_5678), Sleb(0x123),
];
let result = [Piece {
size_in_bits: None,
bit_offset: None,
location: Location::ImplicitPointer {
value: DebugInfoOffset(0x1234_5678),
byte_offset: 0x123,
},
}];
check_eval(&program, Ok(&result), encoding4());
#[rustfmt::skip]
let program = [
Op(DW_OP_reg3),
Op(DW_OP_piece), Uleb(4),
Op(DW_OP_reg4),
];
check_eval(&program, Err(Error::InvalidPiece), encoding4());
#[rustfmt::skip]
let program = [
Op(DW_OP_reg3),
Op(DW_OP_piece), Uleb(4),
Op(DW_OP_lit0),
];
check_eval(&program, Err(Error::InvalidPiece), encoding4());
} | rust_cleaned_test_functions.jsonl/45774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2916
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
83479,
368,
341,
286,
442,
1084,
594,
6419,
421,
458,
5666,
323,
1181,
5977,
646,
4946,
389,
264,
3175,
198,
286,
442,
1555,
304,
279,
1273,
2025,
624,
286,
990,
656,
486,
77858,
5874,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inversion() {
let a = Fp2 {
c0: Fp::from_raw_unchecked([
0x1128ecad67549455,
0x9e7a1cff3a4ea1a8,
0xeb208d51e08bcf27,
0xe98ad40811f5fc2b,
0x736c3a59232d511d,
0x10acd42d29cfcbb6,
]),
c1: Fp::from_raw_unchecked([
0xd328e37cc2f58d41,
0x948df0858a605869,
0x6032f9d56f93a573,
0x2be483ef3fffdc87,
0x30ef61f88f483c2a,
0x1333f55a35725be0,
]),
};
let b = Fp2 {
c0: Fp::from_raw_unchecked([
0x581a1333d4f48a6,
0x58242f6ef0748500,
0x292c955349e6da5,
0xba37721ddd95fcd0,
0x70d167903aa5dfc5,
0x11895e118b58a9d5,
]),
c1: Fp::from_raw_unchecked([
0xeda09d2d7a85d17,
0x8808e137a7d1a2cf,
0x43ae2625c1ff21db,
0xf85ac9fdf7a74c64,
0x8fccdda5b8da9738,
0x8e84f0cb32cd17d,
]),
};
assert_eq!(a.invert().unwrap(), b);
assert!(Fp2::zero().invert().is_none().unwrap_u8() == 1);
} | rust_cleaned_test_functions.jsonl/97993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 970
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
4366,
368,
341,
286,
1077,
264,
284,
434,
79,
17,
341,
310,
272,
15,
25,
434,
79,
486,
1499,
16067,
4907,
7549,
8956,
394,
220,
15,
87,
16,
16,
17,
23,
757,
329,
21,
22,
20,
19,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_ie() {
let bytes = [48, 6, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06];
let ie = RawInformationElement::parse(&bytes).unwrap();
assert_eq!(ie.identifier, 48u8);
assert_eq!(ie.data.len(), 6);
assert_eq!(ie.data, &bytes[2..]);
} | rust_cleaned_test_functions.jsonl/37529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
62203,
368,
341,
286,
1077,
5820,
284,
508,
19,
23,
11,
220,
21,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
19,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_oam_addr_increment() {
let mut sprites = Sprites::new();
sprites.increment_high_n();
assert_eq!(sprites.oam_addr, 4);
sprites.increment_high_n();
assert_eq!(sprites.oam_addr, 8);
sprites.increment_low_m();
sprites.increment_low_m();
sprites.increment_low_m();
assert_eq!(sprites.oam_addr, 11);
// test m overflow
sprites.increment_low_m();
assert_eq!(sprites.oam_addr, 8);
sprites.increment_high_n();
assert_eq!(sprites.oam_addr, 12);
sprites.oam_addr = 0;
for _i in 0..63 {
sprites.increment_high_n();
}
assert_eq!(sprites.oam_addr, 252);
// test n overflow
sprites.increment_high_n();
assert_eq!(sprites.oam_addr, 0);
} | rust_cleaned_test_functions.jsonl/74929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14179,
309,
7387,
51482,
368,
341,
197,
10217,
5206,
46757,
284,
15515,
3611,
486,
931,
543,
197,
1903,
28879,
56936,
22680,
1089,
543,
197,
6948,
10714,
10297,
87470,
14439,
309,
7387,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_cases() {
assert_eq!(max_score(9, 25), 32);
assert_eq!(max_score(10, 1618), 8317);
assert_eq!(max_score(13, 7999), 146_373);
assert_eq!(max_score(17, 1104), 2764);
assert_eq!(max_score(21, 6111), 54718);
assert_eq!(max_score(30, 5807), 37305);
} | rust_cleaned_test_functions.jsonl/30049 | {
"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,
41427,
368,
341,
286,
2060,
10714,
10297,
2810,
10405,
7,
24,
11,
220,
17,
20,
701,
220,
18,
17,
317,
286,
2060,
10714,
10297,
2810,
10405,
7,
16,
15,
11,
220,
16,
21,
16,
23,
701,
220,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_disease_prediction() {
let service = DiseasePrediction::new();
let x: [f32; 8] = [0.1, -0.23, 1.1, 0.98, 5.6, -0.9, -5.0, 2.4];
let ciphers = service.encrypt(&x);
let result = service.compute(&ciphers);
let ground_truth = [inner_product_result(&x, &service.y1), inner_product_result(&x, &service.y2)];
println!("Truth: {:?}", ground_truth);
println!("Result: {:?}", result);
} | rust_cleaned_test_functions.jsonl/94397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
55307,
51446,
368,
341,
286,
1077,
2473,
284,
30874,
88279,
486,
931,
543,
286,
1077,
856,
25,
508,
69,
18,
17,
26,
220,
23,
60,
284,
508,
15,
13,
16,
11,
481,
15,
13,
17,
18,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_utf8string() {
assert_parses::<Utf8String>(&[
(Ok(Utf8String::new("abc")), b"\x0c\x03abc"),
(Ok(Utf8String::new(")")), b"\x0c\x01)"),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x0c\x01\xff",
),
])
} | rust_cleaned_test_functions.jsonl/40832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
39453,
23,
917,
368,
341,
286,
2060,
77113,
288,
27638,
38980,
23,
703,
44784,
9640,
310,
320,
11578,
12317,
8935,
23,
703,
486,
931,
445,
13683,
35674,
293,
11934,
87,
15,
66,
3462,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_value() {
assert!(valid_value("example"));
assert!(valid_value("foo bar"));
assert!(valid_value(" foobar "));
assert!(valid_value(" foo\tbar "));
assert!(valid_value(" foo~"));
assert!(valid_value(" !bar"));
assert!(valid_value(" "));
assert!(!valid_value(" \nfoo"));
assert!(!valid_value("foo\x7F"));
} | rust_cleaned_test_functions.jsonl/15935 | {
"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,
8337,
3142,
368,
341,
262,
2060,
10297,
1891,
3142,
445,
8687,
4010,
262,
2060,
10297,
1891,
3142,
445,
7975,
3619,
4010,
262,
2060,
10297,
1891,
3142,
445,
11756,
31393,
60240,
262,
2060,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trivial_types() {
let out: Vec<String> = rune! {
use std::any::type_name_of_val;
pub fn main() {
[
type_name_of_val(true),
type_name_of_val(1),
type_name_of_val(1.0),
type_name_of_val('c'),
type_name_of_val("s"),
type_name_of_val(Some("s")),
]
}
};
assert_eq!(
out,
[
"::std::bool".to_owned(),
"::std::int".to_owned(),
"::std::float".to_owned(),
"::std::char".to_owned(),
"::std::string::String".to_owned(),
"::std::option::Option".to_owned()
]
)
} | rust_cleaned_test_functions.jsonl/60577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26658,
9763,
368,
341,
262,
1077,
700,
25,
11312,
3464,
29,
284,
63499,
0,
341,
286,
990,
1460,
486,
3767,
486,
1313,
1269,
3575,
6189,
280,
286,
6675,
5168,
1887,
368,
341,
310,
2278,
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_equal() {
let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default()));
let v1 = VersionedCrdsValue::new(val.clone(), Cursor::default(), 1);
let v2 = VersionedCrdsValue::new(val, Cursor::default(), 1);
assert_eq!(v1, v2);
assert!(!(v1 != v2));
assert!(!overrides(&v1.value, &v2));
assert!(!overrides(&v2.value, &v1));
} | rust_cleaned_test_functions.jsonl/10462 | {
"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,
11478,
368,
341,
286,
1077,
1044,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
1731,
99102,
1731,
486,
2258,
7392,
286,
1077,
348,
16,
284,
6079,
291,
16001,
5356,
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_cliprect_equivalence() {
let cr1 = ClipRect {
min: Pt { x: 1, y: 2 },
max: Pt { x: 8, y: 9 },
};
// Called properly:
let cr2 = ClipRect::new(1, 2, 8, 9);
// Called with mixed up corners that should get auto-corrected
let cr3 = ClipRect::new(8, 2, 1, 9);
let cr4 = ClipRect::new(1, 9, 8, 2);
assert_eq!(cr1, cr2);
assert_eq!(cr2, cr3);
assert_eq!(cr3, cr4);
} | rust_cleaned_test_functions.jsonl/104243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44728,
2851,
41443,
88790,
368,
341,
286,
1077,
1560,
16,
284,
29692,
4415,
341,
310,
1308,
25,
51070,
314,
856,
25,
220,
16,
11,
379,
25,
220,
17,
1153,
310,
1932,
25,
51070,
314,
856,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_batch_row_limit() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:4"), 3),
(4, Some("name:3"), 1),
(5, Some("name:1"), 4),
];
let batch_row_limit = 3;
let chunk_datum_limit = batch_row_limit * 3; // we have 3 fields.
let product = ProductTable::new();
let (_, endpoint) = {
let engine = TestEngineBuilder::new().build().unwrap();
let mut cfg = Config::default();
cfg.end_point_batch_row_limit = batch_row_limit;
init_data_with_details(
Context::new(),
engine,
&product,
&data,
true,
&cfg,
&readpool::Config::default_for_test(),
)
};
// for dag selection
let req = DAGSelect::from(&product.table).build();
let mut resp = handle_select(&endpoint, req);
check_chunk_datum_count(resp.get_chunks(), chunk_datum_limit);
let spliter = DAGChunkSpliter::new(resp.take_chunks().into_vec(), 3);
for (row, (id, name, cnt)) in spliter.zip(data) {
let name_datum = name.map(|s| s.as_bytes()).into();
let expected_encoded =
datum::encode_value(&[Datum::I64(id), name_datum, cnt.into()]).unwrap();
let result_encoded = datum::encode_value(&row).unwrap();
assert_eq!(result_encoded, &*expected_encoded);
}
} | rust_cleaned_test_functions.jsonl/34843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 656
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
8530,
14763,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
19,
3975,
220,
18,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_register_string_helpers() -> Result<(), Box<dyn Error>> {
assert_helpers(
"Hello foo-bars",
vec![
("to_lower_case", "hello foo-bars"),
("to_upper_case", "HELLO FOO-BARS"),
("to_camel_case", "helloFooBars"),
("to_pascal_case", "HelloFooBars"),
("to_snake_case", "hello_foo_bars"),
("to_screaming_snake_case", "HELLO_FOO_BARS"),
("to_kebab_case", "hello-foo-bars"),
("to_train_case", "Hello-Foo-Bars"),
("to_sentence_case", "Hello foo bars"),
("to_title_case", "Hello Foo Bars"),
("to_class_case", "HelloFooBar"),
("to_table_case", "hello_foo_bars"),
("to_plural", "bars"),
("to_singular", "bar"),
],
)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/35000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14000,
3904,
54473,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
2060,
54473,
1006,
310,
330,
9707,
15229,
82827,
756,
310,
7486,
90515,
394,
3489,
983,
30425,
19096,
497,
330,
14990,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_save_pbm() {
let data = [
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 0],
[1, 0, 0, 0, 1, 0],
[0, 1, 1, 1, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
];
save_pbm("./tests/output/j.pbm", data, Mode::Binary).unwrap();
assert!(diff_file("./tests/output/j.pbm", "./tests/templates/j.pbm"));
} | rust_cleaned_test_functions.jsonl/115527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15376,
620,
29307,
368,
341,
262,
1077,
821,
284,
2278,
286,
508,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
16,
11,
220,
15,
1259,
286,
508,
15,
11,
220,
15,
11,
220,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_adaptive_comp_simple() -> Fallible<()> {
let meas1 = make_dummy_meas::<i32>();
let meas2 = make_dummy_meas::<i32>();
let data = 999;
let d_in_budget = 1.0;
let d_out_budget = 1.0;
let adaptive = make_adaptive_composition(meas1.input_domain.clone(), meas1.output_domain.clone(), meas1.input_metric.clone(), meas1.output_measure.clone(), d_in_budget, d_out_budget);
let mut queryable = adaptive.function.eval(&data)?;
let res1 = queryable.eval(&(meas1, d_out_budget / 2.0))?;
assert_eq!(res1, 999);
let res2 = queryable.eval(&(meas2, d_out_budget / 2.0))?;
assert_eq!(res2, 999);
Ok(())
} | rust_cleaned_test_functions.jsonl/115909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10027,
27781,
18177,
30015,
368,
1464,
14785,
1238,
71698,
341,
286,
1077,
6893,
16,
284,
1281,
60321,
95786,
27638,
72,
18,
17,
3913,
286,
1077,
6893,
17,
284,
1281,
60321,
95786,
27638,
72,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_rotate_linestring() {
let linestring = line_string![
(x: 0.0, y: 0.0),
(x: 5.0, y: 5.0),
(x: 10.0, y: 10.0)
];
let rotated = linestring.rotate(-45.0);
// results agree with Shapely / GEOS
assert_eq!(
rotated,
line_string![
(x: -2.0710678118654755, y: 5.0),
(x: 5.0, y: 5.0),
(x: 12.071067811865476, y: 5.0)
]
);
} | rust_cleaned_test_functions.jsonl/46757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
24606,
65040,
368,
341,
286,
1077,
9805,
65040,
284,
1555,
3904,
90515,
310,
320,
87,
25,
220,
15,
13,
15,
11,
379,
25,
220,
15,
13,
15,
1326,
310,
320,
87,
25,
220,
20,
13,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partition_fromstr() {
let p = "0FC63DAF-8483-4772-8E79-3D69D8477DE4";
let t = Type::from_str(p).unwrap();
println!("result: {:?}", t);
assert_eq!(t, LINUX_FS);
} | rust_cleaned_test_functions.jsonl/80648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43840,
5673,
495,
368,
341,
262,
1077,
281,
284,
330,
15,
6754,
21,
18,
6352,
37,
12,
23,
19,
23,
18,
12,
19,
22,
22,
17,
12,
23,
36,
22,
24,
12,
18,
35,
21,
24,
35,
23,
19,
22,
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_zip_decode() {
let mut input = String::new();
let _ = File::open("tests/resources/test.zip.eml").unwrap().read_to_string(&mut input);
let x = parse_report_message(&input).unwrap();
assert_eq!(get_expected_feedback(), x);
} | rust_cleaned_test_functions.jsonl/19276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
15227,
368,
341,
262,
1077,
5206,
1946,
284,
923,
486,
931,
543,
262,
1077,
716,
284,
2887,
486,
2508,
445,
23841,
38900,
12697,
20991,
9301,
75,
1827,
15454,
1005,
878,
2346,
3904,
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_hover_arg_impl_traits_has_goto_type_action() {
check_actions(
r#"
trait Foo {}
trait Bar<T> {}
struct S{}
fn foo(ar$0g: &impl Foo + Bar<S>) {}
"#,
expect![[r#"
[
GoToType(
[
HoverGotoTypeData {
mod_path: "test::Foo",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 0..12,
focus_range: 6..9,
name: "Foo",
kind: Trait,
description: "trait Foo",
},
},
HoverGotoTypeData {
mod_path: "test::Bar",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 13..28,
focus_range: 19..22,
name: "Bar",
kind: Trait,
description: "trait Bar<T>",
},
},
HoverGotoTypeData {
mod_path: "test::S",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 29..39,
focus_range: 36..37,
name: "S",
kind: Struct,
description: "struct S",
},
},
],
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1807
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
6057,
21007,
39693,
21778,
97732,
1819,
7931,
368,
341,
286,
1779,
25368,
1006,
310,
435,
2,
698,
29432,
33428,
5613,
29432,
4716,
3125,
29,
5613,
1235,
328,
31483,
8822,
15229,
37544,
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... | 1 |
#[test]
fn test_downcast_object() -> Result<()> {
impl PolarsObject for i32 {
fn type_name() -> &'static str {
"i32"
}
}
let ca = ObjectChunked::new_from_vec("a", vec![0i32, 1, 2]);
let s = ca.into_series();
let ca = s.as_any().downcast_ref::<ObjectChunked<i32>>().unwrap();
assert_eq!(*ca.get(0).unwrap(), 0);
assert_eq!(*ca.get(1).unwrap(), 1);
assert_eq!(*ca.get(2).unwrap(), 2);
Ok(())
} | rust_cleaned_test_functions.jsonl/69491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13998,
3829,
5314,
368,
1464,
5714,
71698,
341,
286,
11605,
3651,
1561,
1190,
369,
600,
18,
17,
341,
310,
5168,
943,
1269,
368,
1464,
30136,
1978,
607,
341,
394,
330,
72,
18,
17,
698,
310,
456... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delta_pack_unpack() {
let mut data = [0u32; 128];
let mut i = 1;
data.iter_mut().for_each(|x| {
*x = i * 128;
i += 1;
});
assert_eq!(data[127], 128 * 128);
let mut encoded = [0u8; 512];
let mut decoded = [0u32; 128];
let mut packer = SIMD128Packer::new(128);
SIMD128Packer::pack(&data, &mut encoded, 15);
SIMD128Packer::unpack(&encoded[..], &mut decoded, 15);
assert_128_array_eq!(&data, &decoded);
packer.delta_pack(&data, &mut encoded, 128, 14);
packer.delta_unpack(&encoded[..], &mut decoded, 128, 14);
assert_128_array_eq!(&data, &decoded);
} | rust_cleaned_test_functions.jsonl/19432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26710,
32995,
54889,
368,
341,
286,
1077,
5206,
821,
284,
508,
15,
84,
18,
17,
26,
220,
16,
17,
23,
935,
286,
1077,
5206,
600,
284,
220,
16,
280,
286,
821,
19471,
29523,
1005,
1958,
32046,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add() {
let mut w = test_writer();
let mut replica = test_replica();
let server_dir = TempDir::new().unwrap();
let mut server = test_server(&server_dir);
let settings = Settings::default();
// Note that the details of the actual sync are tested thoroughly in the taskchampion crate
execute(&mut w, &mut replica, &settings, &mut server).unwrap();
assert_eq!(&w.into_string(), "sync complete.\n")
} | rust_cleaned_test_functions.jsonl/132909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
286,
1077,
5206,
289,
284,
1273,
28908,
543,
286,
1077,
5206,
36954,
284,
1273,
25533,
15317,
543,
286,
1077,
3538,
4334,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_domain_type_enum() {
let ty = DomainType {
annotation: Default::default(),
id: "ty".to_string(),
r#type: Type::EnumString(vec!["bar".into()]),
};
let prog = Context::new_root(&Default::default())
.with_domain("foo")
.render_with(&ty);
let expect = quote! {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum Ty {
#[doc = "bar"]
#[serde(rename = "bar")]
Bar,
}
};
assert_eq(&prog, &expect);
} | rust_cleaned_test_functions.jsonl/26905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20111,
1819,
31054,
368,
341,
262,
1077,
13580,
284,
21070,
929,
341,
286,
21223,
25,
7899,
486,
2258,
3148,
286,
877,
25,
330,
1881,
3263,
983,
3904,
3148,
286,
435,
2,
1313,
25,
3990,
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... | 1 |
#[test]
fn test_finitedomain_2() {
// copy_before interval
let fd = FiniteDomain::from(1..=8);
let before = fd.copy_before(|x| *x > 6).unwrap();
assert_eq!(before.min(), 1);
assert_eq!(before.max(), 6);
let before = fd.copy_before(|x| *x < 0).unwrap();
assert_eq!(before, fd);
assert!(fd.copy_before(|x| *x > -1).is_none());
} | rust_cleaned_test_functions.jsonl/31708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39737,
1608,
3121,
62,
17,
368,
341,
286,
442,
2975,
23708,
9873,
198,
286,
1077,
12414,
284,
93619,
13636,
486,
1499,
7,
16,
496,
28,
23,
317,
286,
1077,
1573,
284,
12414,
12232,
23708,
22428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debugging_options_tracking_hash() {
let reference = Options::default();
let mut opts = Options::default();
macro_rules! untracked {
($name: ident, $non_default_value: expr) => {
opts.debugging_opts.$name = $non_default_value;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
};
}
// Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
// This list is in alphabetical order.
untracked!(ast_json, true);
untracked!(ast_json_noexpand, true);
untracked!(borrowck, String::from("other"));
untracked!(borrowck_stats, true);
untracked!(control_flow_guard, CFGuard::Checks);
untracked!(deduplicate_diagnostics, true);
untracked!(dep_tasks, true);
untracked!(dont_buffer_diagnostics, true);
untracked!(dump_dep_graph, true);
untracked!(dump_mir, Some(String::from("abc")));
untracked!(dump_mir_dataflow, true);
untracked!(dump_mir_dir, String::from("abc"));
untracked!(dump_mir_exclude_pass_number, true);
untracked!(dump_mir_graphviz, true);
untracked!(emit_stack_sizes, true);
untracked!(hir_stats, true);
untracked!(identify_regions, true);
untracked!(incremental_ignore_spans, true);
untracked!(incremental_info, true);
untracked!(incremental_verify_ich, true);
untracked!(input_stats, true);
untracked!(keep_hygiene_data, true);
untracked!(link_native_libraries, false);
untracked!(llvm_time_trace, true);
untracked!(ls, true);
untracked!(macro_backtrace, true);
untracked!(meta_stats, true);
untracked!(nll_facts, true);
untracked!(no_analysis, true);
untracked!(no_interleave_lints, true);
untracked!(no_leak_check, true);
untracked!(no_parallel_llvm, true);
untracked!(parse_only, true);
untracked!(perf_stats, true);
untracked!(polonius, true);
// `pre_link_arg` is omitted because it just forwards to `pre_link_args`.
untracked!(pre_link_args, vec![String::from("abc"), String::from("def")]);
untracked!(print_link_args, true);
untracked!(print_llvm_passes, true);
untracked!(print_mono_items, Some(String::from("abc")));
untracked!(print_region_graph, true);
untracked!(print_type_sizes, true);
untracked!(query_dep_graph, true);
untracked!(query_stats, true);
untracked!(save_analysis, true);
untracked!(self_profile, SwitchWithOptPath::Enabled(None));
untracked!(self_profile_events, Some(vec![String::new()]));
untracked!(span_free_formats, true);
untracked!(strip, Strip::None);
untracked!(terminal_width, Some(80));
untracked!(threads, 99);
untracked!(time, true);
untracked!(time_llvm_passes, true);
untracked!(time_passes, true);
untracked!(trace_macros, true);
untracked!(ui_testing, true);
untracked!(unpretty, Some("expanded".to_string()));
untracked!(unstable_options, true);
untracked!(verbose, true);
macro_rules! tracked {
($name: ident, $non_default_value: expr) => {
opts = reference.clone();
opts.debugging_opts.$name = $non_default_value;
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
};
}
// Make sure that changing a [TRACKED] option changes the hash.
// This list is in alphabetical order.
tracked!(allow_features, Some(vec![String::from("lang_items")]));
tracked!(always_encode_mir, true);
tracked!(asm_comments, true);
tracked!(binary_dep_depinfo, true);
tracked!(chalk, true);
tracked!(codegen_backend, Some("abc".to_string()));
tracked!(crate_attr, vec!["abc".to_string()]);
tracked!(debug_macros, true);
tracked!(dep_info_omit_d_target, true);
tracked!(dual_proc_macros, true);
tracked!(fewer_names, true);
tracked!(force_overflow_checks, Some(true));
tracked!(force_unstable_if_unmarked, true);
tracked!(fuel, Some(("abc".to_string(), 99)));
tracked!(human_readable_cgu_names, true);
tracked!(inline_in_all_cgus, Some(true));
tracked!(insert_sideeffect, true);
tracked!(instrument_mcount, true);
tracked!(link_only, true);
tracked!(merge_functions, Some(MergeFunctions::Disabled));
tracked!(mir_emit_retag, true);
tracked!(mir_opt_level, 3);
tracked!(mutable_noalias, true);
tracked!(new_llvm_pass_manager, true);
tracked!(no_codegen, true);
tracked!(no_generate_arange_section, true);
tracked!(no_link, true);
tracked!(no_profiler_runtime, true);
tracked!(osx_rpath_install_name, true);
tracked!(panic_abort_tests, true);
tracked!(plt, Some(true));
tracked!(print_fuel, Some("abc".to_string()));
tracked!(profile, true);
tracked!(relro_level, Some(RelroLevel::Full));
tracked!(report_delayed_bugs, true);
tracked!(run_dsymutil, false);
tracked!(sanitizer, Some(Sanitizer::Address));
tracked!(sanitizer_memory_track_origins, 2);
tracked!(sanitizer_recover, vec![Sanitizer::Address]);
tracked!(saturating_float_casts, Some(true));
tracked!(share_generics, Some(true));
tracked!(show_span, Some(String::from("abc")));
tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));
tracked!(symbol_mangling_version, SymbolManglingVersion::V0);
tracked!(teach, true);
tracked!(thinlto, Some(true));
tracked!(tls_model, Some(TlsModel::GeneralDynamic));
tracked!(treat_err_as_bug, Some(1));
tracked!(unleash_the_miri_inside_of_you, true);
tracked!(use_ctors_section, Some(true));
tracked!(verify_llvm_ir, true);
} | rust_cleaned_test_functions.jsonl/16056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
3173,
8743,
66105,
8950,
368,
341,
262,
1077,
5785,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
12185,
284,
14566,
486,
2258,
1428,
262,
18072,
21407,
0,
650,
58381,
341,
286,
1711,
606,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_conversions() {
test_valid_conversions!(PcrSelectSize::OneOctet, 1);
test_valid_conversions!(PcrSelectSize::TwoOctets, 2);
test_valid_conversions!(PcrSelectSize::ThreeOctets, 3);
test_valid_conversions!(PcrSelectSize::FourOctets, 4);
} | rust_cleaned_test_functions.jsonl/37949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
3382,
28290,
368,
341,
262,
1273,
8337,
3382,
28290,
10297,
47,
5082,
3379,
1695,
486,
3966,
18053,
295,
11,
220,
16,
317,
262,
1273,
8337,
3382,
28290,
10297,
47,
5082,
3379,
1695,
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... | 1 |
#[test]
fn test_blake2s_test_vectors() {
let hasher = DirectHasher;
let test_vectors = [(
"7f8a56d8b5fb1f038ffbfce79f185f4aad9d603094edb85457d6c84d6bc02a82644ee42da51e9c3bb18395f450092d39721c32e7f05ec4c1f22a8685fcb89721738335b57e4ee88a3b32df3762503aa98e4a9bd916ed385d265021391745f08b27c37dc7bc6cb603cc27e19baf47bf00a2ab2c32250c98d79d5e1170dee4068d9389d146786c2a0d1e08ade5" ,
"87009aa74342449e10a3fd369e736fcb9ad1e7bd70ef007e6e2394b46c094074c86adf6c980be077fa6c4dc4af1ca0450a4f00cdd1a87e0c4f059f512832c2d92a1cde5de26d693ccd246a1530c0d6926185f9330d3524710b369f6d2976a44d",
), (
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
"57d5",
), (
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
"bfec8b58ee2e2e32008eb9d7d304914ea756ecb31879eb2318e066c182b0e77e6a518e366f345692e29f497515f799895983200f0d7dafa65c83a7506c03e8e5eee387cffdb27a0e6f5f3e9cb0ccbcfba827984586f608769f08f6b1a84872",
)];
for test_vector in &test_vectors {
let bytes = hasher
.hash(
b"",
&hex::decode(test_vector.0).unwrap(),
test_vector.1.len() / 2,
)
.unwrap();
assert_eq!(hex::encode(&bytes), test_vector.1);
}
} | rust_cleaned_test_functions.jsonl/45253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1518
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
726,
17,
82,
4452,
49158,
368,
341,
286,
1077,
90819,
284,
7139,
6370,
261,
280,
286,
1077,
1273,
49158,
284,
508,
1006,
310,
330,
22,
69,
23,
64,
20,
21,
67,
23,
65,
20,
10798,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_iterator_product() {
let v: &[i32] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
assert_eq!(v[..4].iter().cloned().product::<i32>(), 0);
assert_eq!(v[1..5].iter().cloned().product::<i32>(), 24);
assert_eq!(v[..0].iter().cloned().product::<i32>(), 1);
} | rust_cleaned_test_functions.jsonl/25924 | {
"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,
13491,
9840,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assembler_pick() {
test_case(&["SET A, PICK 5"], &[0x6801, 0x0005]);
test_case(&["SET A, PICK 0x1234"], &[0x6801, 0x1234]);
test_case(&["SET PICK 0xffff, A"], &[0x0341, 0xffff]);
test_case(&["SET PICK 0xffff, [0x1000]"], &[0x7b41, 0x1000, 0xffff]);
test_case(&["IAS PICK 1000"], &[0x6940, 0x03e8]);
} | rust_cleaned_test_functions.jsonl/44768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
35401,
58168,
368,
341,
262,
1273,
19096,
2099,
1183,
5884,
362,
11,
83537,
220,
20,
7914,
44590,
15,
87,
21,
23,
15,
16,
11,
220,
15,
87,
15,
15,
15,
20,
2558,
262,
1273,
19096,
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_init() {
let tmp_dir = TempDir::new().unwrap();
Command::cargo_bin("adrs")
.unwrap()
.arg("init")
.arg(tmp_dir.path())
.assert()
.success();
assert!(Path::new(tmp_dir.path())
.join("0001-record-architecture-decisions.md")
.exists());
} | rust_cleaned_test_functions.jsonl/30828 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
262,
7348,
486,
66715,
21816,
445,
329,
5428,
1138,
286,
659,
15454,
741,
286,
659,
858,
445,
2327,
1138,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_mat() {
let a = vec![2.0; 9];
let b = Matrix::new(3, 3, a);
assert_eq!(b.rows(), 3);
assert_eq!(b.cols(), 3);
assert_eq!(b.into_vec(), vec![2.0; 9]);
} | rust_cleaned_test_functions.jsonl/55912 | {
"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,
5921,
16610,
368,
341,
286,
1077,
264,
284,
7486,
20703,
17,
13,
15,
26,
220,
24,
935,
286,
1077,
293,
284,
11631,
486,
931,
7,
18,
11,
220,
18,
11,
264,
626,
286,
2060,
10714,
10297,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_reader_empty_pages() {
// Construct column schema
let message_type = "
message test_schema {
REQUIRED INT32 leaf;
}
";
let schema = parse_message_type(message_type)
.map(|t| Arc::new(SchemaDescriptor::new(Arc::new(t))))
.unwrap();
let column_desc = schema.column(0);
let page_iterator = EmptyPageIterator::new(schema);
let mut array_reader = PrimitiveArrayReader::<Int32Type>::new(
Box::new(page_iterator),
column_desc,
None,
)
.unwrap();
// expect no values to be read
let array = array_reader.next_batch(50).unwrap();
assert!(array.is_empty());
} | rust_cleaned_test_functions.jsonl/10211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
22306,
15124,
21655,
368,
341,
286,
442,
18678,
3250,
10802,
198,
286,
1077,
1943,
1819,
284,
6228,
286,
1943,
1273,
25371,
341,
688,
66577,
9221,
18,
17,
15933,
280,
286,
456,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_mark_creation_time() {
let now: u64 = 1_605_127_770_789;
let thread_pool = ThreadPoolBuilder::new().build().unwrap();
let mut ping_cache = PingCache::new(
Duration::from_secs(20 * 60), // ttl
128, // capacity
);
let mut crds = Crds::default();
let node_keypair = Keypair::new();
let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&node_keypair.pubkey(),
0,
)));
let mut node = CrdsGossipPull::default();
crds.insert(entry, now).unwrap();
let old = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0);
ping_cache.mock_pong(old.id, old.gossip, Instant::now());
let old = CrdsValue::new_unsigned(CrdsData::ContactInfo(old));
crds.insert(old.clone(), now).unwrap();
let new = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0);
ping_cache.mock_pong(new.id, new.gossip, Instant::now());
let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(new));
crds.insert(new.clone(), now).unwrap();
// set request creation time to now.
let now = now + 50_000;
node.mark_pull_request_creation_time(new.label().pubkey(), now);
// odds of getting the other request should be close to 1.
let now = now + 1_000;
let mut pings = Vec::new();
let ping_cache = Mutex::new(ping_cache);
for _ in 0..10 {
let req = node.new_pull_request(
&thread_pool,
&crds,
&node_keypair,
0,
now,
None,
&HashMap::new(),
PACKET_DATA_SIZE,
&ping_cache,
&mut pings,
);
let (peer, _) = req.unwrap();
assert_eq!(peer, *old.contact_info().unwrap());
}
} | rust_cleaned_test_functions.jsonl/114598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1014
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
18924,
46163,
3009,
368,
341,
286,
1077,
1431,
25,
575,
21,
19,
284,
220,
16,
62,
21,
15,
20,
62,
16,
17,
22,
62,
22,
22,
15,
62,
22,
23,
24,
280,
286,
1077,
4516,
15709,
284,
7271... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_shuffle_does_not_loop() {
let numbered = 0x00112233_44556677_8899AABB_CCDDEEFF;
let mut shuffled = shuffle(numbered);
for count in 0..100 {
assert_ne!(numbered, shuffled, "Equal after {} vs {:x}", count, shuffled);
shuffled = shuffle(shuffled);
}
} | rust_cleaned_test_functions.jsonl/109544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73484,
96374,
7913,
17198,
368,
341,
286,
1077,
48826,
284,
220,
15,
87,
15,
15,
16,
16,
17,
17,
18,
18,
62,
19,
19,
20,
20,
21,
21,
22,
22,
62,
23,
23,
24,
24,
32,
44322,
920,
6484,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.