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_seq_concat_string() {
Python::with_gil(|py| {
let v = "string";
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
let concat_seq = seq.concat(seq).unwrap();
assert_eq!(12, concat_seq.len().unwrap());
let concat_v = "stringstring".to_owned();
for (el, cc) in seq.iter().unwrap().zip(concat_v.chars()) {
assert_eq!(cc, el.unwrap().extract::<char>().unwrap());
}
});
} | rust_cleaned_test_functions.jsonl/70325 | {
"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,
14486,
57478,
3904,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
348,
284,
330,
917,
876,
310,
1077,
1508,
284,
348,
2389,
5314,
46827,
317,
310,
1077,
12981,
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_write_json() {
let data: &str = r#"
{ "error": null,
"id": 0,
"result": [
{
"askEp": 426800,
"bidEp": 426300,
"fundingRateEr": 10000,
"highEp": 429200,
"indexEp": 426585,
"lastEp": 426300,
"lowEp": 417200,
"markEp": 426605,
"openEp": 420500,
"openInterest": 10973,
"predFundingRateEr": 10000,
"symbol": "LTCUSD",
"timestamp": 1595103169787216117,
"turnoverEv": 13159209790,
"volume": 1555142
},
{
"askEp": 18121000,
"bidEp": 18065000,
"fundingRateEr": 10000,
"highEp": 18121000,
"indexEp": 18101870,
"lastEp": 18121000,
"lowEp": 18065000,
"markEp": 18102726,
"openEp": 18099000,
"openInterest": 182039,
"predFundingRateEr": 10000,
"symbol": "GOLDUSD",
"timestamp": 1595103169787268293,
"turnoverEv": 152464051,
"volume": 8426
}
]
}"#;
assert_eq!(write_json(data), true);
} | rust_cleaned_test_functions.jsonl/84061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 787
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
9455,
368,
341,
286,
1077,
821,
25,
609,
495,
284,
435,
2,
698,
310,
314,
330,
841,
788,
845,
345,
1060,
330,
307,
788,
220,
15,
345,
1060,
330,
1382,
788,
2278,
286,
341,
310,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_banned_and_ban_for() {
let mut rng = rand::rngs::OsRng;
let (_sk, pk) = RistrettoPublicKey::random_keypair(&mut rng);
let node_id = NodeId::from_key(&pk).unwrap();
let addresses = MultiaddressesWithStats::from("/ip4/123.0.0.123/tcp/8000".parse::<Multiaddr>().unwrap());
let mut peer: Peer = Peer::new(pk, node_id, addresses, PeerFlags::default(), PeerFeatures::empty(), &[]);
assert_eq!(peer.is_banned(), false);
peer.ban_for(Duration::from_millis(std::u64::MAX));
assert_eq!(peer.is_banned(), true);
peer.ban_for(Duration::from_millis(0));
assert_eq!(peer.is_banned(), false);
} | rust_cleaned_test_functions.jsonl/104017 | {
"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,
6892,
880,
7295,
8378,
880,
276,
5478,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
69890,
82,
486,
28867,
49,
968,
280,
286,
1077,
5453,
4886,
11,
22458,
8,
284,
431,
380,
2122,
983,
61... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_probe() {
struct TestReaper;
impl Actor for TestReaper {
type Msg = ();
fn receive(&mut self, _: (), _: &mut ActorContext<()>) {}
fn receive_signal(&mut self, signal: Signal, ctx: &mut ActorContext<()>) {
if let Signal::Started = signal {
let mut probe = ctx.spawn_probe::<usize>();
let doubler = ctx.spawn(Doubler);
doubler.tell(DoublerMsg::Double(4, probe.actor_ref.clone()));
assert_eq!(probe.receive(time::Duration::from_secs(10)), 8);
// the probe stops the actor?
ctx.actor_ref().stop();
}
}
}
assert!(ActorSystem::new().spawn(TestReaper).is_ok());
} | rust_cleaned_test_functions.jsonl/49289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49108,
368,
341,
286,
2036,
3393,
693,
3191,
401,
286,
11605,
24718,
369,
3393,
693,
3191,
341,
310,
943,
24205,
284,
25162,
310,
5168,
5258,
2099,
6984,
656,
11,
58536,
38104,
58536,
609,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_all_refs_enum_var_privacy() {
check(
r#"
mod m {
pub enum En {
Variant {
field<|>: u8,
}
}
}
fn f() -> m::En {
m::En::Variant { field: 0 }
}
"#,
expect![[r#"
field Field FileId(0) 56..65 56..61 Other
FileId(0) 125..130 RecordFieldExprOrPat Read
"#]],
);
} | rust_cleaned_test_functions.jsonl/47788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
31054,
4612,
24726,
2757,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
2593,
296,
341,
262,
6675,
7618,
2925,
341,
286,
39292,
341,
310,
2070,
27,
91,
26818,
575,
23,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pow() {
assert_eq!(_1_2.pow(2), Ratio::new(1, 4));
assert_eq!(_1_2.pow(-2), Ratio::new(4, 1));
assert_eq!(_1.pow(1), _1);
assert_eq!(_NEG1_2.pow(2), _1_2.pow(2));
assert_eq!(_NEG1_2.pow(3), -_1_2.pow(3));
assert_eq!(_3_2.pow(0), _1);
assert_eq!(_3_2.pow(-1), _3_2.recip());
assert_eq!(_3_2.pow(3), Ratio::new(27, 8));
} | rust_cleaned_test_functions.jsonl/124703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
368,
341,
286,
2060,
10714,
0,
2490,
16,
62,
17,
25290,
7,
17,
701,
50748,
486,
931,
7,
16,
11,
220,
19,
1106,
286,
2060,
10714,
0,
2490,
16,
62,
17,
25290,
4080,
17,
701,
50748,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_execute_invalid_public_key() {
let matches = CreateNodeVssCommand::args().get_matches_from(vec![
"createnodevss",
"--threshold",
"2",
"--public-key",
"x",
"--private-key",
"cQYYBMFS9dRR3Mt16gW4jixCqSiMhCwuDMHUBs6WeHMTxMnsq8Gh",
]);
let response = CreateNodeVssCommand::execute(&matches);
assert_eq!(format!("{}", response.err().unwrap()), "InvalidKey");
} | rust_cleaned_test_functions.jsonl/111721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
31433,
27074,
3097,
368,
341,
286,
1077,
9071,
284,
4230,
1955,
53,
778,
4062,
486,
2116,
1005,
455,
38344,
5673,
25592,
90515,
310,
330,
837,
13518,
534,
85,
778,
756,
310,
14482,
28902,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatching_with_struct() {
init_test_log();
let tracker = AssertCollect::new();
let system = ActorSystem::create(ActorSystemConfig::default().thread_pool_size(2));
// We create a basic struct with a handler and use that handler to dispatch to other
// inherent methods in the struct. Note that we don't have to implement any traits here
// and there is nothing forcing the handler to be an inherent method.
struct Data {
value: i32,
tracker: AssertCollect,
}
impl Data {
fn handle_bool(mut self, message: bool) -> ActorResult<Self> {
if message {
self.value += 1;
} else {
self.value -= 1;
}
Ok(Status::done(self)) // This assertion will fail but we still have to return.
}
fn handle_i32(mut self, message: i32) -> ActorResult<Self> {
self.value += message;
Ok(Status::done(self)) // This assertion will fail but we still have to return.
}
async fn handle(self, _context: Context, message: Message) -> ActorResult<Self> {
if let Some(msg) = message.content_as::<bool>() {
self.handle_bool(*msg)
} else if let Some(msg) = message.content_as::<i32>() {
self.handle_i32(*msg)
} else if let Some(_msg) = message.content_as::<SystemMsg>() {
// want the most frequently received messages first.
Ok(Status::done(self))
} else {
self.tracker.panic("Failed to dispatch properly")
}
}
}
let data = Data {
value: 0,
tracker: tracker.clone(),
};
let aid = system.spawn().with(data, Data::handle).unwrap();
// Send some messages to the actor.
aid.send_new(11).unwrap();
aid.send_new(true).unwrap();
aid.send_new(true).unwrap();
aid.send_new(false).unwrap();
await_received(&aid, 4, 1000).unwrap();
system.trigger_and_await_shutdown(None);
tracker.collect();
} | rust_cleaned_test_functions.jsonl/1275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
287,
6615,
15126,
368,
341,
286,
2930,
4452,
5224,
1428,
286,
1077,
28331,
284,
5319,
47504,
486,
931,
543,
286,
1077,
1849,
284,
24718,
2320,
486,
3182,
7,
18870,
2320,
2648,
486,
2258,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_zero_add() {
type LengthCm = Length<f32, Cm>;
let length: LengthCm = Length::new(5.0);
let result = length - LengthCm::zero();
assert_eq!(result, length);
} | rust_cleaned_test_functions.jsonl/50594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
2891,
368,
341,
286,
943,
17287,
34,
76,
284,
17287,
63895,
18,
17,
11,
356,
76,
10133,
286,
1077,
3084,
25,
17287,
34,
76,
284,
17287,
486,
931,
7,
20,
13,
15,
626,
286,
1077,
1102,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_json() {
assert_eq!(json(true).unwrap(), "true");
assert_eq!(json("foo").unwrap(), r#""foo""#);
assert_eq!(json(&true).unwrap(), "true");
assert_eq!(json(&"foo").unwrap(), r#""foo""#);
assert_eq!(
json(&vec!["foo", "bar"]).unwrap(),
r#"[
"foo",
"bar"
]"#
);
} | rust_cleaned_test_functions.jsonl/120647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
368,
341,
286,
2060,
10714,
10297,
2236,
3715,
568,
15454,
1507,
330,
1866,
797,
286,
2060,
10714,
10297,
2236,
445,
7975,
1827,
15454,
1507,
435,
2,
3014,
7975,
3014,
2,
317,
286,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_missed_votes() {
let account_a = solana_sdk::pubkey::new_rand();
let mut vote_state_a = VoteState::new_for_test(&account_a);
let account_b = solana_sdk::pubkey::new_rand();
let mut vote_state_b = VoteState::new_for_test(&account_b);
// process some votes on account a
(0..5).for_each(|i| vote_state_a.process_slot_vote_unchecked(i as u64));
assert_ne!(recent_votes(&vote_state_a), recent_votes(&vote_state_b));
// as long as b has missed less than "NUM_RECENT" votes both accounts should be in sync
let slots = (0u64..MAX_RECENT_VOTES as u64).collect();
let vote = Vote::new(slots, Hash::default());
let slot_hashes: Vec<_> = vote.slots.iter().rev().map(|x| (*x, vote.hash)).collect();
assert_eq!(
vote_state_a.process_vote(&vote, &slot_hashes, 0, Some(&FeatureSet::default())),
Ok(())
);
assert_eq!(
vote_state_b.process_vote(&vote, &slot_hashes, 0, Some(&FeatureSet::default())),
Ok(())
);
assert_eq!(recent_votes(&vote_state_a), recent_votes(&vote_state_b));
} | rust_cleaned_test_functions.jsonl/6092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
67722,
291,
65116,
368,
341,
286,
1077,
2692,
4306,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
5206,
6910,
4387,
4306,
284,
34034,
1397,
486,
931,
5478,
4452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nested_class_methods() {
let hdr = indoc! {"
#include <cstdint>
class A {
public:
virtual ~A() {}
struct B {
virtual void b() const {}
};
virtual void a() const {}
struct C {
virtual void b() const {}
};
virtual void c() const {}
struct D {
virtual void b() const {}
};
};
"};
let rs = quote! {
let a = ffi::A::make_unique();
a.a();
a.c();
};
run_test("", hdr, rs, &["A"], &[]);
} | rust_cleaned_test_functions.jsonl/9974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
4790,
36084,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
96975,
397,
262,
536,
362,
341,
262,
584,
510,
286,
4108,
3968,
32,
368,
5613,
286,
2036,
425,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_global_const_i32() {
// create a GlobalType instance
let result = GlobalType::create(ValType::I32, Mutability::Const);
assert!(result.is_ok());
let mut ty = result.unwrap();
assert!(!ty.ctx.is_null());
// create a const Global instance
let result = Global::create(&mut ty, Value::I32(99));
assert!(result.is_ok());
assert!(ty.ctx.is_null());
assert!(ty.registered);
let mut global_const = result.unwrap();
// access the value held by global_const
assert_eq!(global_const.get_value(), Value::I32(99));
let result = global_const.set_value(Value::I32(0));
assert!(result.is_err());
// access the global type
let result = global_const.ty();
assert!(result.is_ok());
let ty = result.unwrap();
assert!(!ty.ctx.is_null());
assert!(ty.registered);
assert_eq!(ty.value_type(), ValType::I32);
assert_eq!(ty.mutability(), Mutability::Const);
} | rust_cleaned_test_functions.jsonl/130796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
13610,
5318,
18,
17,
368,
341,
286,
442,
1855,
264,
7962,
929,
2867,
198,
286,
1077,
1102,
284,
7962,
929,
486,
3182,
7,
2208,
929,
486,
40,
18,
17,
11,
31228,
2897,
486,
19167,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mmds_detour_and_injection() {
let mut net = Net::default_net(TestMutators::default());
let sha = MacAddr::parse_str("11:11:11:11:11:11").unwrap();
let spa = Ipv4Addr::new(10, 1, 2, 3);
let tha = MacAddr::parse_str("22:22:22:22:22:22").unwrap();
let tpa = Ipv4Addr::new(169, 254, 169, 254);
let packet_len;
{
// Create an ethernet frame.
let eth_frame_i = EthernetFrame::write_incomplete(
frame_bytes_from_buf_mut(&mut net.tx_frame_buf),
tha,
sha,
ETHERTYPE_ARP,
)
.ok()
.unwrap();
// Set its length to hold an ARP request.
let mut eth_frame_complete = eth_frame_i.with_payload_len_unchecked(ETH_IPV4_FRAME_LEN);
// Save the total frame length.
packet_len = vnet_hdr_len() + eth_frame_complete.payload_offset() + ETH_IPV4_FRAME_LEN;
// Create the ARP request.
let arp_req = EthIPv4ArpFrame::write_request(
eth_frame_complete.payload_mut(),
sha,
spa,
tha,
tpa,
);
// Validate success.
assert!(arp_req.is_ok());
}
// Call the code which sends the packet to the host or MMDS.
// Validate the frame was consumed by MMDS and that the metrics reflect that.
check_metric_after_block!(
&METRICS.mmds.rx_accepted,
1,
assert!(Net::write_to_mmds_or_tap(
net.mmds_ns.as_mut(),
&mut net.tx_rate_limiter,
&net.tx_frame_buf[..packet_len],
&mut net.tap,
Some(sha),
))
);
// Validate that MMDS has a response and we can retrieve it.
check_metric_after_block!(
&METRICS.mmds.tx_frames,
1,
net.read_from_mmds_or_tap().unwrap()
);
} | rust_cleaned_test_functions.jsonl/63424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
2277,
82,
24409,
413,
8378,
1243,
7606,
368,
341,
286,
1077,
5206,
4179,
284,
9374,
486,
2258,
19722,
31159,
51440,
2973,
486,
2258,
5231,
286,
1077,
15870,
284,
7401,
13986,
486,
6400,
2895,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_mul_table() {
let m = G2Poly(0b111);
assert_eq!(include_str!("../tests/mul_table.txt").trim(), generate_mul_table_string(m));
} | rust_cleaned_test_functions.jsonl/728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
24944,
5237,
368,
341,
286,
1077,
296,
284,
479,
17,
38164,
7,
15,
65,
16,
16,
16,
626,
286,
2060,
10714,
10297,
997,
2895,
17223,
1244,
23841,
3183,
360,
5237,
3909,
1827,
10666,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_uncle_proposals_hash() {
let (shared, chain1, chain2) = prepare();
let dummy_context = dummy_context(&shared);
let block_number = 17;
let uncle = chain1[16]
.to_owned()
.as_advanced_builder()
.parent_hash(chain2[15].hash())
.proposal([1; 10].pack())
.build_unchecked()
.as_uncle();
let block = chain2[18]
.to_owned()
.as_advanced_builder()
.uncle(uncle)
.build();
let epoch = epoch(&shared, &chain2, block_number);
let uncle_verifier_context = UncleVerifierContext::new(&dummy_context, &epoch);
let verifier = UnclesVerifier::new(uncle_verifier_context, &block);
assert_eq!(
verifier.verify(),
Err(Error::Uncles(UnclesError::ProposalsHash))
);
} | rust_cleaned_test_functions.jsonl/118904 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76576,
273,
21663,
85975,
8950,
368,
341,
262,
1077,
320,
6100,
11,
8781,
16,
11,
8781,
17,
8,
284,
10549,
543,
262,
1077,
17292,
8467,
284,
17292,
8467,
2099,
6100,
317,
262,
1077,
2504,
5500,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_late_binding() {
check_output_default(
"fun a() { b(); }\n\
fun b() { print \"hello world\"; }\n\
\n\
a();\n",
"'hello world'",
)
} | rust_cleaned_test_functions.jsonl/111862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
349,
60815,
368,
341,
286,
1779,
7645,
9993,
1006,
310,
330,
11894,
264,
368,
314,
293,
2129,
51300,
77,
5661,
1797,
2464,
293,
368,
314,
1173,
7245,
14990,
1879,
2105,
26,
51300,
77,
5661,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_du_hard_link() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.hard_link(SUB_FILE, SUB_LINK);
let result = scene.ucmd().arg(SUB_DIR_LINKS).succeeds();
#[cfg(target_os = "linux")]
{
let result_reference = scene.cmd("du").arg(SUB_DIR_LINKS).run();
if result_reference.succeeded() {
assert_eq!(result.stdout_str(), result_reference.stdout_str());
return;
}
}
// We do not double count hard links as the inodes are identical
_du_hard_link(result.stdout_str());
} | rust_cleaned_test_functions.jsonl/23734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
84,
77712,
7233,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
401,
262,
518,
860,
567,
7233,
3759,
4493,
8087,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timestamp() {
use std::collections::HashSet;
let timestamp = ::prost_types::Timestamp {
seconds: 100,
nanos: 42,
};
let mut non_normalized_timestamp = ::prost_types::Timestamp {
seconds: 99,
nanos: 1_000_000_042,
};
let mut hashset = HashSet::new();
assert!(hashset.insert(timestamp.clone()));
assert!(
hashset.insert(non_normalized_timestamp.clone()),
"hash for non-normalized different and should be inserted"
);
assert_ne!(
timestamp, non_normalized_timestamp,
"non-nomarlized timestamp considered different"
);
non_normalized_timestamp.normalize();
assert_eq!(
timestamp, non_normalized_timestamp,
"normalized timestamp matches"
);
let mut hashset = HashSet::new();
assert!(hashset.insert(timestamp.clone()));
assert!(
!hashset.insert(non_normalized_timestamp),
"hash for normalized should match and not inserted"
);
} | rust_cleaned_test_functions.jsonl/28035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
368,
341,
262,
990,
1460,
486,
51137,
486,
44601,
401,
262,
1077,
11441,
284,
3504,
776,
267,
9763,
486,
20812,
341,
286,
6486,
25,
220,
16,
15,
15,
345,
286,
20021,
436,
25,
220,
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_redeem_tokens() {
let (bank, alice_keypair) = create_bank(38);
let bank = Arc::new(bank);
let bank_client = BankClient::new_shared(&bank);
let alice_pubkey = alice_keypair.pubkey();
let date_keypair = Keypair::new();
let date_pubkey = date_keypair.pubkey();
let current_date = Utc.ymd(2019, 1, 1);
create_date_account(&bank_client, &date_keypair, &alice_keypair, current_date).unwrap();
let contract_keypair = Keypair::new();
let contract_pubkey = contract_keypair.pubkey();
let bob_pubkey = Pubkey::new_rand();
let start_date = Utc.ymd(2018, 1, 1);
create_vest_account(
&bank_client,
&contract_keypair,
&alice_keypair,
&alice_pubkey,
&bob_pubkey,
start_date,
&date_pubkey,
36,
)
.unwrap();
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
assert_eq!(bank_client.get_balance(&contract_pubkey).unwrap(), 36);
send_redeem_tokens(
&bank_client,
&contract_pubkey,
&alice_keypair,
&bob_pubkey,
&date_pubkey,
)
.unwrap();
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
assert_eq!(bank_client.get_balance(&contract_pubkey).unwrap(), 24);
assert_eq!(bank_client.get_balance(&bob_pubkey).unwrap(), 12);
// Update the date oracle and redeem more tokens
store_date(
&bank_client,
&date_keypair,
&alice_keypair,
Utc.ymd(2019, 2, 1),
)
.unwrap();
// Force a new blockhash so that there's not a duplicate signature.
for _ in 0..bank.ticks_per_slot() {
bank.register_tick(&hash(&[1]));
}
send_redeem_tokens(
&bank_client,
&contract_pubkey,
&alice_keypair,
&bob_pubkey,
&date_pubkey,
)
.unwrap();
assert_eq!(bank_client.get_balance(&alice_pubkey).unwrap(), 1);
assert_eq!(bank_client.get_balance(&contract_pubkey).unwrap(), 23);
assert_eq!(bank_client.get_balance(&bob_pubkey).unwrap(), 13);
} | rust_cleaned_test_functions.jsonl/88804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
450,
336,
28838,
368,
341,
286,
1077,
320,
17033,
11,
70433,
3097,
12670,
8,
284,
1855,
35733,
7,
18,
23,
317,
286,
1077,
6073,
284,
19689,
486,
931,
1883,
1180,
317,
286,
1077,
6073,
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... | 2 |
#[test]
fn test_repr_parse_valid() {
let packet = Packet::new_unchecked(&REPR_PACKET_BYTES[..]);
let repr = Repr::parse(&packet).unwrap();
assert_eq!(repr, packet_repr());
} | rust_cleaned_test_functions.jsonl/126219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68535,
21039,
8337,
368,
341,
286,
1077,
10151,
284,
28889,
486,
931,
4907,
7549,
2099,
787,
6480,
40328,
40705,
95874,
2558,
286,
1077,
30636,
284,
1032,
649,
486,
6400,
2099,
24829,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_string_debug_malformed() {
let string = NbtString::new(b"foo bar\" \0 \xC0");
let formatted = format!("{:?}", string);
assert_eq!(formatted, r#""foo bar\" \0 \xC0""#);
} | rust_cleaned_test_functions.jsonl/67163 | {
"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,
3904,
15446,
717,
278,
10155,
368,
341,
262,
1077,
914,
284,
451,
12755,
703,
486,
931,
1883,
1,
7975,
3619,
2105,
1124,
15,
1124,
12125,
15,
3071,
262,
1077,
23126,
284,
3561,
88928,
25,
52652,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rev_iterator() {
let mut m = VecMap::new();
assert!(m.insert(0, 1).is_none());
assert!(m.insert(1, 2).is_none());
assert!(m.insert(3, 5).is_none());
assert!(m.insert(6, 10).is_none());
assert!(m.insert(10, 11).is_none());
let mut it = m.iter().rev();
assert_eq!(it.next().unwrap(), (10, &11));
assert_eq!(it.next().unwrap(), (6, &10));
assert_eq!(it.next().unwrap(), (3, &5));
assert_eq!(it.next().unwrap(), (1, &2));
assert_eq!(it.next().unwrap(), (0, &1));
assert!(it.next().is_none());
} | rust_cleaned_test_functions.jsonl/53273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
13491,
368,
341,
286,
1077,
5206,
296,
284,
11312,
2227,
486,
931,
1428,
286,
2060,
10297,
76,
7030,
7,
15,
11,
220,
16,
568,
285,
31488,
1423,
286,
2060,
10297,
76,
7030,
7,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_neuron_proposal() {
check_proposal_status_after_voting_and_after_expiration(
vec![Neuron {
dissolve_state: NOTDISSOLVING_MIN_DISSOLVE_DELAY_TO_VOTE,
cached_neuron_stake_e8s: 1,
..Neuron::default()
}],
"P",
ProposalStatus::Executed,
ProposalStatus::Executed,
);
} | rust_cleaned_test_functions.jsonl/1109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
13925,
36090,
21663,
32556,
368,
341,
262,
1779,
21663,
32556,
4773,
19844,
2273,
11519,
8378,
19844,
2702,
28479,
1006,
286,
7486,
20703,
8813,
36090,
341,
310,
72639,
4387,
25,
4183,
17625,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_assignment_node() {
let node = AssignmentNode {
lhs: Box::new(VarNode::new("adsf").into()),
rhs: Box::new(IntNode::new(324).into()),
span: None,
};
let clone = node.clone();
assert_eq!(
ExpressionNode::from(node),
ExpressionNode::Assignment(clone)
);
} | rust_cleaned_test_functions.jsonl/89513 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
51891,
5084,
368,
341,
286,
1077,
2436,
284,
34427,
1955,
341,
310,
22505,
25,
8261,
486,
931,
7,
3962,
1955,
486,
931,
445,
7664,
69,
1827,
18122,
14702,
310,
12916,
25,
8261,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() {
use std::thread;
let x = 5;
let y = Blocker::new(&x);
let z = y.get();
thread::spawn(move || {
thread::sleep_ms(1000);
println!("{}", *z);
});
} | rust_cleaned_test_functions.jsonl/94621 | {
"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,
34729,
368,
341,
262,
990,
1460,
486,
4528,
280,
262,
1077,
856,
284,
220,
20,
280,
262,
1077,
379,
284,
8362,
261,
486,
931,
2099,
87,
317,
262,
1077,
1147,
284,
379,
670,
543,
262,
4516,
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... | 2 |
#[test]
fn test_l_to_r_password() {
let test_door: Door = Door("abc".to_string());
assert_eq!(test_door.l_to_r_password(), "18f47a30");
} | rust_cleaned_test_functions.jsonl/125869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
2346,
1710,
10122,
368,
341,
286,
1077,
1273,
78962,
25,
24191,
284,
24191,
445,
13683,
3263,
983,
3904,
5231,
286,
2060,
10714,
10297,
1944,
78962,
918,
2346,
1710,
10122,
1507,
330,
16,
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 |
#[test]
fn test_to_json() {
let config = Config {
width: 100,
height: 100,
samples_per_pixel: 1,
max_depth: 1,
sky: Some(Sky::new_default_sky()),
camera: Camera::new(
Point3D::new(0.0, 0.0, 0.0),
Point3D::new(0.0, 0.0, -1.0),
Point3D::new(0.0, 1.0, 0.0),
90.0,
1.0,
),
objects: vec![Sphere::new(
Point3D::new(0.0, 0.0, -1.0),
0.5,
Material::Lambertian(Lambertian::new(Srgb::new(
0.8 as f32, 0.3 as f32, 0.3 as f32,
))),
)],
};
let serialized = serde_json::to_string(&config).unwrap();
assert_eq!("{\"width\":100,\"height\":100,\"samples_per_pixel\":1,\"max_depth\":1,\"sky\":{\"texture\":\"\"},\"camera\":{\"look_from\":{\"x\":0.0,\"y\":0.0,\"z\":0.0},\"look_at\":{\"x\":0.0,\"y\":0.0,\"z\":-1.0},\"vup\":{\"x\":0.0,\"y\":1.0,\"z\":0.0},\"vfov\":90.0,\"aspect\":1.0},\"objects\":[{\"center\":{\"x\":0.0,\"y\":0.0,\"z\":-1.0},\"radius\":0.5,\"material\":{\"Lambertian\":{\"albedo\":[0.8,0.3,0.3]}}}]}", serialized);
} | rust_cleaned_test_functions.jsonl/118684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
9455,
368,
341,
262,
1077,
2193,
284,
5532,
341,
286,
2374,
25,
220,
16,
15,
15,
345,
286,
2608,
25,
220,
16,
15,
15,
345,
286,
10469,
5678,
29760,
25,
220,
16,
345,
286,
1932,
19061,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_norwegian_lang_serde() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct TestStruct {
no: Lang,
nb: Lang,
en: Lang
}
let test_json = "{\"nb\":\"nb\",\"no\":\"no\",\"en\":\"en\"}";
let test_struct: TestStruct = serde_json::from_str(test_json).unwrap();
assert_eq!(test_struct.nb, Lang::NorwegianBokmal);
assert_eq!(test_struct.no, Lang::NorwegianBokmal);
assert_eq!(test_struct.en, Lang::English);
let test_struct_serialized = serde_json::to_string(&test_struct).unwrap();
let test_struct_deserialized: TestStruct = serde_json::from_str(
test_struct_serialized.as_str()
).unwrap();
assert_eq!(test_struct_deserialized.nb, Lang::NorwegianBokmal);
assert_eq!(test_struct_deserialized.no, Lang::NorwegianBokmal);
assert_eq!(test_struct_deserialized.en, Lang::English);
} | rust_cleaned_test_functions.jsonl/24720 | {
"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,
1089,
269,
36565,
17876,
75861,
450,
368,
1476,
286,
11506,
27098,
3759,
9050,
11,
48440,
11,
55039,
11,
11091,
5563,
286,
2036,
3393,
9422,
341,
310,
902,
25,
22463,
345,
310,
16649,
25,
22463,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_message_valid_signature() {
let message = "test message".to_owned();
let signature = "304402204146402099809E1F021421569F72BA34DCAFCC832741AB6310F887F60734D9F002203E813AD6A59D67D8EE06C8EA05BCC1BA8F690B631E6F243E8BE60633D27BE05D".to_owned();
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let verified_message = verify(
&mut jscontext,
message,
signature,
"038BF420B5271ADA2D7479358FF98A29954CF18DC25155184AEAD05796DA737E89".to_owned(),
)?;
assert!(verified_message);
} | rust_cleaned_test_functions.jsonl/118748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
6462,
8337,
39859,
368,
341,
286,
1077,
1943,
284,
330,
1944,
1943,
3263,
983,
51973,
543,
286,
1077,
11957,
284,
330,
18,
15,
19,
19,
15,
17,
17,
15,
19,
16,
19,
21,
19,
15,
17,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_decode_unsigned_byte() {
let byte: u8 = 255;
let decoded: u8 = decode_unsigned_byte(byte);
assert_eq!(byte, decoded)
} | rust_cleaned_test_functions.jsonl/16121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
67830,
19737,
368,
341,
262,
1077,
4922,
25,
575,
23,
284,
220,
17,
20,
20,
280,
262,
1077,
29213,
25,
575,
23,
284,
16895,
67830,
19737,
19738,
317,
262,
2060,
10714,
10297,
3782,
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 |
#[test]
fn test_de() {
let b= to_bson(&1u64).unwrap();
let c:Bson = from_bson(b).unwrap();
println!("{}",c);
} | rust_cleaned_test_functions.jsonl/12640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
368,
341,
286,
1077,
293,
28,
311,
880,
930,
2099,
16,
84,
21,
19,
568,
15454,
543,
286,
1077,
272,
81268,
930,
284,
504,
880,
930,
1883,
568,
15454,
543,
286,
13751,
79878,
66,
317,
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 |
#[test]
fn test_as_dangerous_str() {
// Valid
assert_eq!(input!(b"").to_dangerous_str::<Expected>().unwrap(), "");
assert_eq!(
input!(b"hello").to_dangerous_str::<Expected>().unwrap(),
"hello"
);
// Invalid
let _ = input!(b"\xff").to_dangerous_str::<Expected>().unwrap_err();
} | rust_cleaned_test_functions.jsonl/15432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
814,
4003,
782,
2895,
368,
341,
262,
442,
7818,
198,
262,
2060,
10714,
10297,
1355,
10297,
65,
1,
1827,
983,
814,
4003,
782,
2895,
27638,
18896,
10483,
15454,
1507,
14498,
262,
2060,
10714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_benchmarks() {
new_test_ext().execute_with(|| {
assert_ok!(test_benchmark_report_offence_im_online::<Test>());
assert_ok!(test_benchmark_report_offence_grandpa::<Test>());
assert_ok!(test_benchmark_report_offence_babe::<Test>());
assert_ok!(test_benchmark_on_initialize::<Test>());
});
} | rust_cleaned_test_functions.jsonl/81689 | {
"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,
880,
19762,
15544,
368,
341,
197,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
298,
6948,
19817,
10297,
1944,
880,
39381,
14813,
13651,
763,
17895,
51546,
27638,
2271,
32872,
298,
6948,
19817,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multiplication() {
let a = Fp([
0x0397_a383_2017_0cd4,
0x734c_1b2c_9e76_1d30,
0x5ed2_55ad_9a48_beb5,
0x095a_3c6b_22a7_fcfc,
0x2294_ce75_d4e2_6a27,
0x1333_8bd8_7001_1ebb,
]);
let b = Fp([
0xb9c3_c7c5_b119_6af7,
0x2580_e208_6ce3_35c1,
0xf49a_ed3d_8a57_ef42,
0x41f2_81e4_9846_e878,
0xe076_2346_c384_52ce,
0x0652_e893_26e5_7dc0,
]);
let c = Fp([
0xf96e_f3d7_11ab_5355,
0xe8d4_59ea_00f1_48dd,
0x53f7_354a_5f00_fa78,
0x9e34_a4f3_125c_5f83,
0x3fbe_0c47_ca74_c19e,
0x01b0_6a8b_bd4a_dfe4,
]);
assert_eq!(a * b, c);
} | rust_cleaned_test_functions.jsonl/23229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91802,
1693,
368,
341,
262,
1077,
264,
284,
434,
79,
8956,
286,
220,
15,
87,
15,
18,
24,
22,
4306,
18,
23,
18,
62,
17,
15,
16,
22,
62,
15,
4385,
19,
345,
286,
220,
15,
87,
22,
18,
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_unconf_chan_via_listen() {
do_test_unconf_chan(true, true, false, ConnectStyle::FullBlockViaListen);
do_test_unconf_chan(false, true, false, ConnectStyle::FullBlockViaListen);
do_test_unconf_chan(true, false, false, ConnectStyle::FullBlockViaListen);
do_test_unconf_chan(false, false, false, ConnectStyle::FullBlockViaListen);
} | rust_cleaned_test_functions.jsonl/97703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
6135,
45552,
80710,
79286,
368,
341,
19935,
4452,
4907,
6135,
45552,
3715,
11,
830,
11,
895,
11,
13015,
2323,
486,
9432,
4713,
54428,
38714,
317,
19935,
4452,
4907,
6135,
45552,
3576,
11,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul() {
let a = Jacobian::from(Affine::new(
field_element!("01ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca"),
field_element!("005668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"),
));
let b = ScalarFieldElement::from(u256h!(
"07374b7d69dc9825fc758b28913c8d2a27be5e7c32412f612b20c9c97afbe4dd"
));
let c = Jacobian::from(Affine::new(
field_element!("00f24921907180cd42c9d2d4f9490a7bc19ac987242e80ac09a8ac2bcf0445de"),
field_element!("018a7a2ab4e795405f924de277b0e723d90eac55f2a470d8532113d735bdedd4"),
));
assert_eq!(a * b, c);
} | rust_cleaned_test_functions.jsonl/38966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
286,
1077,
264,
284,
24521,
1103,
486,
1499,
4346,
542,
482,
486,
931,
1006,
310,
2070,
7894,
17223,
15,
16,
823,
16,
20,
66,
16,
23,
20,
24,
24,
24,
22,
16,
65,
22,
16692... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_required_double() {
let schemaReplicant = SchemaReplicant::default();
let causetq = r#"[:find ?x :where [?x _ ?e] [(type ?e :edb.type/double)]]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.e AS `?x` \
FROM `causets` AS `Causets00` \
WHERE ((`Causets00`.value_type_tag = 5 AND \
(typeof(`Causets00`.v) = 'real')))");
assert_eq!(args, vec![]);
} | rust_cleaned_test_functions.jsonl/90702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
18743,
24598,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
12539,
18327,
35237,
486,
2258,
1428,
262,
1077,
2162,
18187,
80,
284,
435,
55543,
3447,
3903,
937,
87,
549,
2870,
508,
30,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_dict_file_record_corrupted() {
let tempdir = tempfile::tempdir().unwrap();
let mut file_dict_file = FileDictionaryFile::new(
tempdir.path(),
"test_file_dict_file_record_corrupted_1",
true,
10, /*file_rewrite_threshold*/
)
.unwrap();
let info1 = create_file_info(1, EncryptionMethod::Aes256Ctr);
let info2 = create_file_info(2, EncryptionMethod::Unknown);
// 9 represents that the first 9 bytes will be discarded.
fail::cfg("file_dict_log_append_incomplete", "return(9)").unwrap();
file_dict_file.insert("info1", &info1).unwrap();
fail::remove("file_dict_log_append_incomplete");
file_dict_file.insert("info2", &info2).unwrap();
// Intermediate record damage is not allowed.
assert!(file_dict_file.recovery().is_err());
let mut file_dict_file = FileDictionaryFile::new(
tempdir.path(),
"test_file_dict_file_record_corrupted_2",
true,
10, /*file_rewrite_threshold*/
)
.unwrap();
let info1 = create_file_info(1, EncryptionMethod::Aes256Ctr);
let info2 = create_file_info(2, EncryptionMethod::Unknown);
file_dict_file.insert("info1", &info1).unwrap();
fail::cfg("file_dict_log_append_incomplete", "return(9)").unwrap();
file_dict_file.insert("info2", &info2).unwrap();
fail::remove("file_dict_log_append_incomplete");
// The ending record can be discarded.
let file_dict = file_dict_file.recovery().unwrap();
assert_eq!(*file_dict.files.get("info1").unwrap(), info1);
assert_eq!(file_dict.files.len(), 1);
} | rust_cleaned_test_functions.jsonl/132890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 652
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
5243,
2458,
14192,
14734,
85954,
368,
341,
262,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
5206,
1034,
5243,
2458,
284,
2887,
8517,
1703,
486,
931,
1006,
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_persistent_prefixes() {
// to ensure all the variants are tested by this test.
let mut remaining: HashSet<_> = SecureTokenKind::VARIANTS.iter().copied().collect();
let mut ensure = |kind: SecureTokenKind, prefix| {
assert_eq!(kind.prefix(), prefix);
remaining.remove(&kind);
};
ensure(SecureTokenKind::Api, "cio");
assert!(
remaining.is_empty(),
"not all variants have a test to check the prefix"
);
} | rust_cleaned_test_functions.jsonl/90684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
13931,
13974,
288,
368,
341,
16885,
286,
442,
311,
5978,
678,
279,
26012,
525,
12510,
553,
419,
1273,
624,
286,
1077,
5206,
9664,
25,
18931,
32399,
29,
284,
34502,
3323,
10629,
486,
53,
160... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_day16() {
let part1 = day16_part1();
assert_eq!(part1, "12541048");
let part2 = day16_part2();
assert_eq!(part2, "62858988");
} | rust_cleaned_test_functions.jsonl/95569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
16,
21,
368,
341,
286,
1077,
949,
16,
284,
1899,
16,
21,
10495,
16,
543,
286,
2060,
10714,
10297,
4480,
16,
11,
330,
16,
17,
20,
19,
16,
15,
19,
23,
3071,
286,
1077,
949,
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_ip_addrs_split_by_preference() {
let ip_v4 = Ipv4Addr::new(127, 0, 0, 1);
let ip_v6 = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1);
let v4_addr = (ip_v4, 80).into();
let v6_addr = (ip_v6, 80).into();
let (mut preferred, mut fallback) = SocketAddrs {
iter: vec![v4_addr, v6_addr].into_iter(),
}
.split_by_preference(None, None);
assert!(preferred.next().unwrap().is_ipv4());
assert!(fallback.next().unwrap().is_ipv6());
let (mut preferred, mut fallback) = SocketAddrs {
iter: vec![v6_addr, v4_addr].into_iter(),
}
.split_by_preference(None, None);
assert!(preferred.next().unwrap().is_ipv6());
assert!(fallback.next().unwrap().is_ipv4());
let (mut preferred, mut fallback) = SocketAddrs {
iter: vec![v4_addr, v6_addr].into_iter(),
}
.split_by_preference(Some(ip_v4), Some(ip_v6));
assert!(preferred.next().unwrap().is_ipv4());
assert!(fallback.next().unwrap().is_ipv6());
let (mut preferred, mut fallback) = SocketAddrs {
iter: vec![v6_addr, v4_addr].into_iter(),
}
.split_by_preference(Some(ip_v4), Some(ip_v6));
assert!(preferred.next().unwrap().is_ipv6());
assert!(fallback.next().unwrap().is_ipv4());
let (mut preferred, fallback) = SocketAddrs {
iter: vec![v4_addr, v6_addr].into_iter(),
}
.split_by_preference(Some(ip_v4), None);
assert!(preferred.next().unwrap().is_ipv4());
assert!(fallback.is_empty());
let (mut preferred, fallback) = SocketAddrs {
iter: vec![v4_addr, v6_addr].into_iter(),
}
.split_by_preference(None, Some(ip_v6));
assert!(preferred.next().unwrap().is_ipv6());
assert!(fallback.is_empty());
} | rust_cleaned_test_functions.jsonl/29699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 956
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10385,
2891,
5428,
17052,
3710,
92718,
368,
341,
286,
1077,
5997,
2273,
19,
284,
358,
30168,
19,
13986,
486,
931,
7,
16,
17,
22,
11,
220,
15,
11,
220,
15,
11,
220,
16,
317,
286,
1077,
5997,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_test_query_plus_a_b_plus_d() {
test_parse_query_to_ast_helper("+(a b) +d", "(+(*\"a\" *\"b\") +\"d\")");
} | rust_cleaned_test_functions.jsonl/64421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4452,
5738,
28043,
4306,
880,
28043,
814,
368,
341,
286,
1273,
21039,
5738,
2346,
48019,
10418,
445,
13362,
64,
293,
8,
488,
67,
497,
11993,
10,
4071,
2105,
64,
2105,
353,
2105,
65,
62705... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_model_no_mapping_1() {
let device = device(None);
let uplink = default_uplink(5);
let model_id = eval_data_schema(None, &device, &None, &uplink.port.to_string());
assert_eq!(model_id, None);
} | rust_cleaned_test_functions.jsonl/29637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5047,
6536,
26930,
62,
16,
368,
341,
286,
1077,
3671,
284,
3671,
26717,
317,
286,
1077,
705,
2080,
284,
1638,
8237,
2080,
7,
20,
626,
286,
1077,
1614,
842,
284,
5603,
1769,
25371,
26717,
11,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max() {
assert_eq!(1f32.max(&2f32), 2f32);
assert_eq!(2f32.max(&1f32), 2f32);
} | rust_cleaned_test_functions.jsonl/33101 | {
"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,
6345,
368,
341,
286,
2060,
10714,
10297,
16,
69,
18,
17,
6678,
2099,
17,
69,
18,
17,
701,
220,
17,
69,
18,
17,
317,
286,
2060,
10714,
10297,
17,
69,
18,
17,
6678,
2099,
16,
69,
18,
17,
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 |
#[test]
fn test_with_labels_gather() {
let mut labels = HashMap::new();
labels.insert("tkey".to_string(), "tvalue".to_string());
let r = Registry::new_custom(None, Some(labels)).unwrap();
let counter_a = Counter::new("test_a_counter", "test help").unwrap();
r.register(Box::new(counter_a.clone())).unwrap();
let counter_vec =
CounterVec::new(Opts::new("test_vec", "test vec help"), &["a", "b"]).unwrap();
r.register(Box::new(counter_vec.clone())).unwrap();
counter_vec.with_label_values(&["one", "two"]).inc();
counter_vec.with_label_values(&["three", "four"]).inc();
let mfs = r.gather();
assert_eq!(mfs.len(), 2);
assert_eq!(mfs[0].get_name(), "test_a_counter");
assert_eq!(mfs[1].get_name(), "test_vec");
let mut needle = proto::LabelPair::default();
needle.set_name("tkey".to_string());
needle.set_value("tvalue".to_string());
let metrics = mfs[0].get_metric();
for m in metrics {
assert!(m.get_label().contains(&needle));
}
let metrics = mfs[1].get_metric();
for m in metrics {
assert!(m.get_label().contains(&needle));
}
} | rust_cleaned_test_functions.jsonl/132419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
14547,
1889,
1856,
368,
341,
286,
1077,
5206,
9201,
284,
10528,
486,
931,
543,
286,
9201,
7030,
445,
83,
792,
3263,
983,
3904,
1507,
330,
83,
957,
3263,
983,
3904,
5231,
286,
1077,
435,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_meta_doc_comments() {
let rules = create_rules(
r#"
macro_rules! foo {
($(#[$ i:meta])+) => (
$(#[$ i])+
fn bar() {}
)
}
"#,
);
assert_expansion(
MacroKind::Items,
&rules,
r#"foo! {
/// Single Line Doc 1
/**
MultiLines Doc
*/
}"#,
"# [doc = \" Single Line Doc 1\"] # [doc = \"\\\\n MultiLines Doc\\\\n \"] fn bar () {}",
);
} | rust_cleaned_test_functions.jsonl/14722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
18869,
30359,
368,
341,
262,
1077,
5601,
284,
1855,
21407,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
32735,
3442,
600,
25,
5490,
2467,
36197,
589,
2399,
394,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_routing_id_slice() {
assert_eq!(mem::size_of::<u32>(), mem::size_of::<RoutingId>());
let routing_stack: &[u32] = &[1, 2, 3, 4];
let cast_stack = unsafe {
slice::from_raw_parts(
routing_stack.as_ptr() as *const RoutingId,
routing_stack.len(),
)
};
for (&i, &j) in routing_stack.iter().zip(cast_stack.iter()) {
assert_eq!(i, j.0);
}
} | rust_cleaned_test_functions.jsonl/125622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
97710,
842,
26488,
368,
341,
286,
2060,
10714,
10297,
10536,
486,
2141,
3575,
27638,
84,
18,
17,
39019,
1833,
486,
2141,
3575,
27638,
24701,
764,
32872,
286,
1077,
29058,
15528,
25,
44590,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ceil() {
let cases = vec![
("12345", "12345"),
("0.99999", "1"),
("-0.99999", "0"),
("18446744073709551615", "18446744073709551615"),
("18446744073709551616", "18446744073709551616"),
("-18446744073709551615", "-18446744073709551615"),
("-18446744073709551616", "-18446744073709551616"),
("-1", "-1"),
("1.23", "2"),
("-1.23", "-1"),
("1.00000", "1"),
("-1.00000", "-1"),
(
"9999999999999999999999999.001",
"10000000000000000000000000",
),
];
for (input, exp) in cases {
let dec: Decimal = input.parse().unwrap();
let exp: Decimal = exp.parse().unwrap();
let got = dec.ceil().unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/13671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
22058,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
16,
17,
18,
19,
20,
497,
330,
16,
17,
18,
19,
20,
4461,
310,
3489,
15,
13,
24,
24,
24,
24,
24,
497,
330,
16,
4461,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_global() -> Result<(), Box<dyn Error>> {
let map = {
let mut map = HeaderMap::new();
map.insert(
HeaderName::from_static("x-ratelimit-global"),
HeaderValue::from_static("true"),
);
map.insert(
HeaderName::from_static("retry-after"),
HeaderValue::from_static("65"),
);
map
};
let headers = RatelimitHeaders::try_from(&map)?;
assert!(
matches!(headers, RatelimitHeaders::GlobalLimited { reset_after } if reset_after == 65)
);
Ok(())
} | rust_cleaned_test_functions.jsonl/13093 | {
"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,
19296,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
2415,
284,
341,
310,
1077,
5206,
2415,
284,
12104,
2227,
486,
931,
543,
310,
2415,
7030,
1006,
394,
12104,
675,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multiple_headers_merge_into_one_from_hyp() {
assert_headers!("friend" => ["alice"], "friend" => ["bob"]);
assert_headers!("friend" => ["alice"], "friend" => ["bob"], "friend" => ["carol"]);
assert_headers!("friend" => ["alice"], "friend" => ["bob"], "enemy" => ["carol"]);
} | rust_cleaned_test_functions.jsonl/94551 | {
"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,
45233,
26719,
20888,
45514,
11667,
5673,
1523,
1082,
368,
341,
262,
2060,
26719,
17223,
10701,
1,
589,
4383,
63195,
7914,
330,
10701,
1,
589,
4383,
47086,
15049,
262,
2060,
26719,
17223,
10701,
1,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incomplete_length() {
let bytes = hex!("30");
let res = parse_ber(&bytes).err().expect("expected error");
assert_eq!(res, Err::Incomplete(Needed::new(1)));
let res = parse_der(&bytes).err().expect("expected error");
assert_eq!(res, Err::Incomplete(Needed::new(1)));
let bytes = hex!("02");
let res = parse_ber(&bytes).err().expect("expected error");
assert_eq!(res, Err::Incomplete(Needed::new(1)));
let bytes = hex!("02 05");
let _ = parse_ber(&bytes).err().expect("expected error");
let bytes = hex!("02 85");
let res = parse_ber(&bytes).err().expect("expected error");
assert_eq!(res, Err::Incomplete(Needed::new(5)));
let bytes = hex!("02 85 ff");
let res = parse_ber(&bytes).err().expect("expected error");
assert_eq!(res, Err::Incomplete(Needed::new(4)));
} | rust_cleaned_test_functions.jsonl/67470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
14737,
5118,
368,
341,
262,
1077,
5820,
284,
12371,
17223,
18,
15,
797,
262,
1077,
592,
284,
4715,
88165,
2099,
9651,
568,
615,
1005,
17119,
445,
7325,
1465,
797,
262,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extreme_indices_bad_polygon() {
let poly1 = polygon![
(x: 1.0, y: 0.0),
(x: 1.3, y: 1.),
(x: 2.0, y: 1.0),
(x: 1.75, y: 1.75),
(x: 1.0, y: 2.0),
(x: 0.0, y: 1.0),
(x: 1.0, y: 0.0)
];
let extremes = find_extreme_indices(polymax_naive_indices, &poly1).unwrap();
let correct = Extremes {
ymin: 0,
xmax: 1,
ymax: 3,
xmin: 4,
};
assert_eq!(extremes, correct);
} | rust_cleaned_test_functions.jsonl/100477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9927,
9634,
18333,
34199,
73542,
368,
341,
1789,
286,
1077,
9861,
16,
284,
29372,
90515,
310,
320,
87,
25,
220,
16,
13,
15,
11,
379,
25,
220,
15,
13,
15,
1326,
310,
320,
87,
25,
220,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_markbase_de() {
let binary_gpos = vec![
0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x1e, 0x00, 0x2c, 0x00, 0x01, 0x44, 0x46,
0x4c, 0x54, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01, 0x74, 0x65, 0x73, 0x74, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08,
// MarkLigPosFormat1
// MarkLigAttachSubTable MarkLigPos subtable definition
0x00, 0x01, // 1 posFormat
0x00, 0x0C, // MarkGlyphsCoverage offset to markCoverage table
0x00, 0x14, // LigGlyphsCoverage offset to ligatureCoverage table
0x00, 0x02, // 2 markClassCount
0x00, 0x1A, // MarkGlyphsArray offset to MarkArray table
0x00, 0x30, // LigGlyphsArray offset to LigatureArray table
// CoverageFormat1
// MarkGlyphsCoverage Coverage table definition
0x00, 0x01, // 1 coverageFormat: lists
0x00, 0x02, // 2 glyphCount
0x03, 0x3C, // sukunMarkGlyphID glyphArray[0]
0x03, 0x3F, // kasratanMarkGlyphID glyphArray[1]
// CoverageFormat1
// LigGlyphsCoverage Coverage table definition
0x00, 0x01, // 1 coverageFormat: lists
0x00, 0x01, // 1 glyphCount
0x02, 0x34, // LamWithMeemWithJeem
// LigatureGlyphID glyphArray[0]
// MarkArray
// MarkGlyphsArray MarkArray table definition
0x00, 0x02, // 2 markCount
// markRecords[0] MarkRecords in Coverage index order
0x00, 0x00,
0x00, 0x0A, // sukunMarkAnchor markAnchorOffset
// markRecords[1]
0x00, 0x01,
0x00, 0x10, // kasratanMarkAnchor markAnchorOffset
// AnchorFormat1
// sukunMarkAnchor Anchor table definition
0x00, 0x01, // 1 anchorFormat: design units only
0x01, 0x5A, // 346 xCoordinate
0xFF, 0x9E, // -98 yCoordinate
// AnchorFormat1
// kasratanMarkAnchor Anchor table definition
0x00, 0x01, // 1 anchorFormat: design units only
0x01, 0x05, // 261 xCoordinate
0x01, 0xE8, // 488 yCoordinate
// LigatureArray
// LigGlyphsArray LigatureArray table definition
0x00, 0x01, // 1 ligatureCount
0x00, 0x04, // LamWithMeemWithJeemLigAttach ligatureAttachOffsets[0]
// LigatureAttach
// LamWithMeemWithJeemLigAttach LigatureAttach table definition
0x00, 0x03, // 3 componentCount
0x00,
0x0E, // AboveLamAnchor ligatureAnchorOffsets[0] — offsets ordered by mark class
0x00,
0x00, // NULL ligatureAnchorOffsets[1] — no attachment points for Class1 marks
// componentRecords[1]
0x00,
0x00, // NULL ligatureAnchorOffsets[0] — no attachment points for Class 0 marks
0x00,
0x14, // B // componentRecords[2]
0x00,
0x00, // NULL ligatureAnchorOffsets — no attachment points for Class 0 marks
0x00,
0x00, // NULL ligatureAnchorOffsets[1] — no attachment points for Class 1 marks
// AnchorFormat1
// AboveLamAnchor Anchor table definition
0x00, 0x01, // 1 anchorFormat: design units only
0x02, 0x71, // 625 xCoordinate
0x07, 0x08, // 1800 yCoordinate
// AnchorFormat1
// BelowMeemAnchor Anchor table definition
0x00, 0x01, // 1 anchorFormat: design units only
0x01, 0x78, // 376 xCoordinate
0xFE, 0x90, // -368 yCoordinate
];
let expected = expected_gpos(vec![Lookup {
flags: LookupFlags::empty(),
mark_filtering_set: None,
rule: Positioning::MarkToLig(vec![MarkLigPos {
ligatures: btreemap!(564 => vec![
btreemap!(0 => Anchor { xCoordinate: 625, yCoordinate: 1800, anchorPoint: None },
),
btreemap!(
1 => Anchor { xCoordinate: 376, yCoordinate: -368, anchorPoint: None },
),
btreemap!(),
]),
marks: btreemap!(
828 => (0, Anchor { xCoordinate: 346, yCoordinate: -98, anchorPoint: None }),
831 => (1, Anchor { xCoordinate: 261, yCoordinate: 488, anchorPoint: None })
),
}]),
}]);
assert_can_roundtrip(binary_gpos, &expected);
} | rust_cleaned_test_functions.jsonl/13673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2680
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
3152,
2259,
368,
341,
286,
1077,
7868,
1889,
966,
284,
7486,
90515,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two_sum() {
assert_eq!(two_sum(&[2, 7, 11, 15], 9), vec![(0usize, 1usize)]);
assert_eq!(two_sum(&[2, 7, 11, 15], 13), vec![(0usize, 2usize)]);
assert_eq!(two_sum(&[2, 7, 11, 15], 18), vec![(1usize, 2usize)]);
assert_eq!(
two_sum(&[2, 7, 4, 5], 9),
vec![(0usize, 1usize), (2usize, 3usize)]
);
} | rust_cleaned_test_functions.jsonl/133926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
10160,
368,
341,
286,
2060,
10714,
10297,
19789,
10160,
2099,
58,
17,
11,
220,
22,
11,
220,
16,
16,
11,
220,
16,
20,
1125,
220,
24,
701,
7486,
0,
9697,
15,
51878,
11,
220,
16,
51878,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_request() {
let init = Package::create_init_request(TEST_ROOMID, "key".to_owned());
match &init {
Package::InitRequest(payload) => assert!(payload.starts_with(PACKAGE_INIT_BEGINNING)),
_ => unreachable!(),
}
let init = init.encode().unwrap();
assert_eq!(init.len(), 94);
} | rust_cleaned_test_functions.jsonl/125888 | {
"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,
6137,
7893,
368,
341,
286,
1077,
2930,
284,
16906,
486,
3182,
6137,
7893,
50320,
59966,
915,
11,
330,
792,
3263,
983,
51973,
1423,
286,
2432,
609,
2327,
341,
310,
16906,
486,
3803,
1900,
26772,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_into_authenticator_transport() {
let cbor_authenticator_transport: cbor::Value = cbor_text!("usb");
let authenticator_transport =
AuthenticatorTransport::try_from(cbor_authenticator_transport.clone());
let expected_authenticator_transport = AuthenticatorTransport::Usb;
assert_eq!(
authenticator_transport,
Ok(expected_authenticator_transport)
);
let created_cbor: cbor::Value = authenticator_transport.unwrap().into();
assert_eq!(created_cbor, cbor_authenticator_transport);
} | rust_cleaned_test_functions.jsonl/49005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
45514,
14014,
61393,
46398,
368,
341,
286,
1077,
272,
9368,
14014,
61393,
46398,
25,
272,
9368,
486,
1130,
284,
272,
9368,
4326,
17223,
24343,
797,
286,
1077,
13210,
850,
46398,
4035,
310,
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_time() {
let mut p = Parser::new();
assert_eq!(p.time("T11:22:33.456").1,
Done("", Time::new_str("11", "22", "33", Some("456"), None)));
p = Parser::new();
assert_eq!(p.time("T04:05:06").1,
Done("", Time::new_str("04", "05", "06", None, None)));
} | rust_cleaned_test_functions.jsonl/27414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
368,
341,
262,
1077,
5206,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
6378,
445,
51,
16,
16,
25,
17,
17,
25,
18,
18,
13,
19,
20,
21,
1827,
16,
345,
414,
27357,
1981... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_slot_propagated_threshold_from_votes() {
let keypairs: HashMap<_, _> = iter::repeat_with(|| {
let node_keypair = Keypair::new();
let vote_keypair = Keypair::new();
let stake_keypair = Keypair::new();
let node_pubkey = node_keypair.pubkey();
(
node_pubkey,
ValidatorVoteKeypairs::new(node_keypair, vote_keypair, stake_keypair),
)
})
.take(10)
.collect();
let new_vote_pubkeys: Vec<_> = keypairs
.values()
.map(|keys| keys.vote_keypair.pubkey())
.collect();
let new_node_pubkeys: Vec<_> = keypairs
.values()
.map(|keys| keys.node_keypair.pubkey())
.collect();
run_test_update_slot_propagated_threshold_from_votes(&keypairs, &new_vote_pubkeys, &[], 4);
// Adding the same node pubkey's instead of the corresponding
// vote pubkeys should be equivalent
run_test_update_slot_propagated_threshold_from_votes(&keypairs, &[], &new_node_pubkeys, 4);
// Adding the same node pubkey's in the same order as their
// reach the threshold any sooner.
run_test_update_slot_propagated_threshold_from_votes(
&keypairs,
&new_vote_pubkeys,
&new_node_pubkeys,
4,
);
// because now we are getting 2 new pubkeys on each
// we should have 4/10 validators voting
run_test_update_slot_propagated_threshold_from_votes(
&keypairs,
&new_vote_pubkeys[0..5],
&new_node_pubkeys[5..],
2,
);
} | rust_cleaned_test_functions.jsonl/91767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 905
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
27563,
21663,
351,
657,
21858,
5673,
65116,
368,
341,
286,
1077,
1376,
77256,
25,
10528,
27,
6878,
716,
29,
284,
5367,
486,
30624,
6615,
79453,
341,
310,
1077,
2436,
3097,
12670,
284,
6569,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_match_section_byte() {
assert!(match_section_byte::QueryParser::new()
.parse("SELECT foo")
.is_ok());
assert!(match_section_byte::QueryParser::new()
.parse("select foo")
.is_ok());
assert!(match_section_byte::QueryParser::new()
.parse("INSERT foo")
.is_ok());
assert!(match_section_byte::QueryParser::new()
.parse("UPDATE foo")
.is_ok());
assert!(match_section_byte::QueryParser::new()
.parse("UPDATE update")
.is_err());
} | rust_cleaned_test_functions.jsonl/27434 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
16221,
19737,
368,
341,
262,
2060,
10297,
6347,
16221,
19737,
486,
2859,
6570,
486,
931,
741,
286,
659,
6400,
445,
4858,
15229,
1138,
286,
659,
285,
19817,
1423,
262,
2060,
10297,
6347,
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... | 1 |
#[test]
fn test_monitor_update_fail_claim() {
// Basic test for monitor update failures when processing claim_funds calls.
// the payments from C onwards to A.
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
create_announced_chan_between_nodes(&nodes, 1, 2, InitFeatures::known(), InitFeatures::known());
// Rebalance a bit so that we can send backwards from 3 to 2.
send_payment(&nodes[0], &[&nodes[1], &nodes[2]], 5000000);
let (payment_preimage_1, _, _) = route_payment(&nodes[0], &[&nodes[1]], 1000000);
chanmon_cfgs[1].persister.set_update_ret(Err(ChannelMonitorUpdateErr::TemporaryFailure));
assert!(nodes[1].node.claim_funds(payment_preimage_1));
nodes[1].logger.assert_log("lightning::ln::channelmanager".to_string(), "Temporary failure claiming HTLC, treating as success: Failed to update ChannelMonitor".to_string(), 1);
check_added_monitors!(nodes[1], 1);
// Note that at this point there is a pending commitment transaction update for A being held by
// already-signed commitment transaction and will instead wait for it to resolve before
// forwarding the payment onwards.
let (route, payment_hash_2, _, payment_secret_2) = get_route_and_payment_hash!(nodes[2], nodes[0], 1_000_000);
{
nodes[2].node.send_payment(&route, payment_hash_2, &Some(payment_secret_2)).unwrap();
check_added_monitors!(nodes[2], 1);
}
chanmon_cfgs[1].persister.set_update_ret(Ok(()));
let mut events = nodes[2].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
let payment_event = SendEvent::from_event(events.pop().unwrap());
nodes[1].node.handle_update_add_htlc(&nodes[2].node.get_our_node_id(), &payment_event.msgs[0]);
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 0);
commitment_signed_dance!(nodes[1], nodes[2], payment_event.commitment_msg, false, true);
let (_, payment_hash_3, payment_secret_3) = get_payment_preimage_hash!(nodes[0]);
nodes[2].node.send_payment(&route, payment_hash_3, &Some(payment_secret_3)).unwrap();
check_added_monitors!(nodes[2], 1);
let mut events = nodes[2].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
let payment_event = SendEvent::from_event(events.pop().unwrap());
nodes[1].node.handle_update_add_htlc(&nodes[2].node.get_our_node_id(), &payment_event.msgs[0]);
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 0);
commitment_signed_dance!(nodes[1], nodes[2], payment_event.commitment_msg, false, true);
// Now restore monitor updating on the 0<->1 channel and claim the funds on B.
let (outpoint, latest_update, _) = nodes[1].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&chan_1.2).unwrap().clone();
nodes[1].chain_monitor.chain_monitor.force_channel_monitor_updated(outpoint, latest_update);
check_added_monitors!(nodes[1], 0);
let bs_fulfill_update = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &bs_fulfill_update.update_fulfill_htlcs[0]);
commitment_signed_dance!(nodes[0], nodes[1], bs_fulfill_update.commitment_signed, false);
expect_payment_sent!(nodes[0], payment_preimage_1);
expect_pending_htlcs_forwardable!(nodes[1]);
check_added_monitors!(nodes[1], 1);
let bs_forward_update = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_add_htlc(&nodes[1].node.get_our_node_id(), &bs_forward_update.update_add_htlcs[0]);
nodes[0].node.handle_update_add_htlc(&nodes[1].node.get_our_node_id(), &bs_forward_update.update_add_htlcs[1]);
commitment_signed_dance!(nodes[0], nodes[1], bs_forward_update.commitment_signed, false);
expect_pending_htlcs_forwardable!(nodes[0]);
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 2);
match events[0] {
Event::PaymentReceived { ref payment_hash, ref purpose, amt } => {
assert_eq!(payment_hash_2, *payment_hash);
assert_eq!(1_000_000, amt);
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
assert_eq!(payment_secret_2, *payment_secret);
},
_ => panic!("expected PaymentPurpose::InvoicePayment")
}
},
_ => panic!("Unexpected event"),
}
match events[1] {
Event::PaymentReceived { ref payment_hash, ref purpose, amt } => {
assert_eq!(payment_hash_3, *payment_hash);
assert_eq!(1_000_000, amt);
match &purpose {
PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, .. } => {
assert!(payment_preimage.is_none());
assert_eq!(payment_secret_3, *payment_secret);
},
_ => panic!("expected PaymentPurpose::InvoicePayment")
}
},
_ => panic!("Unexpected event"),
}
} | rust_cleaned_test_functions.jsonl/58344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1970
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40112,
8882,
22121,
84969,
368,
341,
197,
322,
14625,
1273,
369,
8718,
2647,
27850,
979,
8692,
3717,
761,
42950,
6738,
624,
49106,
197,
322,
279,
14173,
504,
356,
59425,
311,
362,
624,
10217,
2602... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_top_modules() {
let inv = Invoice {
bindle_version: "v1".to_owned(),
yanked: None,
signature: None,
annotations: None,
bindle: BindleSpec {
id: "drink/1.2.3"
.to_owned()
.try_into()
.expect("This should parse"),
description: None,
authors: None,
},
group: Some(vec![Group {
name: "coffee".to_owned(),
required: None,
satisfied_by: None,
}]),
parcel: Some(vec![
Parcel {
label: Label {
sha256: "yubbadubbadoo".to_owned(),
name: "mocha-java".to_owned(),
media_type: WASM_MEDIA_TYPE.to_owned(),
size: 1234,
annotations: None,
feature: None,
},
conditions: Some(Condition {
member_of: Some(vec!["coffee".to_owned()]),
requires: None,
}),
},
Parcel {
label: Label {
sha256: "abc123".to_owned(),
name: "yirgacheffe".to_owned(),
media_type: WASM_MEDIA_TYPE.to_owned(),
size: 1234,
annotations: None,
feature: None,
},
conditions: Some(Condition {
member_of: Some(vec!["coffee".to_owned()]),
requires: None,
}),
},
Parcel {
label: Label {
sha256: "yubbadubbadoonow".to_owned(),
name: "water".to_owned(),
media_type: WASM_MEDIA_TYPE.to_owned(),
size: 1234,
annotations: None,
feature: None,
},
conditions: Some(Condition {
member_of: None,
requires: None,
}),
},
]),
};
let res = top_modules(&inv);
assert_eq!(res.len(), 1);
assert_eq!(
res.get(0).expect("first item").label.name,
"water".to_owned()
);
} | rust_cleaned_test_functions.jsonl/82234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1722
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
15848,
368,
341,
286,
1077,
1529,
284,
40190,
341,
310,
10719,
273,
9438,
25,
330,
85,
16,
3263,
983,
51973,
3148,
310,
379,
40772,
25,
2240,
345,
310,
11957,
25,
2240,
345,
310,
32207,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_encoders() -> Result<(), ConnectionError> {
assert_bind_encode(true, &[0, 0, 0, 1, 1]);
assert_bind_encode(false, &[0, 0, 0, 1, 0]);
assert_bind_encode(
TimestampValue::new(1650890322, None),
&[0, 0, 0, 8, 255, 252, 162, 254, 196, 225, 80, 202],
);
assert_bind_encode(
TimestampValue::new(1650890322, Some("UTC".to_string())),
&[0, 0, 0, 8, 255, 252, 162, 254, 196, 225, 80, 202],
);
Ok(())
} | rust_cleaned_test_functions.jsonl/14351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
13781,
52498,
368,
1464,
5714,
68843,
11032,
1454,
29,
341,
286,
2060,
27461,
11224,
3715,
11,
44590,
15,
11,
220,
15,
11,
220,
15,
11,
220,
16,
11,
220,
16,
2558,
286,
2060,
27461,
112... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_search_remote_apps() {
let remote_url =
"https://api.github.com/repos/ScoopInstaller/Main/git/trees/HEAD?recursive=1";
let query = "7zip";
let actual = App::search_remote_apps(remote_url, query).unwrap();
let expect = vec![App {
name: String::from("bucket/7zip"),
version: String::new(),
bin: Vec::new(),
}];
assert_eq!(expect, actual);
} | rust_cleaned_test_functions.jsonl/9979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
36425,
69899,
368,
341,
286,
1077,
8699,
2903,
4035,
310,
330,
2428,
1110,
2068,
11021,
905,
49505,
11374,
86857,
88096,
65241,
60590,
5523,
7858,
14,
35433,
30,
49512,
28,
16,
876,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_malformed_module() {
// Compile module M.
let code = r#"
module {{ADDR}}::M {
public fun foo() {}
}
"#;
let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let mut units = compile_units(&code).unwrap();
let m = as_module(units.pop().unwrap());
let mut blob = vec![];
m.serialize(&mut blob).unwrap();
let module_id = ModuleId::new(TEST_ADDR, Identifier::new("M").unwrap());
let fun_name = Identifier::new("foo").unwrap();
let mut gas_status = GasStatus::new_unmetered();
{
let mut storage = InMemoryStorage::new();
storage.publish_or_overwrite_module(m.self_id(), blob.clone());
let vm = MoveVM::new(vec![]).unwrap();
let mut sess = vm.new_session(&storage);
sess.execute_function(&module_id, &fun_name, vec![], vec![], &mut gas_status)
.unwrap();
}
// Start over with a fresh storage and publish a corrupted version of M.
// A fresh VM needs to be used whenever the storage has been modified or otherwise the
// loader cache gets out of sync.
// invariant violation error.
{
blob[0] = 0xde;
blob[1] = 0xad;
blob[2] = 0xbe;
blob[3] = 0xef;
let mut storage = InMemoryStorage::new();
storage.publish_or_overwrite_module(m.self_id(), blob);
let vm = MoveVM::new(vec![]).unwrap();
let mut sess = vm.new_session(&storage);
let err = sess
.execute_function(&module_id, &fun_name, vec![], vec![], &mut gas_status)
.unwrap_err();
assert_eq!(err.status_type(), StatusType::InvariantViolation);
}
} | rust_cleaned_test_functions.jsonl/48432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 755
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
278,
10155,
10750,
368,
341,
262,
442,
54467,
4688,
386,
624,
262,
1077,
2038,
284,
435,
2,
698,
286,
4688,
5867,
29210,
3417,
486,
44,
341,
310,
584,
2464,
15229,
368,
5613,
286,
456,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mut() {
let span = span::mock().named("err_mut");
let (collector, handle) = collector::mock()
.new_span(span.clone())
.enter(span.clone())
.event(event::mock().at_level(Level::ERROR))
.exit(span.clone())
.drop_span(span)
.done()
.run_with_handle();
with_default(collector, || err_mut(&mut 0).ok());
handle.assert_finished();
} | rust_cleaned_test_functions.jsonl/3566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
368,
341,
262,
1077,
9390,
284,
9390,
486,
16712,
1005,
30245,
445,
615,
29523,
797,
262,
1077,
320,
91469,
11,
3705,
8,
284,
31953,
486,
16712,
741,
286,
659,
931,
37382,
66092,
15997,
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... | 2 |
#[test]
fn test_schema_from_thrift_with_num_children_set() {
let message_type = "
message schema {
OPTIONAL BYTE_ARRAY id (UTF8);
OPTIONAL BYTE_ARRAY name (UTF8);
OPTIONAL BYTE_ARRAY message (UTF8);
OPTIONAL INT32 type (UINT_8);
OPTIONAL INT64 author_time (TIMESTAMP_MILLIS);
OPTIONAL INT64 __index_level_0__;
}
";
let expected_schema = parse_message_type(message_type).unwrap();
let mut thrift_schema = to_thrift(&expected_schema).unwrap();
for mut elem in &mut thrift_schema[..] {
if elem.num_children == None {
elem.num_children = Some(0);
}
}
let result_schema = from_thrift(&thrift_schema).unwrap();
assert_eq!(result_schema, Arc::new(expected_schema));
} | rust_cleaned_test_functions.jsonl/16694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
5673,
5854,
41380,
6615,
4273,
31206,
2602,
368,
341,
1789,
286,
1077,
1943,
1819,
284,
6228,
262,
1943,
10802,
341,
414,
76232,
35377,
17724,
877,
320,
8561,
23,
317,
414,
76232,
35377,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_decimal() {
let tests = [
("123.00", 12300i128),
("123.123", 123123i128),
("0.0123", 123i128),
("0.12300", 12300i128),
("-5.123", -5123i128),
("-45.432432", -45432432i128),
];
for (s, i) in tests {
let result = parse_decimal(s);
assert_eq!(i, result.unwrap());
}
} | rust_cleaned_test_functions.jsonl/16419 | {
"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,
21039,
74429,
368,
341,
286,
1077,
7032,
284,
2278,
310,
3489,
16,
17,
18,
13,
15,
15,
497,
220,
16,
17,
18,
15,
15,
72,
16,
17,
23,
1326,
310,
3489,
16,
17,
18,
13,
16,
17,
18,
497,
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... | 2 |
#[test]
fn test_generic_opaque_type_in_fn_ptr() {
// Test printing a generic opaque type as an fn ptr's parameter
reparse_test!(
program {
struct Foo {}
trait Bar<T> {}
trait Faz {
type Assoc;
}
impl Faz for Foo {
type Assoc = fn(Baz<Foo>);
}
impl<T> Bar<T> for Foo { }
opaque type Baz<T>: Bar<T> = Foo;
}
);
} | rust_cleaned_test_functions.jsonl/34210 | {
"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,
41232,
10287,
19659,
1819,
1243,
15246,
4348,
368,
341,
262,
442,
3393,
18484,
264,
13954,
46484,
943,
438,
458,
5168,
10087,
594,
5733,
198,
262,
312,
6400,
4452,
33673,
286,
2025,
341,
310,
2036... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bank_forks_different_set_root() {
solana_logger::setup();
let leader_keypair = Keypair::new();
let GenesisConfigInfo {
mut genesis_config,
mint_keypair: _,
voting_keypair,
} = create_genesis_config_with_leader(10_000, &leader_keypair.pubkey(), 1_000);
let slots_in_epoch = 32;
genesis_config.epoch_schedule = EpochSchedule::new(slots_in_epoch);
let bank0 = Bank::new(&genesis_config);
let mut bank_forks0 = BankForks::new(bank0);
bank_forks0.set_root(0, &AbsRequestSender::default(), None);
let bank1 = Bank::new(&genesis_config);
let mut bank_forks1 = BankForks::new(bank1);
let additional_timestamp_secs = 2;
let num_slots = slots_in_epoch + 1; // Advance past first epoch boundary
for slot in 1..num_slots {
let update_timestamp_case = slot == slots_in_epoch;
let child1 = Bank::new_from_parent(&bank_forks0[slot - 1], &Pubkey::default(), slot);
let child2 = Bank::new_from_parent(&bank_forks1[slot - 1], &Pubkey::default(), slot);
if update_timestamp_case {
for child in &[&child1, &child2] {
let recent_timestamp: UnixTimestamp = child.unix_timestamp_from_genesis();
update_vote_account_timestamp(
BlockTimestamp {
slot: child.slot(),
timestamp: recent_timestamp + additional_timestamp_secs,
},
&child,
&voting_keypair.pubkey(),
);
}
}
// Set root in bank_forks0 to truncate the ancestor history
bank_forks0.insert(child1);
bank_forks0.set_root(slot, &AbsRequestSender::default(), None);
// Don't set root in bank_forks1 to keep the ancestor history
bank_forks1.insert(child2);
}
let child1 = &bank_forks0.working_bank();
let child2 = &bank_forks1.working_bank();
child1.freeze();
child2.freeze();
info!("child0.ancestors: {:?}", child1.ancestors);
info!("child1.ancestors: {:?}", child2.ancestors);
assert_eq!(child1.hash(), child2.hash());
} | rust_cleaned_test_functions.jsonl/30581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
761,
73302,
82741,
2602,
12993,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
7653,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
40788,
2648,
1731,
341,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_from_str_vec() {
let vec = vec!["foo", "asdfas", "asdkj", "as"];
let value = vec
.iter()
.map(|i| ExpressionNode::from(*i))
.collect::<Vec<_>>();
assert_eq!(
ExpressionNode::from(vec.to_vec()),
ExpressionNode::Array(ArrayNode { value, span: None })
);
} | rust_cleaned_test_functions.jsonl/89520 | {
"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,
5673,
2895,
13251,
368,
341,
286,
1077,
7486,
284,
7486,
0,
1183,
7975,
497,
330,
76615,
300,
497,
330,
300,
7584,
73,
497,
330,
300,
31797,
286,
1077,
897,
284,
7486,
198,
310,
659,
2015,
741... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_struct_keep_comments_and_attrs_several_fields_tuple() {
check_assist(
extract_struct_from_enum_variant,
"enum A { $0One(/* comment */ #[attr] u32, /* another */ u32 /* tail */) }",
r#"
struct One(/* comment */ #[attr] u32, /* another */ u32 /* tail */);
enum A { One(One) }"#,
);
} | rust_cleaned_test_functions.jsonl/36299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
15126,
50293,
30359,
8378,
39578,
3453,
17539,
12132,
21773,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
15126,
5673,
31054,
46112,
345,
310,
330,
9018,
362,
314,
400,
15,
3966,
49589,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addition() {
assert_eq!(Boolean(false) + Boolean(false), Boolean(false));
assert_eq!(Boolean(false) + Boolean(true), Boolean(true));
assert_eq!(Boolean(true) + Boolean(false), Boolean(true));
assert_eq!(Boolean(true) + Boolean(true), Boolean(true));
assert_eq!(Float(1.1) + Float(2.2), Float(3.3));
assert_eq!(Float(1.1) + Float(-2.2), Float(-1.1));
assert_eq!(Float(1.1) + Integer(2), Float(3.1));
assert_eq!(Float(1.1) + Integer(-2), Float(-0.9));
assert_eq!(Integer(1) + Integer(2), Integer(3));
assert_eq!(Integer(1) + Integer(-2), Integer(-1));
assert_eq!(Integer(1) + Float(2.2), Float(3.2));
assert_eq!(Integer(1) + Float(-2.1), Float(-1.1));
} | rust_cleaned_test_functions.jsonl/101193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
680,
368,
341,
286,
2060,
10714,
10297,
6890,
3576,
8,
488,
6992,
3576,
701,
6992,
3576,
1106,
286,
2060,
10714,
10297,
6890,
3576,
8,
488,
6992,
3715,
701,
6992,
3715,
1106,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strings_in_vec_should_be_concatenated_and_escaped_correctly() {
let params = StreamsParams::new()
.with_channel("StarCraft I")
.with_channel("StarCraft II");
assert_eq!(params.into_query_string(), "?channel=StarCraft%20I,StarCraft%20II");
} | rust_cleaned_test_functions.jsonl/53706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33500,
1243,
13251,
43378,
21263,
57478,
268,
657,
8378,
62,
65826,
31550,
398,
368,
341,
286,
1077,
3628,
284,
94522,
4870,
486,
931,
741,
394,
659,
4197,
14571,
445,
12699,
38849,
358,
1138,
394... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rust_logo_scale_down() {
// The goal of this test is to check that the tessellator can handle very small geometry.
let mut builder = Path::builder().flattened(0.011).with_svg();
build_logo_path(&mut builder);
let mut path = builder.build();
scale_path(&mut path, 0.005);
test_path(path.as_slice());
} | rust_cleaned_test_functions.jsonl/102407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
590,
29962,
16727,
13998,
368,
341,
262,
442,
576,
5795,
315,
419,
1273,
374,
311,
1779,
429,
279,
79830,
613,
850,
646,
3705,
1602,
2613,
17047,
382,
262,
1077,
5206,
7363,
284,
7933,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_verify_pubkey() {
let pubkey = solana_sdk::pubkey::new_rand();
assert_eq!(verify_pubkey(&pubkey.to_string()).unwrap(), pubkey);
let bad_pubkey = "a1b2c3d4";
assert_eq!(
verify_pubkey(&bad_pubkey.to_string()),
Err(Error::invalid_params("Invalid param: WrongSize"))
);
} | rust_cleaned_test_functions.jsonl/3045 | {
"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,
60799,
35638,
34014,
792,
368,
341,
286,
1077,
95116,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
2060,
10714,
10297,
12446,
34014,
792,
2099,
9585,
792,
2389,
3904,
6011,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flags_from_vec_2() {
let (flags, subcommand, argv) =
flags_from_vec(svec!["deno", "-r", "run", "script.ts"]);
assert_eq!(
flags,
DenoFlags {
reload: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(argv, svec!["deno", "script.ts"]);
} | rust_cleaned_test_functions.jsonl/112831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5673,
13251,
62,
17,
368,
341,
262,
1077,
320,
11161,
11,
1186,
5631,
11,
10213,
8,
4035,
414,
8042,
5673,
13251,
1141,
4083,
0,
1183,
5183,
78,
497,
6523,
81,
497,
330,
6108,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tokenomic() {
new_test_ext().execute_with(|| {
let params = TokenomicParameters::<Test>::get().unwrap();
let tokenomic = Tokenomic::<Test>::new(params);
fn pow(x: FixedPoint, n: u32) -> FixedPoint {
let mut i = n;
let mut x_pow2 = x;
let mut z = FixedPoint::from_num(1);
while i > 0 {
if i & 1 == 1 {
z *= x_pow2;
}
x_pow2 *= x_pow2;
i >>= 1;
}
z
}
// Vmax
assert_eq!(tokenomic.v_max(), fp!(30000));
// Minimal stake
assert_eq!(tokenomic.minimal_stake(1000), 3162_277660146355);
// Ve for different confidence level
assert_eq!(
tokenomic.ve(1000 * DOLLARS, 1000, 1),
fp!(1690.0000000000000000282)
);
assert_eq!(
tokenomic.ve(1000 * DOLLARS, 1000, 2),
fp!(1690.0000000000000000282)
);
assert_eq!(
tokenomic.ve(1000 * DOLLARS, 1000, 3),
fp!(1690.0000000000000000282)
);
assert_eq!(
tokenomic.ve(1000 * DOLLARS, 1000, 4),
fp!(1612.0000000000000000247)
);
assert_eq!(
tokenomic.ve(1000 * DOLLARS, 1000, 5),
fp!(1572.9999999999999999877)
);
// Rig cost estimation
assert_eq!(tokenomic.rig_cost(500), fp!(150.0000000000000000054));
assert_eq!(tokenomic.rig_cost(2000), fp!(600.0000000000000000217));
assert_eq!(tokenomic.rig_cost(2800), fp!(840.00000000000000003036));
const BLOCK_SEC: u32 = 12;
const HOUR_BLOCKS: u32 = 3600 / BLOCK_SEC;
let slash_rate = FixedPoint::from_bits(tokenomic.params.slash_rate);
let slash_decay = FixedPoint::from_num(1) - slash_rate;
assert_eq!(pow(slash_decay, HOUR_BLOCKS), fp!(0.9990004981683704595));
// rho per hour
let rho = FixedPoint::from_bits(tokenomic.params.rho);
assert_eq!(pow(rho, HOUR_BLOCKS), fp!(1.00019999999998037056));
// Budget per day
let budger_per_block = FixedPoint::from_bits(tokenomic.params.budget_per_block);
assert_eq!(budger_per_block * 3600 * 24 / 12, fp!(720000));
// Cost estimation per year
assert_eq!(
tokenomic.op_cost(2000) / 12 * 3600 * 24 * 365,
fp!(171.71874999975847951583)
);
});
} | rust_cleaned_test_functions.jsonl/86889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1050
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
3075,
368,
341,
298,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
571,
10217,
3628,
284,
9660,
3075,
9706,
27638,
2271,
6831,
455,
1005,
15454,
543,
571,
10217,
3950,
3075,
284,
9660,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_unfinished() {
test_parse_err::<Simple>(&["<Simple>
<c>abc</c>
<a/>
<b>2</b>
<d/>"]);
} | rust_cleaned_test_functions.jsonl/54633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4907,
12129,
368,
341,
262,
1273,
21039,
9266,
27638,
16374,
44784,
1183,
27,
16374,
397,
310,
366,
66,
29,
13683,
522,
66,
397,
310,
366,
64,
10171,
310,
366,
65,
29,
17,
522,
65,
397,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_init_empty_context_for_sandbox_with_patch_json() -> Result<(), anyhow::Error> {
// init runtime and turn on/off ocaml logging
client::change_runtime_configuration(TezosRuntimeConfiguration {
debug_mode: false,
compute_context_action_tree_hashes: false,
log_enabled: common::is_ocaml_log_enabled(),
})
.unwrap();
// prepare data
let storage_data_dir = "init_storage_tests_02";
// run init storage for all nets
let net = TezosEnvironment::Sandbox;
let default_networks = default_networks();
let tezos_env: &TezosEnvironmentConfiguration = default_networks
.get(&net)
.unwrap_or_else(|| panic!("no tezos environment configured for: {:?}", &net));
let patch_context = PatchContext {
key: String::from("sandbox_parameter"),
json: String::from(
r#" { "genesis_pubkey": "edpkuSLWfVU1Vq7Jg9FucPyKmma6otcMHac9zG4oU1KMHSTBpJuGQ2"} "#,
),
};
let storage = TezosContextStorageConfiguration::Both(
TezosContextIrminStorageConfiguration {
data_dir: common::prepare_empty_dir(storage_data_dir),
},
TezosContextTezEdgeStorageConfiguration {
backend: tezos_api::ffi::ContextKvStoreConfiguration::InMem,
ipc_socket_path: None,
},
);
let context_config = TezosContextConfiguration {
storage,
genesis: tezos_env.genesis.clone(),
protocol_overrides: tezos_env.protocol_overrides.clone(),
commit_genesis: true,
enable_testchain: false,
readonly: false,
sandbox_json_patch_context: Some(patch_context),
context_stats_db_path: None,
};
match client::init_protocol_context(context_config) {
Err(e) => panic!(
"Failed to initialize storage for: {:?}, Reason: {:?}",
net, e
),
Ok(init_info) => {
if let Some(commit_hash) = &init_info.genesis_commit_hash {
assert_eq!(
*commit_hash,
ContextHash::try_from("CoVBYdAGWBoDTkiVXJEGX6FQvDN1oGCPJu8STMvaTYdeh7N3KGTz")?
)
} else {
panic!("Expected some context hash")
}
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/54418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1064
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
15124,
8467,
5478,
643,
31536,
6615,
39643,
9455,
368,
1464,
5714,
68843,
88964,
486,
1454,
29,
341,
262,
442,
2930,
15592,
323,
2484,
389,
50806,
17796,
9467,
8392,
198,
262,
2943,
486,
337... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_create_session_config_cacert_not_found() {
let cfg = CloudConfig {
auth_type: Some("password".into()),
auth: Some(Auth {
auth_url: Some("http://127.0.0.1".into()),
username: Some("vasya".into()),
password: Some("hacker".into()),
project_name: Some("admin".into()),
..Auth::default()
}),
cacert: Some("/I/do/not/exist".into()),
region_name: Some("Lapland".into()),
..CloudConfig::default()
};
assert!(cfg.create_session_config().is_err());
} | rust_cleaned_test_functions.jsonl/99078 | {
"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,
8657,
12316,
5332,
666,
580,
529,
7913,
21480,
368,
341,
286,
1077,
13286,
284,
14817,
2648,
341,
310,
4166,
1819,
25,
4329,
445,
3833,
3263,
18122,
14702,
310,
4166,
25,
4329,
37640,
341,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_half() {
assert_eq!(
FinancialPeriod::Half {
half: 1,
year: 1972
}
.is_valid(),
true
);
assert_eq!(
FinancialPeriod::Half {
half: 5,
year: 1972
}
.is_valid(),
false
);
} | rust_cleaned_test_functions.jsonl/21179 | {
"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,
6892,
8337,
40626,
368,
341,
286,
2060,
10714,
33673,
310,
17503,
23750,
486,
42627,
341,
394,
4279,
25,
220,
16,
345,
394,
1042,
25,
220,
16,
24,
22,
17,
198,
310,
456,
310,
659,
285,
8337,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_as_duration() {
test_none_with_ctx_and_extra(cast_json_as_duration);
// the case that Json::unquote failed had be tested by test_json_unquote
let cs = vec![
Json::from_object(BTreeMap::default()).unwrap(),
Json::from_array(vec![]).unwrap(),
Json::from_i64(10).unwrap(),
Json::from_i64(i64::MAX).unwrap(),
Json::from_i64(i64::MIN).unwrap(),
Json::from_u64(0).unwrap(),
Json::from_u64(u64::MAX).unwrap(),
Json::from_f64(10.5).unwrap(),
Json::from_f64(10.4).unwrap(),
Json::from_f64(-10.4).unwrap(),
Json::from_f64(-10.5).unwrap(),
Json::from_f64(i64::MIN as u64 as f64).unwrap(),
Json::from_f64(i64::MAX as u64 as f64).unwrap(),
Json::from_f64(i64::MIN as u64 as f64).unwrap(),
Json::from_f64(i64::MIN as f64).unwrap(),
Json::from_f64(((1u64 << 63) + (1u64 << 62)) as u64 as f64).unwrap(),
Json::from_f64(-((1u64 << 63) as f64 + (1u64 << 62) as f64)).unwrap(),
Json::from_f64(f64::from(f32::MIN)).unwrap(),
Json::from_f64(f64::from(f32::MAX)).unwrap(),
Json::from_f64(f64::MAX).unwrap(),
Json::from_f64(f64::MAX).unwrap(),
Json::from_string(String::from("10.0")).unwrap(),
Json::from_string(String::from(
"999999999999999999999999999999999999999999999999",
))
.unwrap(),
Json::from_string(String::from(
"-999999999999999999999999999999999999999999999999",
))
.unwrap(),
Json::from_string(String::from(
"99999999999999999999999999999999999999999999999aabcde9",
))
.unwrap(),
Json::from_string(String::from(
"-99999999999999999999999999999999999999999999999aabcde9",
))
.unwrap(),
Json::from_bool(true).unwrap(),
Json::from_bool(false).unwrap(),
Json::none().unwrap(),
];
let cs_ref: Vec<JsonRef> = cs.iter().map(|x| x.as_ref()).collect();
test_as_duration_helper(
cs_ref,
|x| x.unquote().unwrap(),
|x| format!("{:?}", x),
cast_json_as_duration,
"cast_json_as_duration",
);
} | rust_cleaned_test_functions.jsonl/1996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
11898,
25454,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
9455,
11898,
25454,
626,
286,
442,
279,
1142,
429,
8308,
486,
359,
2949,
4641,
1030,
387,
12510,
553,
1273,
945... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul() {
let t1 = Decomposed {
scale: 2.0f64,
rot: Quaternion::new(0.5f64.sqrt(), 0.5f64.sqrt(), 0.0, 0.0),
disp: Vector3::new(1.0f64, 2.0, 3.0),
};
let t2 = Decomposed {
scale: 3.0f64,
rot: Quaternion::new(0.5f64.sqrt(), 0.0, 0.5f64.sqrt(), 0.0),
disp: Vector3::new(-2.0, 1.0, 0.0),
};
let actual = t1 * t2;
let expected = Decomposed {
scale: 6.0f64,
rot: Quaternion::new(0.5, 0.5, 0.5, 0.5),
disp: Vector3::new(-3.0, 2.0, 5.0),
};
assert_ulps_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/86457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
262,
1077,
259,
16,
284,
96378,
3865,
341,
286,
5452,
25,
220,
17,
13,
15,
69,
21,
19,
345,
286,
5749,
25,
24801,
486,
931,
7,
15,
13,
20,
69,
21,
19,
18049,
1507,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_ser_internally_tagged_enum() -> Result<(), Box<EvalAltResult>> {
#[derive(Serialize)]
#[serde(tag = "tag")]
enum MyEnum {
VariantEmptyStruct {},
VariantStruct { a: i32 },
}
let mut map = to_dynamic(MyEnum::VariantEmptyStruct {})?.cast::<Map>();
assert_eq!(
"VariantEmptyStruct",
map.remove("tag")
.unwrap()
.into_immutable_string()
.unwrap()
.as_str()
);
assert!(map.is_empty());
let mut map = to_dynamic(MyEnum::VariantStruct { a: 123 })?.cast::<Map>();
assert_eq!(
"VariantStruct",
map.remove("tag")
.unwrap()
.into_immutable_string()
.unwrap()
.as_str()
);
assert_eq!(Ok(123), map.remove("a").unwrap().as_int());
assert!(map.is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/97329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
75861,
4042,
932,
745,
9372,
3556,
31054,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
11506,
27098,
3759,
9050,
5563,
262,
11506,
47024,
19343,
284,
330,
4578,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arr() {
let code = vec![0x6B, 0xD1];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.A = 0xFF;
nes.next(&mut memory).unwrap();
assert_eq!(1, nes.C);
assert_eq!(0, nes.V);
assert_eq!(0, nes.N);
assert_eq!(0, nes.Z);
assert_eq!(0x68, nes.A);
} | rust_cleaned_test_functions.jsonl/38742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11210,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
87,
21,
33,
11,
220,
15,
15764,
16,
935,
286,
1077,
5206,
308,
288,
284,
356,
5584,
486,
931,
543,
286,
1077,
5206,
4938,
284,
501,
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_assert_range_fail() {
assert_range!((0..10), 11);
assert_range!((1.0..=2.0), 2.1);
} | rust_cleaned_test_functions.jsonl/83469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 60
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
9698,
22121,
368,
341,
262,
2060,
9698,
0,
1188,
15,
496,
16,
15,
701,
220,
16,
16,
317,
262,
2060,
9698,
0,
1188,
16,
13,
15,
496,
28,
17,
13,
15,
701,
220,
17,
13,
16,
317,
92
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_extract_session_metrics_ok() {
let mut metrics = vec![];
let session = SessionUpdate::parse(
r#"{
"init": false,
"started": "2021-04-26T08:00:00+0100",
"attrs": {
"release": "1.0.0"
},
"did": "user123"
}"#
.as_bytes(),
)
.unwrap();
extract_session_metrics(&session.attributes, &session, &mut metrics);
// A none-initial update will not trigger any metric if it's not errored/crashed
assert_eq!(metrics.len(), 0);
} | rust_cleaned_test_functions.jsonl/63638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
12316,
37686,
19817,
368,
341,
286,
1077,
5206,
16734,
284,
7486,
0,
40901,
286,
1077,
3797,
284,
9164,
4289,
486,
6400,
1006,
310,
435,
55543,
515,
394,
330,
2327,
788,
895,
345,
394,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dcx_h() {
let mut state = State8080::empty_state();
state.memory = vec![0x2b];
state.h = 0x98;
state.l = 0x00;
emulate_8080_op(&mut state);
assert_eq!(state.h, 0x97);
assert_eq!(state.l, 0xff);
} | rust_cleaned_test_functions.jsonl/7758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
25844,
1523,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
87,
17,
65,
935,
286,
1584,
860,
284,
220,
15,
87,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_noop() {
// check if we can cast categorical twice without panic
let ca = Utf8Chunked::new_from_slice("foo", &["bar", "ham"]);
let out = ca.cast(&DataType::Categorical).unwrap();
let out = out.cast(&DataType::Categorical).unwrap();
assert_eq!(out.dtype(), &DataType::Categorical)
} | rust_cleaned_test_functions.jsonl/5660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
6536,
453,
368,
341,
286,
442,
1779,
421,
582,
646,
6311,
69536,
10917,
2041,
21975,
198,
286,
1077,
2162,
284,
43432,
23,
28304,
291,
486,
931,
5673,
26488,
445,
7975,
497,
609,
1183,
225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_none() {
let code = "123qwe";
let span = code.span();
let x = substr("asd");
let t = x.or_else(|| substr("qwe"));
let r = t.parse(span.ref_clone());
println!("{:?}", r);
assert_eq!(r, None);
} | rust_cleaned_test_functions.jsonl/94326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31488,
368,
341,
286,
1077,
2038,
284,
330,
16,
17,
18,
80,
896,
876,
286,
1077,
9390,
284,
2038,
52869,
543,
286,
1077,
856,
284,
15769,
445,
79102,
797,
286,
1077,
259,
284,
856,
24282,
6262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get() {
assert_eq!(2u32.bit(0), false);
assert_eq!(2u32.bit(1), true);
assert_eq!(2u32.bit(2), false);
assert_eq!(123u32.bits(0..0), 0);
assert_eq!(255u32.bits(0..8), 255);
assert_eq!(255u32.bits(0..9), 255);
assert_eq!(255u32.bits(0..7), 127);
assert_eq!(1234u32.bits(32..), 0);
assert_eq!(1234u32.bits(..32), 1234);
assert_eq!(1234u32.bits(0..32), 1234);
assert_eq!(123u32.bits(0..=0), 1);
assert_eq!(123u32.bits(0..=-1), 0);
assert_eq!(1234u32.bits(0..=31), 1234);
assert_eq!((-1i32).bits(0..), !0);
assert_eq!((-1i32).bits(1..), !0 >> 1);
assert_eq!(0xFFu32.bits((Bound::Excluded(1), Bound::Included(1))), 0);
assert_eq!((!0u32).bits((Bound::Excluded(31), Bound::Included(31))), 0);
assert_eq!((!0u32).bits((Bound::Excluded(-1), Bound::Included(31))), !0);
assert_eq!(
0x555u32.bits((Bound::Excluded(1), Bound::Included(7))),
0x15
);
assert_eq!(
0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAu128.bits(0..128),
0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
);
assert_eq!(
0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAu128.bits(0i8..=127i8),
0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
);
assert_eq!(
0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAu128.bits(64..),
0xAAAAAAAAAAAAAAAA
);
assert_eq!(0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAu128.bits(127..), 1);
} | rust_cleaned_test_functions.jsonl/52222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
6948,
10714,
10297,
17,
84,
18,
17,
30099,
7,
15,
701,
895,
317,
6948,
10714,
10297,
17,
84,
18,
17,
30099,
7,
16,
701,
830,
317,
6948,
10714,
10297,
17,
84,
18,
17,
30099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_numeric_valid_nested() {
let mut test = Map::new();
test.assign("numeric", Value::String("3".to_owned())).ok();
let mut params = Map::new();
params.assign("test", Value::Map(test)).ok();
let mut rules = BTreeMap::new();
rules.insert("test.numeric", vec![Rule::Numeric]);
let result = validate(&rules, params);
assert!(result.is_ok());
assert_eq!(result.unwrap().find(&["test", "numeric"]).unwrap(),
&Value::U64(3));
} | rust_cleaned_test_functions.jsonl/74448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29418,
8337,
66279,
368,
341,
262,
1077,
5206,
1273,
284,
5027,
486,
931,
543,
262,
1273,
17870,
445,
19600,
497,
5162,
486,
703,
445,
18,
3263,
983,
51973,
34670,
562,
543,
262,
1077,
5206,
362... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matches_starts_and_ends_with_correctly() {
check(
&WildcardPattern::StartsAndEndsWith {
pattern: "alf*cats".into(),
starts_with: "alf".into(),
ends_with: "cats".into()
},
vec!["alf-loves-cats", "alfcats", "alf+cats"],
vec!["alf_loves_ats", "", "cats", "not-only-alf-loves-cats"]);
} | rust_cleaned_test_functions.jsonl/80619 | {
"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,
38344,
86552,
8378,
90729,
6615,
31550,
398,
368,
341,
286,
1779,
1006,
310,
609,
92988,
15760,
486,
3479,
82,
3036,
3727,
16056,
341,
394,
5383,
25,
330,
3104,
9,
37452,
3263,
18122,
3148,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vertica_epoch_days() {
assert_eq!(
-358,
NaiveDate::from_ymd(1999, 1, 8)
.to_y2k_epoch_duration()
.num_days()
);
assert_eq!(
0,
NaiveDate::from_ymd(2000, 1, 1)
.to_y2k_epoch_duration()
.num_days()
);
assert_eq!(
366,
NaiveDate::from_ymd(2001, 1, 1)
.to_y2k_epoch_duration()
.num_days()
);
} | rust_cleaned_test_functions.jsonl/13418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54000,
3001,
20682,
28353,
368,
341,
286,
2060,
10714,
33673,
310,
481,
18,
20,
23,
345,
310,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7,
16,
24,
24,
24,
11,
220,
16,
11,
220,
23,
340,
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_kms_envelope_roundtrip() {
tink_aead::init();
let a = create_kms_envelope_aead();
let original_plaintext = b"hello world";
let ciphertext = a
.encrypt(original_plaintext, &[])
.expect("failed to encrypt");
let plaintext = a.decrypt(&ciphertext, &[]).expect("failed to decrypt");
assert_eq!(
plaintext,
original_plaintext,
"Decrypt(Encrypt({})) = {}; want {}",
hex::encode(&original_plaintext),
hex::encode(&plaintext),
hex::encode(&original_plaintext)
);
// Can clone the boxed AEAD.
let a2 = a.box_clone();
let plaintext = a2.decrypt(&ciphertext, &[]).expect("failed to decrypt");
assert_eq!(plaintext, original_plaintext,);
} | rust_cleaned_test_functions.jsonl/13384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
1011,
6205,
18853,
29896,
32981,
368,
341,
262,
90584,
4306,
3149,
486,
2327,
543,
262,
1077,
264,
284,
1855,
4698,
1011,
6205,
18853,
4306,
3149,
1428,
262,
1077,
4024,
6317,
1641,
427,
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_peerset_reject_incoming_in_reserved_only() {
let incoming = PeerId::random();
let ii = IncomingIndex(1);
let config = PeersetConfig {
sets: vec![SetConfig {
in_peers: 50,
out_peers: 50,
bootnodes: vec![],
reserved_nodes: Default::default(),
reserved_only: true,
}],
};
let (mut peerset, _) = Peerset::from_config(config);
peerset.incoming(SetId::from(0), incoming, ii);
assert_messages(peerset, vec![Message::Reject(ii)]);
} | rust_cleaned_test_functions.jsonl/50344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36367,
44146,
1288,
583,
1243,
4959,
1243,
74913,
18410,
368,
341,
286,
1077,
19393,
284,
45147,
764,
486,
11463,
543,
286,
1077,
14460,
284,
96143,
1552,
7,
16,
317,
286,
1077,
2193,
284,
5139,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_5() {
assert_eq!(
parse_column_type(&mut Parser::new("decimal(4,2)")),
ColumnType::Decimal(NumericAttr {
maximum: Some(4),
decimal: Some(2),
unsigned: None,
zero_fill: None,
})
);
} | rust_cleaned_test_functions.jsonl/73834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
20,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
1819,
2099,
6984,
21102,
486,
931,
445,
23289,
7,
19,
11,
17,
8,
30154,
310,
9332,
929,
486,
11269,
8204,
12572,
13371,
341,
394,
71... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_size_dom() {
struct TestLayout { }
impl Layout for TestLayout {
fn layout(&self) -> Dom<Self> {
Dom::new(NodeType::Div)
}
}
let mut null_dom =
(0..0)
.map(|_| NodeData { node_type: NodeType::Div, .. Default::default() })
.collect::<Dom<TestLayout>>();
assert!(null_dom.arena.borrow().nodes_len() == 1);
null_dom.push_class("hello"); // should not panic
null_dom.set_id("id-hello"); // should not panic
} | rust_cleaned_test_functions.jsonl/2902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
2368,
35749,
368,
8022,
262,
2036,
3393,
2175,
314,
2553,
262,
11605,
13821,
369,
3393,
2175,
972,
286,
5168,
6789,
2099,
721,
8,
1464,
20751,
61748,
29,
972,
310,
20751,
486,
931,
22078,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_issue39() {
let reads = b"GGCGTGGTGGCTTATGCCTGTAATCCCAGCACTTTGGGAGGTCGAAGTGGGCGG$CCGC\
CCACTTCGACCTCCCAAAGTGCTGGGATTACAGGCATAAGCCACCACGCC$CGAAGTGG\
GCGGATCACTTGAGGTCAGGAGTTGGAGACTAGCCTGGCCAACACGATGAAACCCCGTC\
TCTAATA$TATTAGAGACGGGGTTTCATCGTGTTGGCCAGGCTAGTCTCCAACTCCTGA\
CCTCAAGTGATCCGCCCACTTCG$AGCTCGAAAAATGTTTGCTTATTTTGGTAAAATTA\
TTCATTGACTATGCTCAGAAATCAAGCAAACTGTCCATATTTCATTTTTTG$CAAAAAA\
TGAAATATGGACAGTTTGCTTGATTTCTGAGCATAGTCAATGAATAATTTTACCAAAAT\
AAGCAAACATTTTTCGAGCT$AGCTCGAAAAATGTTTGCTTATTTTGGTAAAATTATTC\
ATTGACTATGCTCAGAAATCAAGCAAACTGTCCATATTTCATTTTTTGAAATTACATAT\
$ATATGTAATTTCAAAAAATGAAATATGGACAGTTTGCTTGATTTCTGAGCATAGTCAA\
TGAATAATTTTACCAAAATAAGCAAACATTTTTCGAGCT$TAAAATTTCCTCTGACAGT\
GTAAAAGAGATCTTCATACAAAAATCAGAATTTATATAGTCTCTTTCCAAAAGACCATA\
AAACCAATCAGTTAATAGTTGAT$ATCAACTATTAACTGATTGGTTTTATGGTCTTTTG\
GAAAGAGACTATATAAATTCTGATTTTTGTATGAAGATCTCTTTTACACTGTCAGAGGA\
AATTTTA$CACCTATCTACCCTGAATCTAAGTGCTAACAGGAAAGGATGCCAGATTGCA\
TGCCTGCTGATAAAGCCACAGTTTGGACTGTCACTCAATCACCATCGTTC$GAACGATG\
GTGATTGAGTGACAGTCCAAACTGTGGCTTTATCAGCAGGCATGCAATCTGGCATCCTT\
TCCTGTTAGCACTTAGATTCAGGGTAGATAGGTG$CATCGTTCCTCCTGTGACTCAGTA\
TAACAAGATTGGGAGAATACTCTACAGTTCCTGATTCCCCCACAG$CTGTGGGGGAATC\
AGGAACTGTAGAGTATTCTCCCAATCTTGTTATACTGAGTCACAGGAGGAACGATG$TG\
TAAATTCTGAGAAAAATTTGCAGGTCTTTCTTCAGGAGCATGTAATCTCTTGCTCTCTT\
TGTTATCTATCTATAGTACTGTAGGTTATCTGGAGTTGCT$AGCAACTCCAGATAACCT\
ACAGTACTATAGATAGATAACAAAGAGAGCAAGAGATTACATGCTCCTGAAGAAAGACC\
TGCAAATTTTTCTCAGAATTTACA$CACTTCTCCTTGTCTTTACAGACTGGTTTTGCAC\
TGGGAAATCCTTTCACCAGTCAGCCCAGTTAGAGATTCTG$CAGAATCTCTAACTGGGC\
TGACTGGTGAAAGGATTTCCCAGTGCAAAACCAGTCTGTAAAGACAAGGAGAAGTG$AA\
TGGAGGTATATAAATTATCTGGCAAAGTGACATATCCTGACACATTCTCCAGGATAGAT\
CAAATGTTAGGTCACAAAGAGAGTCTTAACAAAATT$AATTTTGTTAAGACTCTCTTTG\
TGACCTAACATTTGATCTATCCTGGAGAATGTGTCAGGATATGTCACTTTGCCAGATAA\
TTTATATACCTCCATT$TTAATTTTGTTAAGACTCTCTTTGTGACCTAACATTTGATCT\
ATCCTGGAGAATGTGTCAGGATATGTCACTTTGCCAGATAATTTATATACCTCCATTTT\
$AAAATGGAGGTATATAAATTATCTGGCAAAGTGACATATCCTGACACATTCTCCAGGA\
TAGATCAAATGTTAGGTCACAAAGAGAGTCTTAACAAAATTAA$TTCTTCTTTGACTCA\
TTGGTTGTTCAATAGTATGTTGTTTAATTTCCATATATTTGTAAATGTTTCCGTTTTCC\
TTCTACTATTGAATTTTTGCTTCATC$GATGAAGCAAAAATTCAATAGTAGAAGGAAAA\
CGGAAACATTTACAAATATATGGAAATTAAACAACATACTATTGAACAACCAATGAGTC\
AAAGAAGAA$AGGAAAACGGAAACATTTACAAATATATGGAAATTAAACAACATACTAT\
TGAACAACCAATGAGTCAAAGAAGAAATCAAAAAGAATATTAGAAAAC$GTTTTCTAAT\
ATTCTTTTTGATTTCTTCTTTGACTCATTGGTTGTTCAATAGTATGTTGTTTAATTTCC\
ATATATTTGTAAATGTTTCCGTTTTCCT$TTAGAAAACAAGCTGACAAAAAAATAAAAA\
AACACAACATAGCAAAACTTAGAAATGCAGCAAAGGCAGTACTAAAGAGGGAAATTTAT\
AGCAATAAATGC$GCATTTATTGCTATAAATTTCCCTCTTTAGTACTGCCTTTGCTGCA\
TTTCTAAGTTTTGCTATGTTGTGTTTTTTTATTTTTTTGTCAGCTTGTTTTCTAA$TTT\
ATTGCTATAAATTTCCCTCTTTAGTACTGCCTTTGCTGCATTTCTAAGTTTTGCTATGT\
TGTGTTTTTTTATTTTTTTGTCAGCTTGTTTTCTA$TAGAAAACAAGCTGACAAAAAAA\
TAAAAAAACACAACATAGCAAAACTTAGAAATGCAGCAAAGGCAGTACTAAAGAGGGAA\
ATTTATAGCAATAAA$TCTTTCTTCTTTTTTAAGGTAGGCATTTATTGCTATAAATTTC\
CCTCTTTAGTACTGCCTTTG$CAAAGGCAGTACTAAAGAGGGAAATTTATAGCAATAAA\
TGCCTACCTTAAAAAAGAAGAAAGA$";
let alphabet = dna::n_alphabet();
let sa = suffix_array(reads);
let bwt = bwt(reads, &sa);
let less = less(&bwt, &alphabet);
let occ = Occ::new(&bwt, 3, &alphabet);
let fmindex = FMIndex::new(&bwt, &less, &occ);
let fmdindex = FMDIndex::from(fmindex);
let read = b"GGCGTGGTGGCTTATGCCTGTAATCCCAGCACTTTGGGAGGTCGAAGTGGGCGG";
let read_pos = 0;
for i in 0..read.len() {
println!("i {}", i);
let intervals = fmdindex.smems(read, i);
println!("{:?}", intervals);
let matches = intervals
.iter()
.flat_map(|interval| interval.forward().occ(&sa))
.collect::<Vec<usize>>();
assert_eq!(matches, vec![read_pos]);
}
} | rust_cleaned_test_functions.jsonl/18362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
18,
24,
368,
341,
286,
1077,
15804,
284,
293,
1,
22254,
8798,
51,
22254,
51,
22254,
1162,
51,
828,
22863,
1162,
38,
15204,
828,
53873,
1890,
5049,
1162,
14903,
22254,
38,
1890,
38,
7749,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.