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_create_poly_from_macro() {
let poly = univar_polynomial!(
FieldElement::one(),
FieldElement::zero(),
FieldElement::from(87u64),
-FieldElement::one(),
FieldElement::from(300u64)
);
assert_eq!(poly.degree(), 4);
assert_eq!(poly[0], FieldElement::one());
assert_eq!(poly[1], FieldElement::zero());
assert_eq!(poly[2], FieldElement::from(87u64));
assert_eq!(poly[3], FieldElement::minus_one());
assert_eq!(poly[4], FieldElement::from(300u64));
} | rust_cleaned_test_functions.jsonl/51310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
36133,
5673,
58810,
368,
341,
286,
1077,
9861,
284,
650,
56398,
47323,
25358,
33673,
310,
8601,
1691,
486,
603,
3148,
310,
8601,
1691,
486,
14154,
3148,
310,
8601,
1691,
486,
1499,
7,
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_stop_client_connections_succeeds() {
let mut test_values = test_setup();
// Request a scan
let stop_fut = test_values.iface_manager.stop_client_connections(
client_types::DisconnectReason::FidlStopClientConnectionsRequest,
);
pin_mut!(stop_fut);
assert_variant!(test_values.exec.run_until_stalled(&mut stop_fut), Poll::Pending);
// Verify that the service sees the request.
let next_message = test_values.receiver.next();
pin_mut!(next_message);
assert_variant!(
test_values.exec.run_until_stalled(&mut next_message),
Poll::Ready(Some(IfaceManagerRequest::StopClientConnections(StopClientConnectionsRequest{
responder, reason
}))) => {
assert_eq!(reason, client_types::DisconnectReason::FidlStopClientConnectionsRequest);
responder.send(Ok(())).expect("failed sending stop client connections response");
}
);
// Verify that the client side gets the response.
assert_variant!(test_values.exec.run_until_stalled(&mut stop_fut), Poll::Ready(Ok(())));
} | rust_cleaned_test_functions.jsonl/59190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19039,
8179,
56402,
643,
29264,
82,
368,
341,
286,
1077,
5206,
1273,
9146,
284,
1273,
21363,
1428,
286,
442,
6145,
264,
8569,
198,
286,
1077,
2936,
761,
332,
284,
1273,
9146,
35431,
578,
12144,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ecdsa_unexpected_support_from_node() {
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
with_test_replica_logger(|logger| {
let (mut ecdsa_pool, pre_signer) =
create_pre_signer_dependencies(pool_config, logger);
let time_source = FastForwardTimeSource::new();
let id = create_transcript_id(1);
// NODE_3}
let mut support = create_support(id, NODE_2, NODE_3);
support.content.requested_height = Height::from(10);
let msg_id = support.message_hash();
ecdsa_pool.insert(UnvalidatedArtifact {
message: EcdsaMessage::EcdsaDealingSupport(support),
peer_id: NODE_3,
timestamp: time_source.get_relative_time(),
});
// NODE_3 is not in the receiver list
let t = create_transcript_param(id, &[NODE_2], &[NODE_4]);
let block_reader =
TestEcdsaBlockReader::for_pre_signer_test(Height::from(100), vec![t]);
let change_set = pre_signer.validate_dealing_support(&ecdsa_pool, &block_reader);
assert_eq!(change_set.len(), 1);
assert!(is_handle_invalid(&change_set, &msg_id));
})
})
} | rust_cleaned_test_functions.jsonl/86723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 764
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
4907,
7325,
25827,
5673,
5084,
368,
341,
286,
17902,
4452,
94044,
486,
63722,
15709,
5332,
486,
4197,
4452,
15709,
5332,
22428,
10285,
5332,
91,
341,
310,
448,
4452,
25533,
15317,
2741... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unescape_byte_str_good() {
fn check(literal_text: &str, expected: &[u8]) {
let mut buf = Ok(Vec::with_capacity(literal_text.len()));
unescape_byte_str(literal_text, &mut |range, c| {
if let Ok(b) = &mut buf {
match c {
Ok(c) => b.push(c),
Err(e) => buf = Err((range, e)),
}
}
});
let buf = buf.as_ref().map(|it| it.as_ref());
assert_eq!(buf, Ok(expected))
}
check("foo", b"foo");
check("", b"");
check(" \t\n\r\n", b" \t\n\n");
check("hello \\\n world", b"hello world");
check("hello \\\r\n world", b"hello world");
check("thread's", b"thread's")
} | rust_cleaned_test_functions.jsonl/61424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
12998,
19737,
2895,
44781,
368,
341,
286,
5168,
1779,
2333,
9953,
4326,
25,
609,
495,
11,
3601,
25,
44590,
84,
23,
2467,
341,
310,
1077,
5206,
6607,
284,
7622,
49923,
486,
4197,
35603,
233... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_head_mut() {
let mut a = vec![];
assert_eq!(a.as_mut_slice().head_mut(), None);
a = vec![11i];
assert_eq!(*a.as_mut_slice().head_mut().unwrap(), 11);
a = vec![11i, 12];
assert_eq!(*a.as_mut_slice().head_mut().unwrap(), 11);
} | rust_cleaned_test_functions.jsonl/108280 | {
"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,
13138,
29523,
368,
341,
286,
1077,
5206,
264,
284,
7486,
0,
15078,
286,
2060,
10714,
10297,
64,
5357,
29523,
26488,
1005,
1983,
29523,
1507,
2240,
317,
286,
264,
284,
7486,
20703,
16,
16,
72,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_proposals_removes_execute_nns_function_payload() {
// ARRANGE
let proposal_id = ProposalId { id: 2 };
let payload = iter::repeat(42)
.take(EXECUTE_NNS_FUNCTION_PAYLOAD_LISTING_BYTES_MAX + 1)
.collect();
let driver = fake::FakeDriver::default();
let gov = Governance::new(
fixture_for_proposals(proposal_id, payload),
driver.get_fake_env(),
driver.get_fake_ledger(),
);
let caller = &principal(1);
// ACT
let results = gov.list_proposals(
caller,
&ListProposalInfo {
..Default::default()
},
);
// ASSERT
let action = results.proposal_info[0]
.proposal
.as_ref()
.unwrap()
.action
.as_ref()
.unwrap();
assert_matches!(
action,
proposal::Action::ExecuteNnsFunction(eu) if eu.payload.is_empty()
);
} | rust_cleaned_test_functions.jsonl/1173 | {
"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,
2019,
21663,
85975,
19194,
10088,
44329,
1089,
4412,
9174,
32813,
368,
341,
262,
442,
82079,
11503,
198,
262,
1077,
13734,
842,
284,
65890,
764,
314,
877,
25,
220,
17,
2605,
262,
1077,
7729,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_not_found() {
let c = make();
let res = c.get::<bool>("not_found");
assert!(res.is_err());
assert_eq!(
res.unwrap_err().to_string(),
"configuration property \"not_found\" not found".to_string()
);
} | rust_cleaned_test_functions.jsonl/39921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
21480,
368,
341,
262,
1077,
272,
284,
1281,
543,
262,
1077,
592,
284,
272,
670,
27638,
2641,
13211,
1921,
21480,
3071,
262,
2060,
10297,
416,
2079,
9266,
1423,
262,
2060,
10714,
33673,
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_is_valid_incorrect_required_hash() {
let (tx_out_store, env) = init_tx_out_store();
let num_tx_outs: u32 = 8;
let tx_outs = get_tx_outs(num_tx_outs);
{
// Populate the tx_out_store.
let mut rw_transaction = env.begin_rw_txn().unwrap();
for tx_out in &tx_outs {
tx_out_store.push(tx_out, &mut rw_transaction).unwrap();
}
rw_transaction.commit().unwrap();
}
let db_transaction = env.begin_ro_txn().unwrap();
let known_root_hash = tx_out_store.get_root_merkle_hash(&db_transaction).unwrap();
{
let mut proof = tx_out_store
.get_merkle_proof_of_membership(5, &db_transaction)
.unwrap();
// Tamper with proof after it is constructed. This bypasses checks in
proof.elements[3] = TxOutMembershipElement {
range: Range::new(6, 7).unwrap(),
hash: TxOutMembershipHash::from([7u8; 32]),
};
assert_eq!(
Err(MembershipProofError::UnexpectedMembershipElement(3)),
is_membership_proof_valid(tx_outs.get(5).unwrap(), &proof, &known_root_hash)
);
}
} | rust_cleaned_test_functions.jsonl/5264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 683
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
8337,
1243,
19928,
18743,
8950,
368,
341,
286,
1077,
320,
3998,
6068,
14809,
11,
6105,
8,
284,
2930,
17805,
6068,
14809,
543,
286,
1077,
1629,
17805,
6068,
82,
25,
575,
18,
17,
284,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_deserialize_numeric() {
#[derive(Debug, PartialEq)]
enum FloatOrInteger {
Float(f64),
Integer(u64),
}
impl<'de> de::Deserialize<'de> for FloatOrInteger {
fn deserialize<D>(de: D) -> Result<FloatOrInteger, D::Error>
where D: de::Deserializer<'de>
{
struct FloatOrIntegerVisitor;
impl<'de> de::Visitor<'de> for FloatOrIntegerVisitor {
type Value = FloatOrInteger;
fn expecting(&self, fmt: &mut Formatter) -> Result<(), fmt::Error> {
write!(fmt, "either a float or an integer")
}
fn visit_u64<E>(self, value: u64) -> Result<FloatOrInteger, E> {
Ok(FloatOrInteger::Integer(value))
}
fn visit_f64<E>(self, value: f64) -> Result<FloatOrInteger, E> {
Ok(FloatOrInteger::Float(value))
}
}
de.deserialize_any(FloatOrIntegerVisitor)
}
}
let buf = [203, 64, 36, 102, 102, 102, 102, 102, 102];
let mut de = Deserializer::new(&buf[..]);
let x: FloatOrInteger = Deserialize::deserialize(&mut de).unwrap();
assert_eq!(x, FloatOrInteger::Float(10.2));
let buf = [36];
let mut de = Deserializer::new(&buf[..]);
let x: FloatOrInteger = Deserialize::deserialize(&mut de).unwrap();
assert_eq!(x, FloatOrInteger::Integer(36));
} | rust_cleaned_test_functions.jsonl/13678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 721
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
29418,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
5563,
262,
7618,
13001,
2195,
3486,
341,
286,
13001,
955,
21,
19,
1326,
286,
4440,
8154,
21,
19,
1326,
262,
555,
262,
11605,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stdin_all_repeated() {
new_ucmd!()
.args(&["--all-repeated"]).pipe_in_fixture(INPUT)
.run().stdout_is_fixture("sorted-all-repeated.expected");
} | rust_cleaned_test_functions.jsonl/23101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
5705,
1288,
41954,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
541,
5504,
41954,
45014,
13768,
1243,
74409,
57911,
340,
286,
659,
6108,
1005,
36358,
6892,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_timeout_tokio_timeout() {
let runtime = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap();
runtime.block_on(timeout_test_tokio(true));
} | rust_cleaned_test_functions.jsonl/3115 | {
"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,
20537,
76162,
815,
20537,
368,
341,
73363,
286,
1077,
15592,
284,
9628,
815,
486,
22255,
486,
3297,
486,
931,
25133,
10814,
741,
310,
659,
12552,
5705,
741,
310,
659,
5834,
741,
310,
659,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_local_cluster_start_and_exit_with_config() {
solana_logger::setup();
const NUM_NODES: usize = 1;
let mut config = ClusterConfig {
validator_configs: make_identical_validator_configs(
&ValidatorConfig::default(),
NUM_NODES,
),
node_stakes: vec![3; NUM_NODES],
cluster_lamports: 100,
ticks_per_slot: 8,
slots_per_epoch: MINIMUM_SLOTS_PER_EPOCH as u64,
stakers_slot_offset: MINIMUM_SLOTS_PER_EPOCH as u64,
..ClusterConfig::default()
};
let cluster = LocalCluster::new(&mut config);
assert_eq!(cluster.validators.len(), NUM_NODES);
} | rust_cleaned_test_functions.jsonl/24681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
28441,
4906,
8378,
16880,
6615,
5332,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
733,
15943,
92948,
25,
22301,
284,
220,
16,
280,
286,
1077,
5206,
2193,
284,
35380,
2648,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_string() {
let text = "";
let parsed_input = parse_message(text);
assert_eq!(parsed_input.description, None);
assert_eq!(parsed_input.object_info, None);
assert_eq!(parsed_input.object_type, ObjectType::Other);
} | rust_cleaned_test_functions.jsonl/97562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15124,
3904,
368,
341,
286,
1077,
1467,
284,
5438,
286,
1077,
15676,
5898,
284,
4715,
6462,
7235,
626,
286,
2060,
10714,
10297,
41030,
5898,
13178,
11,
2240,
317,
286,
2060,
10714,
10297,
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 |
#[test]
fn test_nirmala() {
run_test(
&TEST_DATA,
"directwrite/good-nirmala.ta",
"indic/Nirmala.ttf",
&[JOINER_GLYPH_INDEX],
353,
);
} | rust_cleaned_test_functions.jsonl/91211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2853,
6053,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
19798,
4934,
4846,
1386,
5279,
2853,
6053,
72160,
756,
503,
330,
85084,
20290,
2853,
6053,
45192,
756,
503,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_frozen_duplicate_confirmed() {
// Common state
let slot = 0;
let is_slot_duplicate = false;
let is_dead = false;
// No cluster duplicate_confirmed hash yet
let mut cluster_duplicate_confirmed_hash = None;
// no actionable state changes
let bank_frozen_hash = Hash::new_unique();
assert!(on_frozen_slot(
slot,
&bank_frozen_hash,
cluster_duplicate_confirmed_hash,
is_slot_duplicate,
is_dead
)
.is_empty());
// should just confirm the slot
cluster_duplicate_confirmed_hash = Some(&bank_frozen_hash);
assert_eq!(
on_cluster_update(
slot,
&bank_frozen_hash,
cluster_duplicate_confirmed_hash,
is_slot_duplicate,
is_dead
),
vec![ResultingStateChange::DuplicateConfirmedSlotMatchesCluster(
bank_frozen_hash
),]
);
// try to repair correct version
let mismatched_hash = Hash::new_unique();
cluster_duplicate_confirmed_hash = Some(&mismatched_hash);
assert_eq!(
on_cluster_update(
slot,
&bank_frozen_hash,
cluster_duplicate_confirmed_hash,
is_slot_duplicate,
is_dead
),
vec![
ResultingStateChange::MarkSlotDuplicate(bank_frozen_hash),
ResultingStateChange::RepairDuplicateConfirmedVersion(mismatched_hash),
]
);
} | rust_cleaned_test_functions.jsonl/48608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 933
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
42240,
70434,
16059,
8434,
368,
341,
286,
442,
7718,
1584,
198,
286,
1077,
9446,
284,
220,
15,
280,
286,
1077,
374,
27563,
70434,
284,
895,
280,
286,
1077,
374,
53427,
284,
895,
401,
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_get_default_branch_with_memo() -> Result<()> {
let gh_token = env::github_token(&None::<String>)?;
let mut memo = HashMap::new();
get_default_branch(&gh_token, "suecharo", "gh-trs", Some(&mut memo))?;
get_default_branch(&gh_token, "suecharo", "gh-trs", Some(&mut memo))?;
Ok(())
} | rust_cleaned_test_functions.jsonl/6702 | {
"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,
3062,
9993,
28031,
6615,
717,
6726,
368,
1464,
5714,
71698,
341,
286,
1077,
36124,
6458,
284,
6105,
486,
5204,
6458,
2099,
4064,
27638,
703,
9231,
37445,
286,
1077,
5206,
21438,
284,
10528,
486,
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... | 4 |
#[test]
fn test_sample_below_prng() {
use rand::{thread_rng};
let q: u64 = 18014398492704769;
let q_scalar = Scalar::new_modulus(q);
let mut rng = thread_rng();
for _ in 0..10 {
assert!(Scalar::sample_below_from_rng(&q_scalar, &mut rng).rep < q);
}
} | rust_cleaned_test_functions.jsonl/1926 | {
"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,
17491,
82750,
5294,
968,
368,
341,
286,
990,
10382,
22964,
4528,
66849,
2440,
286,
1077,
2804,
25,
575,
21,
19,
284,
220,
16,
23,
15,
16,
19,
18,
24,
23,
19,
24,
17,
22,
15,
19,
22,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_scan_values_in_default() {
let path = TempDir::new("_test_scan_values_in_default").expect("");
let path = path.path().to_str().unwrap();
let engine = engine::new_local_engine(path, ALL_CFS).unwrap();
must_prewrite_put(
engine.as_ref(),
&[2],
&gen_value(b'v', SHORT_VALUE_MAX_LEN + 1),
&[2],
3,
);
must_commit(engine.as_ref(), &[2], 3, 3);
must_prewrite_put(
engine.as_ref(),
&[3],
&gen_value(b'a', SHORT_VALUE_MAX_LEN + 1),
&[3],
3,
);
must_commit(engine.as_ref(), &[3], 3, 4);
must_prewrite_put(
engine.as_ref(),
&[3],
&gen_value(b'b', SHORT_VALUE_MAX_LEN + 1),
&[3],
5,
);
must_commit(engine.as_ref(), &[3], 5, 5);
must_prewrite_put(
engine.as_ref(),
&[6],
&gen_value(b'x', SHORT_VALUE_MAX_LEN + 1),
&[6],
3,
);
must_commit(engine.as_ref(), &[6], 3, 6);
let snapshot = engine.snapshot(&Context::new()).unwrap();
let mut reader = MvccReader::new(
snapshot,
Some(ScanMode::Forward),
true,
None,
None,
IsolationLevel::SI,
);
let v = reader.scan_values_in_default(&make_key(&[3])).unwrap();
assert_eq!(v.len(), 2);
assert_eq!(v[1], (3, gen_value(b'a', SHORT_VALUE_MAX_LEN + 1)));
assert_eq!(v[0], (5, gen_value(b'b', SHORT_VALUE_MAX_LEN + 1)));
} | rust_cleaned_test_functions.jsonl/23339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 980
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
9146,
1243,
9993,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
1944,
28857,
9146,
1243,
9993,
1827,
17119,
13056,
286,
1077,
1815,
284,
1815,
3875,
1005,
983,
2895,
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_do_hmac() {
let key = String::from("mysecret");
let message = String::from("hellothere");
let mac = do_hmac(key, message);
assert_eq!(
format!(
"{}{}",
"b8558314f515931c8d9b329805978fe77b9bb020b05406c0e",
"f189d89846ff8f5f0ca10e387d2c424358171df7f896f9f"
),
mac.unwrap() //#[allow_ci]
);
} | rust_cleaned_test_functions.jsonl/73503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26309,
1523,
11948,
368,
341,
286,
1077,
1376,
284,
923,
486,
1499,
445,
2408,
20474,
797,
286,
1077,
1943,
284,
923,
486,
1499,
445,
14990,
18532,
797,
286,
1077,
8978,
284,
653,
1523,
11948,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_transfer_success_with_source_only() {
// create a genesis account.
let account = GenesisAccount::account(
DEFAULT_ACCOUNT_PUBLIC_KEY.clone(),
Motes::new(U512::from(DEFAULT_ACCOUNT_INITIAL_BALANCE)),
None,
);
// add the account to the genesis config.
let mut genesis_config = DEFAULT_GENESIS_CONFIG.clone();
genesis_config.ee_config_mut().push_account(account);
let run_genesis_request = RunGenesisRequest::new(
*DEFAULT_GENESIS_CONFIG_HASH,
genesis_config.protocol_version(),
genesis_config.take_ee_config(),
);
// Doing a transfer from main purse to create new purse and store URef under NEW_PURSE_NAME.
let transfer_amount = U512::try_from(FIRST_TRANSFER_AMOUNT).expect("U512 from u64");
let path = PathBuf::from(TRANSFER_WASM);
let session_args = runtime_args! {
ARG_DESTINATION => NEW_PURSE_NAME,
ARG_AMOUNT => transfer_amount
};
// build the deploy.
let deploy_item = DeployItemBuilder::new()
.with_empty_payment_bytes(runtime_args! {ARG_AMOUNT => *DEFAULT_PAYMENT})
.with_session_code(path, session_args)
.with_address(*DEFAULT_ACCOUNT_ADDR)
.with_authorization_keys(&[*DEFAULT_ACCOUNT_ADDR])
.build();
// build a request to execute the deploy.
let exec_request = ExecuteRequestBuilder::from_deploy_item(deploy_item).build();
let mut builder = InMemoryWasmTestBuilder::default();
builder.run_genesis(&run_genesis_request).commit();
// we need this to figure out what the transfer fee is.
let proposer_starting_balance = builder.get_proposer_purse_balance();
// Getting main purse URef to verify transfer
let source_purse = builder
.get_expected_account(*DEFAULT_ACCOUNT_ADDR)
.main_purse();
builder.exec(exec_request).commit().expect_success();
let transaction_fee = builder.get_proposer_purse_balance() - proposer_starting_balance;
let expected_source_ending_balance = Motes::new(U512::from(DEFAULT_ACCOUNT_INITIAL_BALANCE))
- Motes::new(transfer_amount)
- Motes::new(transaction_fee);
let actual_source_ending_balance = Motes::new(builder.get_purse_balance(source_purse));
assert_eq!(expected_source_ending_balance, actual_source_ending_balance);
} | rust_cleaned_test_functions.jsonl/123010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 902
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
35403,
18632,
6615,
10347,
18410,
368,
341,
262,
442,
1855,
264,
59366,
2692,
624,
262,
1077,
2692,
284,
40788,
7365,
486,
4608,
1006,
286,
11955,
38831,
36209,
6600,
15997,
3148,
286,
386,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_relative_path() {
expect_ok!(RelativePath, "foo");
expect_ok!(RelativePath, "foo/bar");
expect_ok!(RelativePath, &format!("{}", repeat("x").take(1024).collect::<String>()));
} | rust_cleaned_test_functions.jsonl/98667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
29286,
2638,
368,
341,
286,
1720,
19817,
10297,
28442,
1820,
11,
330,
7975,
797,
286,
1720,
19817,
10297,
28442,
1820,
11,
330,
7975,
49513,
797,
286,
1720,
19817,
10297,
28442,
1820,
11,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vcx_prepare_schema_success() {
let _setup = SetupMocks::init();
let cb = return_types_u32::Return_U32_U32_STR::new().unwrap();
assert_eq!(vcx_schema_prepare_for_endorser(cb.command_handle,
CString::new("Test Source ID").unwrap().into_raw(),
CString::new("Test Schema").unwrap().into_raw(),
CString::new("0.0").unwrap().into_raw(),
CString::new("[att1, att2]").unwrap().into_raw(),
CString::new("V4SGRU86Z58d6TV7PBUe6f").unwrap().into_raw(),
Some(cb.get_callback())), error::SUCCESS.code_num);
let (_handle, schema_transaction) = cb.receive(TimeoutUtils::some_short()).unwrap();
let schema_transaction = schema_transaction.unwrap();
let schema_transaction: serde_json::Value = serde_json::from_str(&schema_transaction).unwrap();
let expected_schema_transaction: serde_json::Value = serde_json::from_str(utils::constants::REQUEST_WITH_ENDORSER).unwrap();
assert_eq!(expected_schema_transaction, schema_transaction);
} | rust_cleaned_test_functions.jsonl/118209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
47460,
25371,
18632,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
9858,
284,
470,
9763,
7300,
18,
17,
486,
5598,
6665,
18,
17,
6665,
18,
17,
7159,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_store_without_config_signer() {
solana_logger::setup();
let pubkey = Pubkey::new_unique();
let signer0_pubkey = Pubkey::new_unique();
let keys = vec![(pubkey, false), (signer0_pubkey, true)];
let (config_keypair, _) = create_config_account(keys.clone());
let config_pubkey = config_keypair.pubkey();
let my_config = MyConfig::new(42);
let signer0_account = AccountSharedData::new(0, 0, &id());
let instruction = config_instruction::store(&config_pubkey, false, keys, &my_config);
process_instruction(
&instruction.data,
vec![(signer0_pubkey, signer0_account)],
vec![AccountMeta {
pubkey: signer0_pubkey,
is_signer: true,
is_writable: false,
}],
Err(InstructionError::InvalidAccountData),
);
} | rust_cleaned_test_functions.jsonl/74376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14809,
39904,
5332,
11172,
261,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
95116,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
70039,
15,
34014,
792,
284,
22611,
792... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mock_command_wait() {
let client = Client::new_num(1);
let mut creator = MockCommandCreator::new(&client);
creator.next_command_spawns(Ok(MockChild::new(exit_status(0), "hello", "error")));
assert_eq!(
0,
spawn_wait_command(&mut creator, "foo")
.unwrap()
.code()
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/89703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34134,
10811,
18760,
368,
341,
286,
1077,
2943,
284,
8423,
486,
931,
4273,
7,
16,
317,
286,
1077,
5206,
19919,
284,
14563,
4062,
31865,
486,
931,
2099,
2972,
317,
286,
19919,
4529,
10811,
10123,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fd_sync() {
assert_wasi_output!(
"../../wasitests/fd_sync.wasm",
"fd_sync",
vec![],
vec![(
".".to_string(),
::std::path::PathBuf::from("wasitests/test_fs/temp")
),],
vec![],
"../../wasitests/fd_sync.out"
);
} | rust_cleaned_test_functions.jsonl/106799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17676,
23008,
368,
341,
262,
2060,
1670,
10215,
7645,
33673,
286,
10208,
16123,
275,
17966,
6663,
67,
23008,
1418,
10530,
756,
286,
330,
6902,
23008,
756,
286,
7486,
20703,
1259,
286,
7486,
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_vec4_accessors() {
let mut a = Vec4::zero();
a.x = 1.0;
a.y = 2.0;
a.z = 3.0;
a.w = 4.0;
assert_eq!(1.0, a.x);
assert_eq!(2.0, a.y);
assert_eq!(3.0, a.z);
assert_eq!(4.0, a.w);
assert_eq!((1.0, 2.0, 3.0, 4.0), a.into());
let mut a = Vec4::zero();
a[0] = 1.0;
a[1] = 2.0;
a[2] = 3.0;
a[3] = 4.0;
assert_eq!(1.0, a[0]);
assert_eq!(2.0, a[1]);
assert_eq!(3.0, a[2]);
assert_eq!(4.0, a[3]);
assert_eq!((1.0, 2.0, 3.0, 4.0), a.into());
} | rust_cleaned_test_functions.jsonl/68860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
19,
12759,
1087,
368,
341,
262,
1077,
5206,
264,
284,
11312,
19,
486,
14154,
543,
262,
264,
1993,
284,
220,
16,
13,
15,
280,
262,
264,
2384,
284,
220,
17,
13,
15,
280,
262,
264,
3938,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ignore_garbage() {
for ignore_garbage_param in vec!["-i", "--ignore-garbage"] {
let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n";
new_ucmd!()
.arg("-d")
.arg(ignore_garbage_param)
.pipe_in(input)
.succeeds()
.stdout_only("Hello, World!");
}
} | rust_cleaned_test_functions.jsonl/39846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
1889,
277,
20652,
368,
341,
262,
369,
10034,
1889,
277,
20652,
4090,
304,
7486,
0,
1183,
12,
72,
497,
14482,
13130,
2371,
277,
20652,
1341,
341,
286,
1077,
1946,
284,
330,
41,
7347,
54,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_blake2b() {
use crate::encoding::hex;
// Appendix A. Example of BLAKE2b Computation
assert_eq!(
&blake2b_512(b"abc"),
&[
0xBA, 0x80, 0xA5, 0x3F, 0x98, 0x1C, 0x4D, 0x0D, 0x6A, 0x27, 0x97, 0xB6, 0x9F, 0x12,
0xF6, 0xE9, 0x4C, 0x21, 0x2F, 0x14, 0x68, 0x5A, 0xC4, 0xB7, 0x4B, 0x12, 0xBB, 0x6F,
0xDB, 0xFF, 0xA2, 0xD1, 0x7D, 0x87, 0xC5, 0x39, 0x2A, 0xAB, 0x79, 0x2D, 0xC2, 0x52,
0xD5, 0xDE, 0x45, 0x33, 0xCC, 0x95, 0x18, 0xD3, 0x8A, 0xA8, 0xDB, 0xF1, 0x92, 0x5A,
0xB9, 0x23, 0x86, 0xED, 0xD4, 0x00, 0x99, 0x23,
]
);
// Example digests
assert_eq!(
&blake2b_384(b""),
&hex::decode(
"b32811423377f52d7862286ee1a72ee5\
40524380fda1724a6f25d7978c6fd324\
4a6caf0498812673c5e05ef583825100"
)
.unwrap()[..]
);
assert_eq!(
&blake2b_512(b""),
&hex::decode(
"786a02f742015903c6c6fd852552d272\
912f4740e15847618a86e217f71f5419\
d25e1031afee585313896444934eb04b\
903a685b1448b755d56f701afe9be2ce"
)
.unwrap()[..]
);
assert_eq!(
&blake2b_512(b"The quick brown fox jumps over the lazy dog"),
&hex::decode(
"a8add4bdddfd93e4877d2746e62817b1\
16364a1fa7bc148d95090bc7333b3673\
f82401cf7aa2e4cb1ecd90296e3f14cb\
5413f8ed77be73045b13914cdcd6a918"
)
.unwrap()[..]
);
assert_eq!(
&blake2b_512(b"The quick brown fox jumps over the lazy dof"),
&hex::decode(
"ab6b007747d8068c02e25a6008db8a77\
c218d94f3b40d2291a7dc8a62090a744\
c082ea27af01521a102e42f480a31e98\
44053f456b4b41e8aa78bbe5c12957bb"
)
.unwrap()[..]
);
} | rust_cleaned_test_functions.jsonl/38421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
726,
17,
65,
368,
341,
262,
990,
17717,
486,
17159,
486,
17308,
401,
262,
442,
64714,
362,
13,
220,
13383,
315,
14850,
25474,
17,
65,
1198,
13320,
7213,
262,
2060,
10714,
33673,
286,
609,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_small_binary() -> Result<()> {
let frames = Frame::from_payload(SIMPLE_BIN);
assert_eq!(frames[0].header.frame_num, 0);
assert_eq!(frames[0].header.flash_offset, 0x80000);
assert_eq!(
hex::encode(frames[0].header.hash),
"4e31bfd8b3be32358f2235c0f241f3970de575fc6aca0564aa6bf30adaf33910"
);
assert_eq!(frames[1].header.frame_num, 0x8000_0001);
assert_eq!(frames[1].header.flash_offset, 0x807d8);
assert_eq!(
hex::encode(frames[1].header.hash),
"ff584c07bbb0a039934a660bd49b7812af8ee847d1e675d9aba71c11fab3cfcb"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/85132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
31761,
368,
1464,
5714,
71698,
341,
286,
1077,
14087,
284,
16321,
486,
1499,
32813,
3759,
1791,
9515,
55720,
626,
286,
2060,
10714,
10297,
23719,
58,
15,
936,
2708,
9140,
4273,
11,
220,
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_send_append_for_progress_probe() {
let l = default_logger();
let mut r = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
r.become_candidate();
r.become_leader();
r.read_messages();
r.mut_prs().get_mut(2).unwrap().become_probe();
// each round is a heartbeat
for i in 0..3 {
if i == 0 {
// we expect that raft will only send out one msgAPP on the first
// received.
let _ = r.append_entry(&mut [new_entry(0, 0, SOME_DATA)]);
r.send_append(2);
let msg = r.read_messages();
assert_eq!(msg.len(), 1);
assert_eq!(msg[0].index, 0);
}
assert!(r.prs().get(2).unwrap().paused);
for _ in 0..10 {
let _ = r.append_entry(&mut [new_entry(0, 0, SOME_DATA)]);
r.send_append(2);
assert_eq!(r.read_messages().len(), 0);
}
// do a heartbeat
for _ in 0..r.heartbeat_timeout() {
r.step(new_message(1, 1, MessageType::MsgBeat, 0))
.expect("");
}
assert!(r.prs().get(2).unwrap().paused);
// consume the heartbeat
let msg = r.read_messages();
assert_eq!(msg.len(), 1);
assert_eq!(msg[0].get_msg_type(), MessageType::MsgHeartbeat);
}
// a heartbeat response will allow another message to be sent
r.step(new_message(2, 1, MessageType::MsgHeartbeatResponse, 0))
.expect("");
let msg = r.read_messages();
assert_eq!(msg.len(), 1);
assert_eq!(msg[0].index, 0);
assert!(r.prs().get(2).unwrap().paused);
} | rust_cleaned_test_functions.jsonl/19135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 819
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
26041,
5478,
27200,
49108,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_get_input_file_api_version() {
assert_eq!(
Some("2019-05-05-preview".to_owned()),
get_input_file_api_version("Microsoft.AlertsManagement/preview/2019-05-05-preview/ActionRules.json")
);
} | rust_cleaned_test_functions.jsonl/58214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5898,
2458,
11697,
9438,
368,
341,
286,
2060,
10714,
33673,
310,
4329,
445,
17,
15,
16,
24,
12,
15,
20,
12,
15,
20,
50881,
3263,
983,
51973,
14702,
310,
633,
5898,
2458,
11697,
9438,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_installed_version_path() {
// add it here.
let _lock = LOCK.lock();
let ver = "0.8.6";
let version = Version::from_str(ver).unwrap();
if utils::installed_versions(svm::SVM_HOME.as_path())
.map(|versions| !versions.contains(&version))
.unwrap_or_default()
{
Solc::blocking_install(&version).unwrap();
}
let res = Solc::find_svm_installed_version(&version.to_string()).unwrap().unwrap();
let expected = svm::SVM_HOME.join(ver).join(format!("solc-{}", ver));
assert_eq!(res.solc, expected);
} | rust_cleaned_test_functions.jsonl/50530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
79065,
9438,
2638,
368,
341,
1789,
286,
442,
912,
432,
1588,
624,
286,
1077,
716,
1023,
284,
49463,
21003,
543,
286,
1077,
2739,
284,
330,
15,
13,
23,
13,
21,
876,
286,
1077,
2319,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_day5_part2() {
let program = Program::from_file("../day05/input.txt").expect("Failed to read input");
assert_run(&program, VecDeque::from(vec![5]), &[15486302]);
} | rust_cleaned_test_functions.jsonl/119111 | {
"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,
16763,
20,
10495,
17,
368,
341,
286,
1077,
2025,
284,
6687,
486,
1499,
2458,
17409,
1292,
15,
20,
39990,
3909,
1827,
17119,
445,
9408,
311,
1349,
1946,
797,
286,
2060,
14007,
2099,
14906,
11,
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 |
#[test]
fn test_ja_simple() {
let orig = "The quick (\"brown\") fox can't jump 32.3 feet, right? Brr, it's 29.3°F!";
let processed = ProcessedText {
original: orig,
processed: Cow::Borrowed(orig),
};
let en_tokens = Lindera { normal_mode: true, dict: "" }.tokenize(&processed).map(|Token { word, .. }| word.to_owned()).collect::<Vec<_>>();
assert_eq!(
en_tokens,
["The", " ", "quick", " ", "(\"", "brown", "\")", " ", "fox", " ", "can", "\'", "t", " ", "jump", " ", "32", ".", "3", " ", "feet", ",", " ", "right", "?", " ", "Brr", ",", " ", "it", "\'", "s", " ", "29", ".", "3", "°", "F", "!"]
);
let orig = "関西国際空港限定トートバッグ";
let processed = ProcessedText {
original: orig,
processed: Cow::Borrowed(orig),
};
let ja_tokens = Lindera { normal_mode: true, dict: "" }.tokenize(&processed).map(|Token { word, .. }| word.to_owned()).collect::<Vec<_>>();
assert_eq!(
ja_tokens,
["関西国際空港", "限定", "トートバッグ"]
);
} | rust_cleaned_test_functions.jsonl/24091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 620
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
64,
30015,
368,
341,
286,
1077,
2713,
284,
330,
785,
3974,
320,
2105,
64461,
62705,
38835,
646,
944,
7784,
220,
18,
17,
13,
18,
7541,
11,
1290,
30,
425,
634,
11,
432,
594,
220,
17,
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_timed_send() {
use crate::packet::pull_resp::TxPk;
let json = "{\"codr\":\"4/5\",\"data\":\"IHLF2EA+n8BFY1vrCU1k/Vg=\",\"datr\":\"SF10BW500\",\"freq\":926.9000244140625,\"imme\":false,\"ipol\":true,\"modu\":\"LORA\",\"powe\":27,\"rfch\":0,\"size\":17,\"tmst\":727050748}";
let txpk: TxPk = serde_json::from_str(json).unwrap();
if let StringOrNum::N(_) = txpk.tmst {
assert!(true);
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/62773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29087,
291,
13565,
368,
341,
262,
990,
17717,
486,
24829,
486,
23441,
35160,
486,
31584,
58415,
280,
262,
1077,
2951,
284,
54734,
20116,
81,
23488,
19,
14,
20,
34333,
691,
23488,
40,
13485,
37,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_propagate_new_leaf() {
let mut heaviest_subtree_fork_choice = setup_forks();
heaviest_subtree_fork_choice
.add_new_leaf_slot((10, Hash::default()), Some((4, Hash::default())));
let ancestors = heaviest_subtree_fork_choice
.ancestor_iterator((10, Hash::default()))
.collect::<Vec<_>>();
for a in ancestors
.into_iter()
.chain(std::iter::once((10, Hash::default())))
{
assert_eq!(heaviest_subtree_fork_choice.best_slot(&a).unwrap().0, 10);
}
heaviest_subtree_fork_choice
.add_new_leaf_slot((9, Hash::default()), Some((4, Hash::default())));
let ancestors = heaviest_subtree_fork_choice
.ancestor_iterator((9, Hash::default()))
.collect::<Vec<_>>();
for a in ancestors
.into_iter()
.chain(std::iter::once((9, Hash::default())))
{
assert_eq!(heaviest_subtree_fork_choice.best_slot(&a).unwrap().0, 9);
}
heaviest_subtree_fork_choice
.add_new_leaf_slot((11, Hash::default()), Some((4, Hash::default())));
let ancestors = heaviest_subtree_fork_choice
.ancestor_iterator((11, Hash::default()))
.collect::<Vec<_>>();
for a in ancestors
.into_iter()
.chain(std::iter::once((9, Hash::default())))
{
assert_eq!(heaviest_subtree_fork_choice.best_slot(&a).unwrap().0, 9);
}
// Add a vote for the other branch at slot 3.
let stake = 100;
let (bank, vote_pubkeys) = bank_utils::setup_bank_and_vote_pubkeys(2, stake);
let leaf6 = 6;
// Leaf slot 9 stops being the `best_slot` at slot 1 because there
// are now votes for the branch at slot 3
heaviest_subtree_fork_choice.add_votes(
[(vote_pubkeys[0], (leaf6, Hash::default()))].iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
// Because slot 1 now sees the child branch at slot 3 has non-zero
// should not propagate past slot 1
heaviest_subtree_fork_choice
.add_new_leaf_slot((8, Hash::default()), Some((4, Hash::default())));
let ancestors = heaviest_subtree_fork_choice
.ancestor_iterator((8, Hash::default()))
.collect::<Vec<_>>();
for a in ancestors
.into_iter()
.chain(std::iter::once((8, Hash::default())))
{
let best_slot = if a.0 > 1 { 8 } else { leaf6 };
assert_eq!(
heaviest_subtree_fork_choice.best_slot(&a).unwrap().0,
best_slot
);
}
heaviest_subtree_fork_choice.add_votes(
[(vote_pubkeys[1], (8, Hash::default()))].iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot().0, 8);
// Because slot 4 now sees the child leaf 8 has non-zero
heaviest_subtree_fork_choice
.add_new_leaf_slot((7, Hash::default()), Some((4, Hash::default())));
let ancestors = heaviest_subtree_fork_choice
.ancestor_iterator((7, Hash::default()))
.collect::<Vec<_>>();
for a in ancestors
.into_iter()
.chain(std::iter::once((8, Hash::default())))
{
assert_eq!(heaviest_subtree_fork_choice.best_slot(&a).unwrap().0, 8);
}
// All the leaves should think they are their own best choice
for leaf in [8, 9, 10, 11].iter() {
assert_eq!(
heaviest_subtree_fork_choice
.best_slot(&(*leaf, Hash::default()))
.unwrap()
.0,
*leaf
);
}
} | rust_cleaned_test_functions.jsonl/85867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2006
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21663,
46836,
5921,
38909,
368,
341,
286,
1077,
5206,
566,
98362,
5228,
9344,
761,
669,
31936,
284,
6505,
761,
73302,
1428,
1789,
286,
566,
98362,
5228,
9344,
761,
669,
31936,
198,
310,
659,
718,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_quoted_unicode_chars() {
let mut args = Arguments::new(r#""𝓒𝓢𝓐 | CSA" amazing try"#);
assert_eq!(Some("𝓒𝓢𝓐 | CSA"), args.next());
assert_eq!(Some("amazing"), args.next());
assert_eq!(Some("try"), args.next());
assert_eq!(None, args.next());
} | rust_cleaned_test_functions.jsonl/53185 | {
"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,
11280,
9253,
54662,
37418,
368,
341,
286,
1077,
5206,
2827,
284,
27702,
486,
931,
2601,
2,
3014,
151316,
151318,
123871,
238,
760,
93407,
1,
7897,
1430,
57676,
317,
286,
2060,
10714,
10297,
8373,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pending_snapshot() {
let mut cluster = new_node_cluster(0, 3);
configure_for_snapshot(&mut cluster);
let election_timeout = configure_for_lease_read(&mut cluster, None, Some(15));
let gc_limit = cluster.cfg.raft_store.raft_log_gc_count_limit();
cluster.cfg.raft_store.pd_heartbeat_tick_interval = ReadableDuration::millis(100);
let handle_snapshot_fp = "apply_on_handle_snapshot_1_1";
let handle_snapshot_finish_fp = "apply_on_handle_snapshot_finish_1_1";
fail::cfg("apply_on_handle_snapshot_sync", "return").unwrap();
let pd_client = Arc::clone(&cluster.pd_client);
// Disable default max peer count check.
pd_client.disable_default_operator();
let region_id = cluster.run_conf_change();
pd_client.must_add_peer(region_id, new_peer(2, 2));
cluster.must_transfer_leader(region_id, new_peer(1, 1));
cluster.must_put(b"k1", b"v1");
fail::cfg(handle_snapshot_fp, "pause").unwrap();
pd_client.must_add_peer(region_id, new_peer(3, 3));
// Give some time for peer 3 to request snapshot.
sleep_ms(100);
// Isolate peer 1 from rest of the cluster.
cluster.add_send_filter(IsolationFilterFactory::new(1));
sleep_ms((election_timeout.as_millis() * 2) as _);
cluster.reset_leader_of_region(region_id);
// Compact logs to force requesting snapshot after clearing send filters.
let state2 = cluster.truncated_state(1, 2);
for i in 1..gc_limit * 10 {
let k = i.to_string().into_bytes();
cluster.must_put(&k, &k.clone());
}
cluster.wait_log_truncated(1, 2, state2.get_index() + 5 * gc_limit);
// Make sure peer 1 has applied snapshot.
cluster.clear_send_filters();
let start = Instant::now();
loop {
if cluster.pd_client.get_pending_peers().get(&1).is_none()
|| start.saturating_elapsed() > election_timeout * 10
{
break;
}
sleep_ms(50);
}
let state1 = cluster.truncated_state(1, 1);
// Peer 2 continues to handle snapshot.
fail::cfg(handle_snapshot_finish_fp, "pause").unwrap();
fail::remove(handle_snapshot_fp);
sleep_ms(200);
let state2 = cluster.truncated_state(1, 1);
fail::remove(handle_snapshot_finish_fp);
assert!(
state1.get_term() <= state2.get_term(),
"{:?} {:?}",
state1,
state2
);
assert!(
state1.get_index() <= state2.get_index(),
"{:?} {:?}",
state1,
state2
);
} | rust_cleaned_test_functions.jsonl/30710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1057
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37861,
53265,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
5478,
53265,
2099,
6984,
10652,
317,
262,
1077,
6223,
20537,
284,
14411,
5478,
62,
162... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ord() {
let cases = vec![
("2", 50),
("23", 50),
("2.3", 50),
("", 0),
("你好", 14990752),
("にほん", 14909867),
("한국", 15570332),
("👍", 4036989325),
("א", 55184),
];
for (input, expect) in cases {
let input = Datum::Bytes(input.as_bytes().to_vec());
let expect = Datum::I64(expect);
let got = eval_func(ScalarFuncSig::Ord, &[input]).unwrap();
assert_eq!(got, expect);
}
let got = eval_func(ScalarFuncSig::Ord, &[Datum::Null]).unwrap();
assert_eq!(got, Datum::Null);
} | rust_cleaned_test_functions.jsonl/44153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67324,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
497,
220,
20,
15,
1326,
310,
3489,
17,
18,
497,
220,
20,
15,
1326,
310,
3489,
17,
13,
18,
497,
220,
20,
15,
1326,
310,
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_compile_shift_right_c() {
let compiled = bitwise::compile_shift_right("C".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b01011110);
} | rust_cleaned_test_functions.jsonl/100615 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
22230,
10539,
666,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
22230,
10539,
445,
34,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
262,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_terminate() {
let location = TempLocation::new();
request_stream_test(
location.to_persistent_lifetime(),
Arc::new(Inspector::new()),
|proxy, ahc_client_end| {
async move {
proxy.create_account(ahc_client_end, TEST_ACCOUNT_ID.clone().into()).await??;
// Keep an open channel to an account.
let (account_client_end, account_server_end) = create_endpoints().unwrap();
let (acp_client_end, _) = create_endpoints().unwrap();
proxy.get_account(acp_client_end, account_server_end).await??;
let account_proxy = account_client_end.into_proxy().unwrap();
// Terminate the handler
proxy.terminate()?;
// Check that further operations fail
assert!(proxy.remove_account(FORCE_REMOVE_ON).await.is_err());
assert!(proxy.terminate().is_err());
// Make sure that the channel closed too.
assert!(account_proxy.get_auth_state().await.is_err());
Ok(())
}
},
);
} | rust_cleaned_test_functions.jsonl/36825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 668
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
48061,
368,
341,
286,
1077,
3728,
284,
19944,
4707,
486,
931,
543,
286,
1681,
12673,
4452,
1006,
310,
3728,
2389,
620,
13931,
98827,
3148,
310,
19689,
486,
931,
7,
46230,
486,
931,
14702,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_ssh_files() -> Result<()> {
let mut mock = MockFuchsiaPaths::new();
let data = format!(
"/usr/local/home/foo/.ssh/fuchsia_ed25519
/usr/local/home/foo/.ssh/fuchsia_authorized_keys
",
);
let tmp_dir = Builder::new().prefix("fvdl_tests_").tempdir()?;
let a = tmp_dir.into_path();
File::create(a.join(".fx-ssh-path"))?.write_all(data.as_bytes())?;
mock.expect_find_fuchsia_root().returning(move || Ok(a.clone()));
let mut ssh_files = SSHKeys::from_tree_env(&mut mock)?;
assert_eq!(
ssh_files.private_key.to_str().unwrap(),
"/usr/local/home/foo/.ssh/fuchsia_ed25519"
);
assert_eq!(
ssh_files.authorized_keys.to_str().unwrap(),
"/usr/local/home/foo/.ssh/fuchsia_authorized_keys"
);
let tmp_dir = Builder::new().prefix("fvdl_test_ssh_").tempdir()?;
ssh_files.stage_files(&tmp_dir.path().to_owned())?;
assert!(ssh_files.private_key.ends_with("id_ed25519"));
Ok(())
} | rust_cleaned_test_functions.jsonl/77517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82805,
10931,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
7860,
284,
14563,
37,
73391,
26901,
486,
931,
543,
286,
1077,
821,
284,
3561,
33673,
310,
3521,
7063,
22270,
18215,
60555,
11930,
25537,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_traditional() {
// note gnu od does not align both lines
let input = "abcdefghijklmnopq"; // spell-checker:disable-line
new_ucmd!()
.arg("--traditional")
.arg("-a")
.arg("-c")
.arg("-")
.arg("10")
.arg("0")
.run_piped_stdin(input.as_bytes())
.no_stderr()
.success()
.stdout_is(unindent(
r"
0000010 (0000000) i j k l m n o p q
i j k l m n o p q
0000021 (0000011)
",
));
} | rust_cleaned_test_functions.jsonl/48828 | {
"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,
3547,
329,
3005,
368,
341,
262,
442,
5185,
342,
8933,
10785,
1558,
537,
5285,
2176,
5128,
198,
262,
1077,
1946,
284,
330,
65102,
80,
5123,
442,
12845,
15934,
261,
42066,
8447,
198,
262,
501,
688... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_uppercase() {
let mut output = String::new();
let method = StringMethod {
method: "to_uppercase",
variable: "\"Ford Prefect\"",
pattern: "",
selection: Select::All,
};
method.handle(&mut output, &VariableExpander);
assert_eq!(output, "FORD PREFECT");
} | rust_cleaned_test_functions.jsonl/85278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
34445,
5638,
368,
341,
286,
1077,
5206,
2550,
284,
923,
486,
931,
543,
286,
1077,
1714,
284,
923,
3523,
341,
310,
1714,
25,
262,
330,
983,
34445,
5638,
756,
310,
3890,
25,
220,
15898,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_server_survives_30_rpc_errors() -> Result<()> {
let server = make_arc_test_server();
for _ in 0..30 {
let server_clone = server.clone();
let _ =
dispatch(server_clone, Aborting.name(), RequestMessage::new());
}
let reply = dispatch(
server,
Echo.name(),
RequestMessage::from_static(&[0x08, 0x07]),
)?;
assert_eq!(ReplyMessage::from_static(&[0x07, 0x08]), reply);
Ok(())
} | rust_cleaned_test_functions.jsonl/112199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
49946,
85,
1886,
62,
18,
15,
60799,
20196,
368,
1464,
5714,
71698,
341,
286,
1077,
3538,
284,
1281,
62914,
4452,
12015,
1428,
286,
369,
716,
304,
220,
15,
496,
18,
15,
341,
310,
1077,
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... | 3 |
#[test]
fn test_authorize_url_redirect_url_override() {
let client = new_client()
.set_redirect_uri(RedirectUrl::new("http://localhost:8888/".to_string()).unwrap());
let flow = CoreAuthenticationFlow::AuthorizationCode;
fn new_csrf() -> CsrfToken {
CsrfToken::new("CSRF123".to_string())
}
fn new_nonce() -> Nonce {
Nonce::new("NONCE456".to_string())
}
let (authorize_url, _, _) = client
.authorize_url(flow, new_csrf, new_nonce)
.add_scope(Scope::new("email".to_string()))
.set_display(CoreAuthDisplay::Touch)
.add_prompt(CoreAuthPrompt::Login)
.add_prompt(CoreAuthPrompt::Consent)
.set_max_age(Duration::from_secs(1800))
.add_ui_locale(LanguageTag::new("fr-CA".to_string()))
.add_ui_locale(LanguageTag::new("fr".to_string()))
.add_ui_locale(LanguageTag::new("en".to_string()))
.add_auth_context_value(AuthenticationContextClass::new(
"urn:mace:incommon:iap:silver".to_string(),
))
.set_redirect_url(Cow::Owned(
RedirectUrl::new("http://localhost:8888/alternative".to_string()).unwrap(),
))
.url();
assert_eq!(
"https://example/authorize?response_type=code&client_id=aaa&\
state=CSRF123&redirect_uri=http%3A%2F%2Flocalhost%3A8888%2Falternative&scope=openid+email&\
nonce=NONCE456&acr_values=urn%3Amace%3Aincommon%3Aiap%3Asilver&display=touch&\
max_age=1800&prompt=login+consent&ui_locales=fr-CA+fr+en",
authorize_url.to_string()
);
} | rust_cleaned_test_functions.jsonl/73892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 887
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
2903,
30043,
2903,
48576,
368,
341,
286,
1077,
2943,
284,
501,
8179,
741,
310,
659,
746,
30043,
15572,
2785,
291,
1226,
2864,
486,
931,
445,
1254,
1110,
8301,
25,
23,
23,
23,
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... | 1 |
#[test]
fn test_type_based_or_pruning() {
let schema = prepopulated_schema();
let known = Known::for_schema(&schema);
// This simplifies to:
// [:find ?x
// :where [?a :some/int ?x]
// [_ :some/otherint ?x]]
let query = r#"
[:find ?x
:where [?a :foo/age ?x]
(or [_ :foo/height ?x]
[_ :foo/name ?x])]"#;
let simple = r#"
[:find ?x
:where [?a :foo/age ?x]
[_ :foo/height ?x]]"#;
compare_ccs(alg(known, query), alg(known, simple));
} | rust_cleaned_test_functions.jsonl/44233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
66679,
8734,
5294,
37202,
368,
341,
286,
1077,
10802,
284,
855,
8374,
7757,
25371,
543,
286,
1077,
3881,
284,
48286,
486,
1958,
25371,
2099,
17349,
317,
286,
442,
1096,
15491,
9606,
311,
510... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chacha_true_values_c() {
// Test vector 4 from
let seed = [0, 0xff, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0];
let expected = [0xfb4dd572, 0x4bc42ef1, 0xdf922636, 0x327f1394,
0xa78dea8f, 0x5e269039, 0xa1bebbc1, 0xcaf09aae,
0xa25ab213, 0x48a6b46c, 0x1b9d9bcb, 0x092c5be6,
0x546ca624, 0x1bec45d5, 0x87f47473, 0x96f0992e];
let expected_end = 3 * 16;
let mut results = [0u32; 16];
// Test block 2 by skipping block 0 and 1
let mut rng1 = ChaChaRng::from_seed(seed);
for _ in 0..32 { rng1.next_u32(); }
for i in results.iter_mut() { *i = rng1.next_u32(); }
assert_eq!(results, expected);
assert_eq!(rng1.get_word_pos(), expected_end);
// Test block 2 by using `set_word_pos`
let mut rng2 = ChaChaRng::from_seed(seed);
rng2.set_word_pos(2 * 16);
for i in results.iter_mut() { *i = rng2.next_u32(); }
assert_eq!(results, expected);
assert_eq!(rng2.get_word_pos(), expected_end);
// Test skipping behaviour with other types
let mut buf = [0u8; 32];
rng2.fill_bytes(&mut buf[..]);
assert_eq!(rng2.get_word_pos(), expected_end + 8);
rng2.fill_bytes(&mut buf[0..25]);
assert_eq!(rng2.get_word_pos(), expected_end + 15);
rng2.next_u64();
assert_eq!(rng2.get_word_pos(), expected_end + 17);
rng2.next_u32();
rng2.next_u64();
assert_eq!(rng2.get_word_pos(), expected_end + 20);
rng2.fill_bytes(&mut buf[0..1]);
assert_eq!(rng2.get_word_pos(), expected_end + 21);
} | rust_cleaned_test_functions.jsonl/113001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1026
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
51576,
16082,
9146,
666,
368,
341,
286,
442,
3393,
4621,
220,
19,
504,
8945,
286,
1077,
10320,
284,
508,
15,
11,
220,
15,
9020,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_call_simple_does_not_enqueue_request_if_err() {
with_hypervisor(|hypervisor, tmp_path| {
let (canister, _, action, _) = execute_update(
&hypervisor,
r#"(module
(import "ic0" "call_simple"
(func $ic0_call_simple
(param i32 i32)
(param $method_name_src i32) (param $method_name_len i32)
(param $reply_fun i32) (param $reply_env i32)
(param $reject_fun i32) (param $reject_env i32)
(param $data_src i32) (param $data_len i32)
(result i32)))
(import "ic0" "trap" (func $ic_trap (param i32) (param i32)))
(func $test
(call $ic0_call_simple
(i32.const 100) (i32.const 10) ;; callee canister id = 777
(i32.const 0) (i32.const 18) ;; refers to "some_remote_method" on the heap
(i32.const 11) (i32.const 22) ;; fictive on_reply closure
(i32.const 33) (i32.const 44) ;; fictive on_reject closure
(i32.const 19) (i32.const 3) ;; refers to "XYZ" on the heap
)
drop
;; call_simple and then fail.
(call $ic_trap (i32.const 0) (i32.const 18)))
(export "canister_update test" (func $test))
(memory $memory 1)
(export "memory" (memory $memory))
(data (i32.const 0) "some_remote_method XYZ")
(data (i32.const 100) "\09\03\00\00\00\00\00\00\ff\01")
)"#,
"test",
EMPTY_PAYLOAD,
None,
tmp_path,
);
assert_eq!(
action,
CallContextAction::Fail {
error: HypervisorError::CalledTrap("some_remote_method".to_string()),
refund: Cycles::from(0),
}
);
assert_eq!(canister.system_state.queues.output_queues_len(), 0);
});
} | rust_cleaned_test_functions.jsonl/57855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
30015,
96374,
7913,
28395,
7893,
11119,
9266,
368,
341,
262,
448,
1523,
1082,
31396,
22428,
78243,
31396,
11,
4174,
2638,
91,
341,
286,
1077,
320,
4814,
1571,
11,
8358,
1917,
11,
27439,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_command() {
let ts = Target::Selected;
let ta = Target::All;
// Should succeed
assert_eq!(commands("q"), Ok(("", vec![Command::Quit])));
assert_eq!(commands("quit"), Ok(("", vec![Command::Quit])));
assert_eq!(commands("c"), Ok(("", vec![Command::Clear])));
assert_eq!(commands("clear"), Ok(("", vec![Command::Clear])));
assert_eq!(commands("h"), Ok(("", vec![Command::Help])));
assert_eq!(commands("help"), Ok(("", vec![Command::Help])));
assert_eq!(commands("e"), Ok(("", vec![Command::Edit])));
assert_eq!(commands("edit"), Ok(("", vec![Command::Edit])));
assert_eq!(commands(" \t \n\rquit "), Ok(("", vec![Command::Quit])));
assert_eq!(commands("run"), Ok(("", vec![Command::Run(Target::Selected)])));
assert_eq!(commands("run *"), Ok(("", vec![Command::Run(Target::All)])));
assert_eq!(commands("r*"), Ok(("", vec![Command::Run(Target::All)])));
assert_eq!(commands("show"), Ok(("", vec![Command::Show(Target::Selected)])));
assert_eq!(commands("s*"), Ok(("", vec![Command::Show(Target::All)])));
assert_eq!(commands("update"), Ok(("", vec![Command::Update(ts.clone())])));
assert_eq!(commands("u*"), Ok(("", vec![Command::Update(ta.clone())])));
assert_eq!(commands("u*;"), Ok(("", vec![Command::Update(ta.clone())])));
assert_eq!(commands("u;"), Ok(("", vec![Command::Update(ts.clone())])));
assert_eq!(commands("delete"), Ok(("", vec![Command::Delete(ts.clone())])));
assert_eq!(commands("d*"), Ok(("", vec![Command::Delete(ta.clone())])));
assert_eq!(commands("filter-"), Ok(("", vec![Command::Filter(Filter::Failed)])));
assert_eq!(commands("f-"), Ok(("", vec![Command::Filter(Filter::Failed)])));
assert_eq!(commands("f+"), Ok(("", vec![Command::Filter(Filter::Passed)])));
assert_eq!(commands("f~"), Ok(("", vec![Command::Filter(Filter::Waiting)])));
assert_eq!(
commands("f#tag"),
Ok(("", vec![Command::Filter(Filter::Tag(String::from("tag")))]))
);
assert_eq!(
commands("f name"),
Ok(("", vec![Command::Filter(Filter::Name(String::from("name")))]))
);
assert_eq!(commands("q;"), Ok(("", vec![Command::Quit])));
assert_eq!(commands("h; c"), Ok(("", vec![Command::Help, Command::Clear])));
assert_eq!(
commands("h; r * ; q;"),
Ok(("", vec![Command::Help, Command::Run(Target::All), Command::Quit]))
);
// Should return an error
assert_eq!(commands("qt"), Err(Error::custom(ErrorKind::UnknownCommand)));
assert_eq!(
commands("quit *"),
Err(Error::custom(ErrorKind::TooManyArguments(Command::Quit)))
);
assert_eq!(
commands("run * *"),
Err(Error::custom(ErrorKind::TooManyArguments(Command::Run(Target::All))))
);
} | rust_cleaned_test_functions.jsonl/320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10811,
368,
341,
286,
1077,
10591,
284,
13483,
486,
6316,
280,
286,
1077,
9450,
284,
13483,
486,
2403,
401,
286,
442,
12260,
11996,
198,
286,
2060,
10714,
10297,
24270,
445,
80,
3975,
7622,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partition() {
assert_eq!((box []).partition(|x: &int| *x < 3), (vec![], vec![]));
assert_eq!((box [1, 2, 3]).partition(|x: &int| *x < 4), (vec![1, 2, 3], vec![]));
assert_eq!((box [1, 2, 3]).partition(|x: &int| *x < 2), (vec![1], vec![2, 3]));
assert_eq!((box [1, 2, 3]).partition(|x: &int| *x < 0), (vec![], vec![1, 2, 3]));
} | rust_cleaned_test_functions.jsonl/75612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43840,
368,
341,
286,
2060,
10714,
0,
1188,
2011,
61556,
40998,
22428,
87,
25,
609,
396,
91,
353,
87,
366,
220,
18,
701,
320,
4083,
0,
12995,
7486,
0,
1294,
1106,
286,
2060,
10714,
0,
1188,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parameter() {
// Mocked dwarf data //
// Base types
let b0 = Rc::new(Type::Base { name: "short unsigned int".to_owned(), size: 2 });
let b1 = Rc::new(Type::Base { name: "unsigned int".to_owned(), size: 4 });
let b2 = Rc::new(Type::Base { name: "char".to_owned(), size: 1 });
// Alias types
let a1 = Rc::new(Type::Alias { name: "uint16_t".to_owned(), typ: b0.clone() });
let a2 = Rc::new(Type::Alias { name: "uint32_t".to_owned(), typ: b1.clone() });
// Reference types
let r0 = Rc::new(Type::Reference { typ: b2.clone() });
// Parameters
let p0 = Parameter { name: "first".to_owned(), typ: r0.clone() };
let p1 = Parameter { name: "second".to_owned(), typ: a1.clone() };
let p2 = Parameter { name: "third".to_owned(), typ: a2.clone() };
// Convert dwarf representation to generator representation.
let cp0: CParameter = p0.into();
let cp1: CParameter = p1.into();
let cp2: CParameter = p2.into();
// Expected CParameters //
let expected_cp0 = CParameter {
name: "first".to_owned(),
typ: "char*".to_owned(),
};
let expected_cp1 = CParameter {
name: "second".to_owned(),
typ: "uint16_t".to_owned(),
};
let expected_cp2 = CParameter {
name: "third".to_owned(),
typ: "uint32_t".to_owned(),
};
// Compare
assert_eq!(cp0, expected_cp0);
assert_eq!(cp1, expected_cp1);
assert_eq!(cp2, expected_cp2);
} | rust_cleaned_test_functions.jsonl/58821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 769
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
24899,
368,
1476,
286,
442,
14563,
291,
49461,
821,
34985,
286,
442,
5351,
4494,
198,
286,
1077,
293,
15,
284,
81463,
486,
931,
22498,
486,
3978,
314,
829,
25,
330,
8676,
3774,
526,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_valid_config_data() {
let mut setting = DefaultSetting::new(
Some(TestConfigData { value: 3 }),
"/config/data/fake_config_data.json",
None,
true,
);
assert_eq!(
setting.get_default_value().expect("Failed to get default value").unwrap().value,
10
);
} | rust_cleaned_test_functions.jsonl/113471 | {
"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,
12411,
8337,
5332,
1769,
368,
341,
286,
1077,
5206,
6243,
284,
7899,
15400,
486,
931,
1006,
310,
4329,
31159,
2648,
1043,
314,
897,
25,
220,
18,
11973,
310,
3521,
1676,
13167,
6663,
726,
5332,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_str_with_data_after_header() {
let s = r#"##fileformat=VCFv4.3
#CHROM POS ID REF ALT QUAL FILTER INFO
##contig=<ID=sq0,length=8>
"#;
assert_eq!(parse(s), Err(ParseError::ExpectedEof));
} | rust_cleaned_test_functions.jsonl/62672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
6615,
1769,
19844,
8757,
368,
341,
286,
1077,
274,
284,
435,
55543,
565,
1192,
2243,
28,
53,
9650,
85,
19,
13,
18,
198,
2,
2149,
3361,
197,
17456,
29580,
197,
5996,
197,
35830,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_small_signature_get_field() {
let mut registry = PredicateSignatureSmallRegistry::new();
let signature = PredicateSignatureSmall::new(&"hi".to_owned(), &vec![1, 2, 3], &mut registry);
assert_eq!(signature.get_field(0), 1);
assert_eq!(signature.get_field(1), 2);
assert_eq!(signature.get_field(2), 3);
assert_eq!(signature.get_field(3), 0);
} | rust_cleaned_test_functions.jsonl/119999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
39859,
3062,
5013,
368,
341,
262,
1077,
5206,
19424,
284,
49827,
25088,
25307,
15603,
486,
931,
543,
262,
1077,
11957,
284,
49827,
25088,
25307,
486,
931,
2099,
1,
6023,
3263,
983,
51973,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_secure_join() {
assert_eq!(
secure_join(Path::new("/tmp/rootfs"), Path::new("path")).unwrap(),
PathBuf::from("/tmp/rootfs/path")
);
assert_eq!(
secure_join(Path::new("/tmp/rootfs"), Path::new("more/path")).unwrap(),
PathBuf::from("/tmp/rootfs/more/path")
);
assert_eq!(
secure_join(Path::new("/tmp/rootfs"), Path::new("/absolute/path")).unwrap(),
PathBuf::from("/tmp/rootfs/absolute/path")
);
assert_eq!(
secure_join(
Path::new("/tmp/rootfs"),
Path::new("/path/with/../parent/./sample")
)
.unwrap(),
PathBuf::from("/tmp/rootfs/path/parent/sample")
);
assert_eq!(
secure_join(Path::new("/tmp/rootfs"), Path::new("/../../../../tmp")).unwrap(),
PathBuf::from("/tmp/rootfs/tmp")
);
assert_eq!(
secure_join(Path::new("/tmp/rootfs"), Path::new("./../../../../var/log")).unwrap(),
PathBuf::from("/tmp/rootfs/var/log")
);
assert_eq!(
secure_join(
Path::new("/tmp/rootfs"),
Path::new("../../../../etc/passwd")
)
.unwrap(),
PathBuf::from("/tmp/rootfs/etc/passwd")
);
} | rust_cleaned_test_functions.jsonl/51831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 773
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73088,
31017,
368,
341,
286,
2060,
10714,
33673,
310,
9767,
31017,
33030,
486,
931,
4283,
5173,
72074,
3848,
3975,
7933,
486,
931,
445,
2343,
15197,
15454,
3148,
310,
7933,
15064,
486,
1499,
4283,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load1() {
let mut vm = VirtualMachine::new();
vm.add_external_function(
FunctionDeclaration::with_external(
"set_point_x".to_owned(), vec![TypeId::Class("Point".to_owned()), TypeId::Int32], TypeId::Void,
set_point_x as *mut std::ffi::c_void
)
);
vm.add_class(Class::new(
"Point".to_owned(),
vec![
Field::new("x".to_owned(), TypeId::Int32),
Field::new("y".to_owned(), TypeId::Int32),
]
));
vm.add_function(Function::new(
FunctionDeclaration::with_managed("main".to_owned(), Vec::new(), TypeId::Int32),
vec![TypeId::Class("Point".to_owned())],
vec![
Instruction::NewObject("Point".to_owned()),
Instruction::StoreLocal(0),
Instruction::LoadLocal(0),
Instruction::LoadInt32(i32::MIN),
Instruction::Call(FunctionSignature::new("set_point_x".to_owned(), vec![TypeId::Class("Point".to_owned()), TypeId::Int32])),
Instruction::LoadLocal(0),
Instruction::LoadField("Point".to_owned(), "x".to_owned()),
Instruction::Return,
]
)).unwrap();
let execution_result = vm.execute().unwrap();
assert_eq!(i32::MIN, execution_result);
} | rust_cleaned_test_functions.jsonl/17392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 600
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
16,
368,
341,
262,
1077,
5206,
10995,
284,
20721,
21605,
486,
931,
1428,
262,
10995,
1364,
47432,
9174,
1006,
286,
5712,
24489,
486,
4197,
47432,
1006,
310,
330,
746,
6085,
3212,
3263,
983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_docs() {
// Make sure that scripts have non-empty documentation.
for script in StdlibScript::all() {
assert!(
!script.abi().doc().is_empty(),
"The main function in language/stdlib/transaction_scripts/{}.move does not have a `///` inline doc comment. Please fix the issue and re-run (cd language/stdlib && cargo run --release)",
script.name(),
);
}
} | rust_cleaned_test_functions.jsonl/5632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49692,
368,
341,
286,
442,
7405,
2704,
429,
19502,
614,
2477,
39433,
9705,
624,
286,
369,
5316,
304,
42517,
2740,
5910,
486,
541,
368,
341,
310,
2060,
33673,
394,
753,
2282,
22048,
72,
1005,
523... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vect_add() {
let vec1 = vec![1.0, 2.0, 3.0, 4.0];
let vec2 = vec![1.0, 2.0, 3.0, 4.0];
let vectors = Vectors::new(vec1, vec2).unwrap();
let vec_add = vectors.add();
assert_eq!(vec_add, vec![2.0, 4.0, 6.0, 8.0])
} | rust_cleaned_test_functions.jsonl/60424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59402,
2891,
368,
341,
286,
1077,
7486,
16,
284,
7486,
20703,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
935,
286,
1077,
7486,
17,
284,
7486,
20703,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_system_time_bounds_assumptions() {
assert_eq!(
::PositiveTimestamp::from_unix_timestamp(::MAX_TIMESTAMP + 1),
Err(::CreationError::TimestampOutOfBounds)
);
} | rust_cleaned_test_functions.jsonl/86633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17687,
3009,
36878,
12083,
372,
1300,
368,
341,
197,
6948,
10714,
33673,
298,
197,
486,
35490,
20812,
486,
1499,
80572,
23073,
38732,
10586,
47854,
488,
220,
16,
1326,
298,
197,
7747,
38732,
32701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_request_with_normal_priority() {
let builder = PlainNotificationBuilder::new("test");
let payload = builder.build(
"a_test_id",
NotificationOptions {
apns_priority: Some(Priority::Normal),
..Default::default()
},
);
let client = Client::new(AlpnConnector::new(), None, Endpoint::Production);
let request = client.build_request(payload);
let apns_priority = request.headers().get("apns-priority").unwrap();
assert_eq!("5", apns_priority);
} | rust_cleaned_test_functions.jsonl/109650 | {
"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,
7893,
6615,
13973,
38161,
368,
341,
286,
1077,
7363,
284,
43199,
11196,
3297,
486,
931,
445,
1944,
3071,
286,
1077,
7729,
284,
7363,
13239,
1006,
310,
330,
64,
4452,
842,
756,
310,
16571,
3798,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_start_clients_fails() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
// Create a configured ClientIfaceContainer.
let test_values = test_setup(&mut exec);
let (mut iface_manager, _) = create_iface_manager_with_client(&test_values, true);
iface_manager.phy_manager =
Arc::new(Mutex::new(FakePhyManager { create_iface_ok: false, destroy_iface_ok: true }));
let start_fut = iface_manager.start_client_connections();
pin_mut!(start_fut);
assert_variant!(exec.run_until_stalled(&mut start_fut), Poll::Ready(Err(_)));
} | rust_cleaned_test_functions.jsonl/62708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
56899,
761,
6209,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
442,
4230,
264,
19755,
8423,
40,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_systemtime_overflow() {
assert_de_tokens_error::<SystemTime>(
&[
Token::Seq { len: Some(2) },
Token::U64(u64::max_value()),
Token::U32(0),
Token::SeqEnd,
],
"overflow deserializing SystemTime",
);
} | rust_cleaned_test_functions.jsonl/129553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17687,
1678,
79073,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
2320,
1462,
17055,
286,
609,
9640,
310,
9660,
486,
20183,
314,
2422,
25,
4329,
7,
17,
8,
1153,
310,
9660,
486,
52,
21,
19,
81... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 b = Star5Group120 {
list: vec![1, 2, 3, 5, 6, 7, 8],
};
assert_eq!(b.sum(), 21);
let result = &vec![8, 7, 5, 1, 2];
let m = Outcome::new(result, lotto5::transform::all);
let r = b.bin2go(&m);
assert!(r);
} | rust_cleaned_test_functions.jsonl/60046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
368,
341,
286,
1077,
293,
284,
7679,
20,
2808,
16,
17,
15,
341,
310,
1140,
25,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
1259,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_supermajority_root_from_vote_accounts() {
let convert_to_vote_accounts =
|roots_stakes: Vec<(Slot, u64)>| -> Vec<(Pubkey, (u64, Account))> {
roots_stakes
.into_iter()
.map(|(root, stake)| {
let mut vote_state = VoteState::default();
vote_state.root_slot = Some(root);
let mut vote_account =
Account::new(1, VoteState::size_of(), &solana_vote_program::id());
let versioned = VoteStateVersions::Current(Box::new(vote_state));
VoteState::serialize(&versioned, &mut vote_account.data).unwrap();
(solana_sdk::pubkey::new_rand(), (stake, vote_account))
})
.collect_vec()
};
let total_stake = 10;
let slot = 100;
// Supermajority root should be None
assert!(
supermajority_root_from_vote_accounts(slot, total_stake, std::iter::empty()).is_none()
);
// Supermajority root should be None
let roots_stakes = vec![(8, 1), (3, 1), (4, 1), (8, 1)];
let accounts = convert_to_vote_accounts(roots_stakes);
assert!(
supermajority_root_from_vote_accounts(slot, total_stake, accounts.into_iter())
.is_none()
);
let roots_stakes = vec![(8, 1), (3, 1), (4, 1), (8, 5)];
let accounts = convert_to_vote_accounts(roots_stakes);
assert_eq!(
supermajority_root_from_vote_accounts(slot, total_stake, accounts.into_iter()).unwrap(),
4
);
let roots_stakes = vec![(8, 1), (3, 1), (4, 1), (8, 6)];
let accounts = convert_to_vote_accounts(roots_stakes);
assert_eq!(
supermajority_root_from_vote_accounts(slot, total_stake, accounts.into_iter()).unwrap(),
8
);
} | rust_cleaned_test_functions.jsonl/118178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1063
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38886,
36505,
487,
12993,
5673,
54360,
55665,
368,
341,
286,
1077,
5508,
2346,
54360,
55665,
4035,
310,
760,
37165,
1261,
2050,
25,
11312,
28706,
19877,
11,
575,
21,
19,
16018,
91,
1464,
11312,
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_execute_detects_invalid_opcode() {
let mut machine = Machine::new(vec![55]);
assert_eq!(machine.execute(), Err(Error::InvalidOpcode {opcode: 55, ip: 0}));
} | rust_cleaned_test_functions.jsonl/43092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
56457,
82,
31433,
71319,
368,
341,
10217,
5206,
5662,
284,
12960,
486,
931,
25592,
20703,
20,
20,
2558,
6948,
10714,
10297,
32056,
7769,
1507,
15495,
37396,
486,
7928,
44189,
314,
48128,
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 |
#[test]
fn test_hover_test_mod_has_action() {
check_actions(
r#"
mod tests$0 {
#[test]
fn foo_test() {}
}
"#,
expect![[r#"
[
Runnable(
Runnable {
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 0..46,
focus_range: 4..9,
name: "tests",
kind: Module,
},
kind: TestMod {
path: "tests",
},
cfg: None,
},
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/117788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
4452,
7480,
21778,
7931,
368,
341,
286,
1779,
25368,
1006,
310,
435,
2,
698,
2593,
7032,
3,
15,
341,
262,
11506,
1944,
921,
262,
5168,
15229,
4452,
368,
5613,
532,
57676,
345,
310,
1720,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quenya() {
quenya("quenya:");
quenya(
"tinco parma calma qessë ando umbar anga ungwë\
\nþúlë formen harma hwesta anto ampa anca unqë\
\nnúmen malta ngoldo ngwalmë orë vala anna wilya\
\nrómen arda lambë alda silmë ázë essë\
\nhyarmen yanta úrë ossë halla telco ára"
);
// quenya("hrívë, hlócë");
} | rust_cleaned_test_functions.jsonl/54410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
268,
7755,
368,
341,
262,
922,
268,
7755,
445,
446,
268,
7755,
24305,
262,
922,
268,
7755,
1006,
286,
330,
55971,
1015,
1346,
1728,
1620,
1728,
2804,
433,
12179,
323,
78,
4443,
2257,
6454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_house_ranks() {
test(
&vec!["4H 4S 4D 9S 9D", "5H 5S 5D 8S 8D"],
&vec!["5H 5S 5D 8S 8D"],
)
} | rust_cleaned_test_functions.jsonl/121279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
64270,
1710,
4039,
368,
341,
1066,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
19,
39,
220,
19,
50,
220,
19,
35,
220,
24,
50,
220,
24,
35,
497,
330,
20,
39,
220,
20,
50,
220,
20,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_and_with_multiple_in_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let name2 = _random_vector(10);
let value2 = _random_string(10);
let name3 = _random_vector(10);
let value3 = _random_string(10);
let query = Operator::And(
vec![
Operator::In(
TagName::PlainTagName(name1.clone()),
vec![TargetValue::Unencrypted(value1.clone())]
),
Operator::In(
TagName::PlainTagName(name2.clone()),
vec![TargetValue::Unencrypted(value2.clone())]
),
Operator::In(
TagName::PlainTagName(name3.clone()),
vec![TargetValue::Unencrypted(value3.clone())]
)
]
);
let json = query.to_string();
let expected = format!(r#"{{"$and":[{{"~{}":{{"$in":["{}"]}}}},{{"~{}":{{"$in":["{}"]}}}},{{"~{}":{{"$in":["{}"]}}}}]}}"#,
base64::encode(&name1), value1,
base64::encode(&name2), value2,
base64::encode(&name3), value3
);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 762
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
6615,
45233,
1243,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
829,
17,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decimal_as_duration() {
test_none_with_ctx_and_extra(cast_decimal_as_duration);
let cs = vec![
Decimal::from(i64::MIN),
Decimal::from(i64::MAX),
Decimal::from(u64::MAX),
Decimal::zero(),
Decimal::from_bytes(b"-9223372036854775808")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"9223372036854775808")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-9223372036854775809")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"9223372036854775809")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-18446744073709551615")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"18446744073709551615")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-18446744073709551616")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"18446744073709551616")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-184467440737095516160")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"184467440737095516160")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-99999999999999999999999999999999")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"99999999999999999999999999999999")
.unwrap()
.unwrap(),
];
let cs_ref: Vec<&Decimal> = cs.iter().collect();
test_as_duration_helper(
cs_ref,
|x| x.to_string(),
|x| x.to_string(),
cast_decimal_as_duration,
"cast_decimal_as_duration",
);
} | rust_cleaned_test_functions.jsonl/1993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
11898,
25454,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
74429,
11898,
25454,
626,
286,
1077,
10532,
284,
7486,
90515,
310,
26728,
486,
1499,
1956,
21,
19,
486,
16413,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fully_yanked_crate_404s() {
wrapper(|env| {
env.fake_release()
.name("dummy")
.version("1.0.0")
.yanked(true)
.create()?;
assert_eq!(
env.frontend().get("/crate/dummy").send()?.status(),
StatusCode::NOT_FOUND
);
assert_eq!(
env.frontend().get("/dummy").send()?.status(),
StatusCode::NOT_FOUND
);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/13868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
21965,
4178,
40772,
666,
7698,
62,
19,
15,
19,
82,
368,
341,
286,
13261,
22428,
3160,
91,
341,
310,
6105,
94624,
24577,
741,
394,
659,
606,
445,
31390,
1138,
394,
659,
4366,
445,
16,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_step() {
let memory = parse(r#"3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0"#);
let mut cpu = CPU::new(memory.to_owned(), 0, None);
loop {
match cpu.step() {
Ok(Step::NeedInput) => break,
Ok(Step::Continue) => {}
state => panic!("invalid state {:?}", state),
}
}
println!("test_step ip: {}", cpu.ip);
assert_eq!(memory.last(), Some(&0));
} | rust_cleaned_test_functions.jsonl/85144 | {
"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,
11946,
368,
341,
286,
1077,
4938,
284,
4715,
2601,
55543,
18,
11,
16,
20,
11,
18,
11,
16,
21,
11,
16,
15,
15,
17,
11,
16,
21,
11,
16,
15,
11,
16,
21,
11,
16,
11,
16,
21,
11,
16,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_color() {
let mut buf = MaybeUninit::uninit();
let string = Color(0xA0A0A0).as_str(&mut buf);
assert_eq!(string, "A0A0A0");
} | rust_cleaned_test_functions.jsonl/23346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
368,
341,
262,
1077,
5206,
6607,
284,
10696,
1806,
2327,
486,
359,
2327,
543,
262,
1077,
914,
284,
3478,
7,
15,
14673,
15,
32,
15,
32,
15,
568,
300,
2895,
2099,
6984,
6607,
317,
262,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_try_from_u8_slice() -> Result<(), TryFromByteArrayError> {
let codes = [0x93, 0x1b, 0x6c, 0xb1, 0xc6];
let matrix = SubstitutionMatrix::try_from(codes)?;
let actual = &matrix.substitutions;
let expected = &[
[Base::T, Base::G, Base::C, Base::N],
[Base::A, Base::G, Base::T, Base::N],
[Base::N, Base::A, Base::C, Base::T],
[Base::G, Base::N, Base::A, Base::C],
[Base::C, Base::G, Base::T, Base::A],
];
assert_eq!(actual, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/34295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
7300,
23,
26488,
368,
1464,
5714,
68843,
9735,
3830,
18394,
1454,
29,
341,
286,
1077,
13912,
284,
508,
15,
87,
24,
18,
11,
220,
15,
87,
16,
65,
11,
220,
15,
87,
21,
66,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bytewise_backspace_is_not_word_boundary() {
new_ucmd!()
.args(&["-w10", "-s", "-b"])
.pipe_in("foobar\x0889abcdef")
.succeeds()
.stdout_is("foobar\x0889a\nbcdef");
} | rust_cleaned_test_functions.jsonl/23316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3710,
83,
24350,
3895,
8746,
6892,
7913,
13533,
54004,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
16,
15,
497,
6523,
82,
497,
6523,
65,
14108,
286,
659,
13768... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_api_public_get_lect_nonexistent_validator() {
let testkit = AnchoringTestKit::default();
let api = testkit.api();
api.current_lect_of_validator(100);
} | rust_cleaned_test_functions.jsonl/80046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
27074,
3062,
62,
767,
21637,
64085,
64959,
368,
341,
262,
1077,
1273,
8226,
284,
71484,
5503,
2271,
7695,
486,
2258,
543,
262,
1077,
6330,
284,
1273,
8226,
6183,
543,
262,
6330,
4952,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_take_i32() {
let cxx = indoc! {"
uint32_t take_int(uint32_t a) {
return a + 3;
}
"};
let hdr = indoc! {"
#include <cstdint>
uint32_t take_int(uint32_t a);
"};
let rs = quote! {
assert_eq!(ffi::take_int(3), 6);
};
run_test(cxx, hdr, rs, &["take_int"], &[]);
} | rust_cleaned_test_functions.jsonl/9721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
5318,
18,
17,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
2622,
18,
17,
528,
1896,
4042,
8488,
18,
17,
528,
264,
8,
341,
310,
470,
264,
488,
220,
18,
280,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_state_hash() {
let sandbox = timestamping_sandbox();
let sandbox_state = SandboxState::new();
//we do not change the state hash in between blocks for TimestampingService for now
for _ in 0..2 {
let state_hash = sandbox.last_state_hash();
let configs_rh = sandbox.get_configs_merkle_root();
let configs_key = Blockchain::service_table_unique_key(CONSENSUS, 0);
let timestamp_t1_key = Blockchain::service_table_unique_key(TIMESTAMPING_SERVICE, 0);
let timestamp_t2_key = Blockchain::service_table_unique_key(TIMESTAMPING_SERVICE, 1);
let proof_configs = sandbox.get_proof_to_service_table(CONSENSUS, 0);
let proof = proof_configs.check().unwrap();
assert_eq!(proof.merkle_root(), state_hash);
assert_ne!(configs_rh, Hash::zero());
assert_eq!(proof.entries(), vec![(&configs_key, &configs_rh)]);
let proof_configs = sandbox.get_proof_to_service_table(TIMESTAMPING_SERVICE, 0);
let proof = proof_configs.check().unwrap();
assert_eq!(proof.merkle_root(), state_hash);
assert_eq!(
proof.entries(),
vec![(×tamp_t1_key, &Hash::new([127; 32]))]
);
let proof_configs = sandbox.get_proof_to_service_table(TIMESTAMPING_SERVICE, 1);
let proof = proof_configs.check().unwrap();
assert_eq!(proof.merkle_root(), state_hash);
assert_eq!(
proof.entries(),
vec![(×tamp_t2_key, &Hash::new([128; 32]))]
);
add_one_height(&sandbox, &sandbox_state)
}
} | rust_cleaned_test_functions.jsonl/8875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
4387,
8950,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
543,
262,
1077,
42754,
4387,
284,
96860,
1397,
486,
931,
543,
262,
442,
896,
653,
537,
2297,
279,
1584,
5175,
304,
1948... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_with_input() {
use std::env::var;
let path = var("RASTER").expect("env: RASTER not found");
let t = transform_from_dataset(&Dataset::open(Path::new(&path)).unwrap());
for i in 0..3 {
eprint!("[");
for j in 0..3 {
eprint!("{:15.3}", t[(i, j)]);
}
eprintln!("]")
}
let pt = t.transform_point(&Point2::new(0.0, 0.0));
eprintln!("(0, 0) -> ({:15.3},{:15.3})", pt.x, pt.y);
} | rust_cleaned_test_functions.jsonl/88916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
5898,
368,
341,
286,
990,
1460,
486,
3160,
486,
947,
280,
286,
1077,
1815,
284,
762,
445,
5609,
37923,
1827,
17119,
445,
3160,
25,
431,
29651,
537,
1730,
797,
286,
1077,
259,
284,
5165,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_perfect_matching() {
let haystack = "111 a 111b";
let needle = "111 a 111b";
rsearch_test!(haystack, needle, Some(0));
} | rust_cleaned_test_functions.jsonl/19414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5678,
3751,
70763,
368,
341,
286,
1077,
88447,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
876,
286,
1077,
30309,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
876,
286,
435,
1836,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_remove_dbg_not_applicable() {
check_assist_not_applicable(remove_dbg, "<|>vec![1, 2, 3]");
check_assist_not_applicable(remove_dbg, "<|>dbg(5, 6, 7)");
check_assist_not_applicable(remove_dbg, "<|>dbg!(5, 6, 7");
} | rust_cleaned_test_functions.jsonl/72614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
44124,
7913,
8191,
46114,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
67709,
44124,
11,
4055,
91,
29,
4083,
20703,
16,
11,
220,
17,
11,
220,
18,
37389,
286,
1779,
12083,
380,
7913... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_modulation() {
let mut rfm = setup_rfm(Vec::new(), vec![0, 0]);
rfm.modulation(Modulation {
data_mode: DataMode::Packet,
modulation_type: ModulationType::Fsk,
shaping: ModulationShaping::Shaping00,
})
.ok()
.unwrap();
assert_eq!(
rfm.spi.rx_buffer[0..=1],
[Registers::DataModul.write(), 0b00_00_0_00]
);
rfm.spi.rx_buffer.clear();
rfm.modulation(Modulation {
data_mode: DataMode::ContinuousBitSync,
modulation_type: ModulationType::Fsk,
shaping: ModulationShaping::Shaping00,
})
.ok()
.unwrap();
assert_eq!(
rfm.spi.rx_buffer[0..=1],
[Registers::DataModul.write(), 0b11_00_0_00]
);
rfm.spi.rx_buffer.clear();
rfm.modulation(Modulation {
data_mode: DataMode::ContinuousBitSync,
modulation_type: ModulationType::Ook,
shaping: ModulationShaping::Shaping00,
})
.ok()
.unwrap();
assert_eq!(
rfm.spi.rx_buffer[0..=1],
[Registers::DataModul.write(), 0b11_01_0_00]
);
rfm.spi.rx_buffer.clear();
rfm.modulation(Modulation {
data_mode: DataMode::ContinuousBitSync,
modulation_type: ModulationType::Ook,
shaping: ModulationShaping::Shaping10,
})
.ok()
.unwrap();
assert_eq!(
rfm.spi.rx_buffer[0..=1],
[Registers::DataModul.write(), 0b11_01_0_10]
);
} | rust_cleaned_test_functions.jsonl/3689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 716
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
2914,
368,
341,
262,
1077,
5206,
435,
21112,
284,
6505,
1710,
21112,
49923,
486,
931,
1507,
7486,
20703,
15,
11,
220,
15,
10149,
262,
435,
21112,
10929,
2914,
71956,
2914,
341,
286,
821,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_send_sync() {
let data = ArrayVec::<[Vec<i32>; 5]>::new();
&data as &dyn Send;
&data as &dyn Sync;
} | rust_cleaned_test_functions.jsonl/36767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
13565,
23008,
368,
341,
262,
1077,
821,
284,
2910,
10050,
27638,
58,
10050,
21897,
18,
17,
65795,
220,
20,
60,
6831,
931,
543,
262,
609,
691,
438,
609,
43085,
11000,
280,
262,
609,
691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_treeseq_new_from_tables() {
let tables = make_small_table_collection();
let treeseq = TreeSequence::new(tables, TreeSequenceFlags::default()).unwrap();
let samples = treeseq.sample_nodes();
assert_eq!(samples.len(), 2);
for i in 1..3 {
assert_eq!(samples[i - 1], NodeId::from(i as tsk_id_t));
}
} | rust_cleaned_test_functions.jsonl/23022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
528,
265,
2367,
80,
5921,
5673,
35632,
368,
341,
286,
1077,
12632,
284,
1281,
31966,
5237,
25019,
543,
286,
1077,
4258,
2367,
80,
284,
8942,
14076,
486,
931,
1155,
4788,
11,
8942,
14076,
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... | 2 |
#[test]
fn test_font_regexp_order1() {
let reg = init_font_regexp();
let caps = reg.captures("bold italic 50px Arial, sans-serif");
assert!(caps.is_some());
let caps = caps.unwrap();
assert_eq!(caps.get(2).map(|m| m.as_str()), Some("italic")); // style
assert_eq!(caps.get(3), None); // variant
assert_eq!(caps.get(4).map(|m| m.as_str()), Some("bold")); // weight
assert_eq!(caps.get(5), None); // stretch
assert_eq!(caps.get(7).map(|m| m.as_str()), Some("50")); // size
assert_eq!(caps.get(8).map(|m| m.as_str()), Some("px")); // unit
assert_eq!(caps.get(9).map(|m| m.as_str()), Some("Arial, sans-serif")); // family
} | rust_cleaned_test_functions.jsonl/15473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17451,
4920,
4580,
7869,
16,
368,
341,
220,
1077,
1217,
284,
2930,
17451,
4920,
4580,
543,
220,
1077,
18568,
284,
1217,
520,
2689,
1413,
445,
14824,
60763,
220,
20,
15,
1767,
52771,
11,
15510,
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_refractions() {
let mut world = World::default();
let s1 = Sphere::new(
Matrix::identity(4),
Material::new(
Some(Color::new(0.8, 1.0, 0.6)),
None,
0.1, 0.7, 0.2, 200.0, 0.0, 0.0, 1.0
),
);
let s2 = Sphere::new(
Matrix::scaling(0.5, 0.5, 0.5),
Material::default(),
);
let mut floor_material = Material::default();
floor_material.transparency = 0.5;
floor_material.refractive_index = 1.5;
let floor = Plane::new(
Matrix::translation(0.0, -1.0, 0.0),
floor_material
);
let mut ball_material = Material::default();
ball_material.color = Some(Color::new(1.0, 0.0, 0.0));
ball_material.ambient = 0.5;
let ball = Sphere::new(
Matrix::translation(0.0, -3.5, -0.5),
ball_material
);
world.objects = vec![Box::new(s1), Box::new(s2), Box::new(floor), Box::new(ball)];
let ray = Ray {
origin: Tuple::point(0.0, 0.0, -3.0),
direction: Tuple::vector(0.0, -2.0f64.sqrt() / 2.0, 2.0f64.sqrt() / 2.0),
};
let color = world.color_at(&ray, 0);
assert_eq!(color, Color::new(0.93642, 0.68642, 0.68642));
} | rust_cleaned_test_functions.jsonl/45915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 744
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
956,
5136,
368,
341,
286,
1077,
5206,
1879,
284,
4337,
486,
2258,
1428,
286,
1077,
274,
16,
284,
54499,
486,
931,
1006,
310,
11631,
486,
16912,
7,
19,
1326,
310,
10230,
486,
931,
1006,
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_proof_path_len() {
let b = ProofPath::from_raw(*b"\x01qwertyuiopasdfghjklzxcvbnm123456\x00");
assert_eq!(b.len(), 256);
} | rust_cleaned_test_functions.jsonl/25538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86757,
2638,
6043,
368,
341,
262,
1077,
293,
284,
36991,
1820,
486,
1499,
16067,
4071,
65,
11934,
87,
15,
16,
69291,
1344,
1963,
453,
76615,
866,
73,
10561,
89,
8148,
85,
11081,
76,
16,
17,
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 |
#[test]
fn test_dollar_var() {
test_statement(b"select $a+b; $ test; $a+b; $ ;", 12);
test_statement(b"select $a b; $ test; $a b; $ ;", 12);
} | rust_cleaned_test_functions.jsonl/44563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
21295,
4612,
368,
341,
262,
1273,
37404,
1883,
1,
1742,
400,
64,
35093,
26,
400,
1273,
26,
400,
64,
35093,
26,
400,
2587,
497,
220,
16,
17,
317,
262,
1273,
37404,
1883,
1,
1742,
400,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_n_peers_for_sanity() {
let a_0 = agent::ZeroAgent::new("tcp://127.0.0.1:5004".to_string());
a_0.activate();
let a_1 = agent::ZeroAgent::new("tcp://127.0.0.1:5005".to_string());
a_1.add_peer("tcp://127.0.0.1:5004".to_string());
a_1.activate();
thread::sleep(time::Duration::from_secs(2 * agent::TIMEOUT));
// both should know about each other:
assert_eq!(a_0.get_n_peers(), 2);
assert_eq!(a_1.get_n_peers(), 2);
send_kill("tcp://127.0.0.1:5004");
send_kill("tcp://127.0.0.1:5005");
} | rust_cleaned_test_functions.jsonl/104682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1089,
36367,
388,
5478,
643,
38270,
368,
341,
286,
1077,
264,
62,
15,
284,
8315,
486,
17999,
16810,
486,
931,
445,
27161,
1110,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
20,
15,
15,
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_fold_step_v2() {
let client = graph_serializer(GraphSON::V2);
drop_vertices(&client, "test_fold_step").unwrap();
create_vertex_with_label(&client, "test_fold_step", "Count");
let g = traversal().with_remote(client);
let results = g
.v(())
.has_label("test_fold_step")
.values("name")
.fold()
.to_list()
.unwrap();
assert_eq!(1, results.len());
let value = &results[0];
assert_eq!("Count", value[0].get::<String>().unwrap());
} | rust_cleaned_test_functions.jsonl/26292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
11946,
2273,
17,
368,
341,
262,
1077,
2943,
284,
4771,
67441,
63779,
2703,
486,
53,
17,
626,
262,
5943,
37720,
2099,
2972,
11,
330,
1944,
61187,
11946,
1827,
15454,
1428,
262,
1855,
26611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pool_max_idle_per_host() {
let pool = pool_max_idle_no_timer(2);
let key = host_key("foo");
pool.pooled(c(key.clone()), Uniq(41));
pool.pooled(c(key.clone()), Uniq(5));
pool.pooled(c(key.clone()), Uniq(99));
assert_eq!(
pool.locked().idle.get(&key).map(|entries| entries.len()),
Some(2)
);
} | rust_cleaned_test_functions.jsonl/122373 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15709,
6345,
47810,
5678,
12848,
368,
341,
286,
1077,
7314,
284,
7314,
6345,
47810,
6536,
16255,
7,
17,
317,
286,
1077,
1376,
284,
3468,
3097,
445,
7975,
3071,
286,
7314,
556,
45073,
1337,
4857,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deref_mut_rc() {
let str_pool : Pool<String> = Pool::with_size(1);
let mut rstring = str_pool.new_rc_from("cat");
rstring.push_str("s love eating mice");
assert_eq!("cats love eating mice", *rstring);
} | rust_cleaned_test_functions.jsonl/121186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
43970,
29523,
30299,
368,
341,
414,
1077,
607,
15709,
549,
22728,
3464,
29,
284,
22728,
486,
4197,
2368,
7,
16,
317,
414,
1077,
5206,
435,
917,
284,
607,
15709,
4618,
30299,
5673,
445,
4616... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_write_padded_offset() {
let rng = &mut XorShiftRng::from_seed(crate::TEST_SEED);
let len = 1016;
let mut data: Vec<u8> = (0..len).map(|_| rng.gen()).collect();
let buf = Vec::new();
let mut cursor = Cursor::new(buf);
write_padded(&mut data[..].as_ref(), &mut cursor).unwrap();
let padded = cursor.into_inner();
{
let mut unpadded = Vec::new();
write_unpadded(&padded, &mut unpadded, 0, 1016).unwrap();
let expected = &data[0..1016];
assert_eq!(expected.len(), unpadded.len());
assert_eq!(expected, &unpadded[..]);
}
{
let mut unpadded = Vec::new();
write_unpadded(&padded, &mut unpadded, 0, 44).unwrap();
let expected = &data[0..44];
assert_eq!(expected.len(), unpadded.len());
assert_eq!(expected, &unpadded[..]);
}
let excessive_len = 35;
for start in (1016 - excessive_len + 2)..1016 {
assert!(write_unpadded(&padded, &mut Vec::new(), start, excessive_len).is_err());
}
} | rust_cleaned_test_functions.jsonl/33001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9165,
620,
16828,
6917,
368,
341,
286,
1077,
28422,
284,
609,
6984,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
54907,
486,
10033,
3620,
1479,
626,
286,
1077,
2422,
284,
220,
16,
15,
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_60bit_stream_id() {
// Create new codec object for encoding and decoding our frame.
let mut codec = Codec::new();
// Create a u64 stream ID.
let id: u64 = u32::MAX as u64 + 1;
let stream_id = LocalStreamId {
num: id,
role: Endpoint::Dialer,
};
// Open a new frame with that stream ID.
let original_frame = Frame::Open { stream_id };
// Encode that frame.
let mut enc_frame = BytesMut::new();
codec
.encode(original_frame, &mut enc_frame)
.expect("Encoding to succeed.");
// Decode encoded frame and extract stream ID.
let dec_string_id = codec
.decode(&mut enc_frame)
.expect("Decoding to succeed.")
.map(|f| f.remote_id())
.unwrap();
assert_eq!(dec_string_id.num, stream_id.num);
} | rust_cleaned_test_functions.jsonl/90009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
21,
15,
4489,
12673,
842,
368,
341,
286,
442,
4230,
501,
34647,
1633,
369,
11170,
323,
47116,
1039,
4034,
624,
286,
1077,
5206,
34647,
284,
67077,
486,
931,
543,
286,
442,
4230,
264,
575,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_save() {
let spec = Spec {
..Default::default()
};
let test_dir = tempfile::tempdir().expect("failed to create tmp test dir");
let spec_path = test_dir.into_path().join("config.json");
// The before and after should be the same.
spec.save(&spec_path).expect("failed to save spec");
let loaded_spec = Spec::load(&spec_path).expect("failed to load the saved spec.");
assert_eq!(
spec, loaded_spec,
"The saved spec is not the same as the loaded spec"
);
} | rust_cleaned_test_functions.jsonl/63325 | {
"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,
12411,
15376,
368,
341,
286,
1077,
1398,
284,
10956,
341,
310,
5241,
3675,
486,
2258,
741,
286,
2605,
286,
1077,
1273,
4334,
284,
54819,
486,
3888,
3741,
1005,
17119,
445,
16091,
311,
1855,
4174,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_module_1() {
let (_temp_dir, deno_dir) = test_setup();
let test_cases = [
(
"./subdir/print_hello.ts",
add_root!("/Users/rld/go/src/github.com/denoland/deno/testdata/006_url_imports.ts"),
add_root!("/Users/rld/go/src/github.com/denoland/deno/testdata/subdir/print_hello.ts"),
add_root!("/Users/rld/go/src/github.com/denoland/deno/testdata/subdir/print_hello.ts"),
),
(
"testdata/001_hello.js",
add_root!("/Users/rld/go/src/github.com/denoland/deno/"),
add_root!("/Users/rld/go/src/github.com/denoland/deno/testdata/001_hello.js"),
add_root!("/Users/rld/go/src/github.com/denoland/deno/testdata/001_hello.js"),
),
(
add_root!("/Users/rld/src/deno/hello.js"),
".",
add_root!("/Users/rld/src/deno/hello.js"),
add_root!("/Users/rld/src/deno/hello.js"),
),
(
add_root!("/this/module/got/imported.js"),
add_root!("/that/module/did/it.js"),
add_root!("/this/module/got/imported.js"),
add_root!("/this/module/got/imported.js"),
),
];
for &test in test_cases.iter() {
let specifier = String::from(test.0);
let referrer = String::from(test.1);
let (module_name, filename) =
deno_dir.resolve_module(&specifier, &referrer).unwrap();
assert_eq!(module_name, test.2);
assert_eq!(filename, test.3);
}
} | rust_cleaned_test_functions.jsonl/72752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
10750,
62,
16,
368,
341,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
262,
1077,
1273,
41427,
284,
2278,
414,
2399,
286,
5924,
1966,
3741,
92221,
96724,
212... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_file_desc() {
// Run this test with some pipes so we don't have to mess around with
// opening or closing files.
let os::Pipe { reader, writer } = unsafe { os::pipe().unwrap() };
let mut reader = FileDesc::new(reader, true);
let mut writer = FileDesc::new(writer, true);
writer.write(b"test").ok().unwrap();
let mut buf = [0u8; 4];
match reader.read(&mut buf) {
Ok(4) => {
assert_eq!(buf[0], 't' as u8);
assert_eq!(buf[1], 'e' as u8);
assert_eq!(buf[2], 's' as u8);
assert_eq!(buf[3], 't' as u8);
}
r => panic!("invalid read: {:?}", r),
}
assert!(writer.read(&mut buf).is_err());
assert!(reader.write(&buf).is_err());
} | rust_cleaned_test_functions.jsonl/32126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
10986,
368,
341,
286,
442,
6452,
419,
1273,
448,
1045,
31175,
773,
582,
1513,
944,
614,
311,
9435,
2163,
448,
198,
286,
442,
8568,
476,
15316,
3542,
624,
286,
1077,
2643,
486,
34077,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_method_complex_lex() {
let j_method = "public final Response requestData(String[] arg, Type<String> param, int anotherOne) throws IOException {";
let tokens = lex_contents(&j_method.to_string());
assert_eq!(Token::LineNumber(String::from("1")), tokens[0]);
assert_eq!(Token::Keyword(String::from("public")), tokens[1]);
assert_eq!(Token::Keyword(String::from("final")), tokens[2]);
assert_eq!(Token::Symbol(String::from("Response")), tokens[3]);
assert_eq!(Token::Symbol(String::from("requestData")), tokens[4]);
assert_eq!(Token::ParamStart, tokens[5]);
assert_eq!(Token::Symbol(String::from("String[]")), tokens[6]);
assert_eq!(Token::Symbol(String::from("arg")), tokens[7]);
assert_eq!(Token::Join, tokens[8]);
assert_eq!(Token::Symbol(String::from("Type<String>")), tokens[9]);
assert_eq!(Token::Symbol(String::from("param")), tokens[10]);
assert_eq!(Token::Join, tokens[11]);
assert_eq!(Token::Symbol(String::from("int")), tokens[12]);
assert_eq!(Token::Symbol(String::from("anotherOne")), tokens[13]);
assert_eq!(Token::ParamEnd, tokens[14]);
assert_eq!(Token::Keyword(String::from("throws")), tokens[15]);
assert_eq!(Token::Symbol(String::from("IOException")), tokens[16]);
assert_eq!(Token::ExpressionEnd(String::from("{")), tokens[17]);
} | rust_cleaned_test_functions.jsonl/62780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
41522,
74547,
368,
341,
262,
1077,
502,
9032,
284,
330,
888,
1590,
5949,
97264,
2242,
1294,
1392,
11,
3990,
3464,
29,
1685,
11,
526,
2441,
3966,
8,
3787,
9346,
314,
3302,
262,
1077,
11211,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_host_localhost_change_dir() {
let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
let new_dir: PathBuf = PathBuf::from("/dev");
assert!(host.change_wrkdir(new_dir.as_path()).is_ok());
// Verify new files
// Scan dir
let entries = std::fs::read_dir(PathBuf::from(new_dir).as_path()).unwrap();
let mut counter: usize = 0;
for _ in entries {
counter = counter + 1;
}
assert_eq!(host.files.len(), counter);
} | rust_cleaned_test_functions.jsonl/53624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
62,
8301,
15947,
4334,
368,
341,
286,
1077,
5206,
3468,
25,
8774,
3790,
284,
8774,
3790,
486,
931,
33030,
15064,
486,
1499,
4283,
3583,
15197,
562,
1005,
15454,
543,
286,
1077,
501,
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... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.