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_le16_high() { test_interpreter_and_jit_asm!( " ldxdw r0, [r1] le16 r0 exit", [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88], (), { |_vm, res: Result| { res.unwrap() == 0x2211 } }, 3 ); }
rust_cleaned_test_functions.jsonl/58948
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 183 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11751, 16, 21, 22680, 368, 341, 262, 1273, 15318, 28637, 8378, 5374, 275, 67529, 33673, 286, 6228, 286, 26129, 9703, 86, 435, 15, 11, 508, 81, 16, 921, 286, 512, 16, 21, 435, 15, 198, 286, 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_reduce_all4() { use ProofKindShorthands::*; use PropShorthands::*; let mut idgen = IdGen::new(); let id1 = idgen.fresh(); let id2 = idgen.fresh(); let mut pf = Proof { prop: ImplS( ImplS(Atom(id1), Atom(id2)), Disj(vec![NegS(Atom(id1)), Atom(id2)]), ), kind: DNegElimS(Proof { prop: NegS(NegS(ImplS( ImplS(Atom(id1), Atom(id2)), Disj(vec![NegS(Atom(id1)), Atom(id2)]), ))), kind: AbsS( Proof { prop: Disj(vec![]), kind: AppS( Proof { prop: NegS(ImplS( ImplS(Atom(id1), Atom(id2)), Disj(vec![NegS(Atom(id1)), Atom(id2)]), )), kind: Var(Idx(0)), }, Proof { prop: ImplS( ImplS(Atom(id1), Atom(id2)), Disj(vec![NegS(Atom(id1)), Atom(id2)]), ), kind: AbsS( Proof { prop: Disj(vec![NegS(Atom(id1)), Atom(id2)]), kind: DisjIntroS( Proof { prop: NegS(Atom(id1)), kind: AbsS( Proof { prop: Disj(vec![]), kind: AppS( Proof { prop: NegS(ImplS( ImplS(Atom(id1), Atom(id2)), Disj(vec![ NegS(Atom(id1)), Atom(id2), ]), )), kind: Var(Idx(2)), }, Proof { prop: ImplS( ImplS(Atom(id1), Atom(id2)), Disj(vec![ NegS(Atom(id1)), Atom(id2), ]), ), kind: AbsS( Proof { prop: Disj(vec![ NegS(Atom(id1)), Atom(id2), ]), kind: DisjIntroS( Proof { prop: Atom(id2), kind: AppS(Proof { prop: ImplS(Atom(id1), Atom(id2)), kind: Var(Idx(2)) }, Proof { prop: Atom(id1), kind: Var(Idx(1)) }, ImplType::Normal) }, 1, 2, ), }, ImplType::Normal, ), }, ImplType::Neg, ), }, ImplType::Neg, ), }, 0, 2, ), }, ImplType::Normal, ), }, ImplType::Neg, ), }, ImplType::Neg, ), }), }; pf.check_type(); pf.reduce_all(); pf.check_type(); let expect_pf = Proof { prop: ImplS( ImplS(Atom(id1), Atom(id2)), Disj(vec![NegS(Atom(id1)), Atom(id2)]), ), kind: AbsS( Proof { prop: Disj(vec![NegS(Atom(id1)), Atom(id2)]), kind: DNegElimS(Proof { prop: NegS(NegS(Disj(vec![NegS(Atom(id1)), Atom(id2)]))), kind: AbsS( Proof { prop: Disj(vec![]), kind: AppS( Proof { prop: NegS(Disj(vec![NegS(Atom(id1)), Atom(id2)])), kind: Var(Idx(0)), }, Proof { prop: Disj(vec![NegS(Atom(id1)), Atom(id2)]), kind: DisjIntroS( Proof { prop: NegS(Atom(id1)), kind: AbsS( Proof { prop: Disj(vec![]), kind: AppS( Proof { prop: NegS(Disj(vec![ NegS(Atom(id1)), Atom(id2), ])), kind: Var(Idx(1)), }, Proof { prop: Disj(vec![ NegS(Atom(id1)), Atom(id2), ]), kind: DisjIntroS( Proof { prop: Atom(id2), kind: AppS( Proof { prop: ImplS( Atom(id1), Atom(id2), ), kind: Var(Idx(2)), }, Proof { prop: Atom(id1), kind: Var(Idx(0)), }, ImplType::Normal, ), }, 1, 2, ), }, ImplType::Neg, ), }, ImplType::Neg, ), }, 0, 2, ), }, ImplType::Neg, ), }, ImplType::Neg, ), }), }, ImplType::Normal, ), }; expect_pf.check_type(); assert_eq!(pf, expect_pf); }
rust_cleaned_test_functions.jsonl/125429
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 9890 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 64596, 5705, 19, 368, 341, 286, 990, 36991, 10629, 2016, 2364, 2844, 56162, 286, 990, 3911, 2016, 2364, 2844, 79304, 286, 1077, 5206, 877, 4370, 284, 5223, 9967, 486, 931, 543, 286, 1077, 877, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_htlc_on_chain_timeout() { do_test_htlc_on_chain_timeout(ConnectStyle::BestBlockFirstSkippingBlocks); do_test_htlc_on_chain_timeout(ConnectStyle::TransactionsFirstSkippingBlocks); do_test_htlc_on_chain_timeout(ConnectStyle::FullBlockViaListen); }
rust_cleaned_test_functions.jsonl/16880
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49086, 17257, 4470, 30583, 20537, 368, 341, 19935, 4452, 49086, 17257, 4470, 30583, 20537, 7, 14611, 2323, 486, 14470, 4713, 5338, 85945, 29804, 317, 19935, 4452, 49086, 17257, 4470, 30583, 20537, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_expr() { test_parse("const x = 1;"); test_parse("const x = ab_c1_23;"); test_parse("const x = _;"); test_parse("const x = _zzz;"); test_parse("const x = (1 + 2) * (3 - 4) / 5;"); test_parse("const x = 1 == 2 || 3 /= 4 && 5 < 6 || 7 <= 8 || 9 > 10 || 1 >= 12 || a => b;"); test_parse(r#"const x = "a" ++ "b";"#); test_parse("const x = 1 <+> 2;"); test_parse("const x = a.b.c;"); test_parse("const f = a.b c.d (e f g);"); test_parse("const f = a.b c.d $ e f $ g;"); test_parse("const r = Rec {};"); test_parse("const r = Rec { a=1 };"); test_parse("const r = Rec { a=1, };"); test_parse("const r = Rec { a=1, b=2 };"); test_parse("const r = Rec { a=1, b=2, };"); test_parse("const r = r { a <- 1 };"); test_parse("const r = r { a <- 1, };"); test_parse("const r = r { a <- 1, b <- 2 };"); test_parse("const r = r { a <- 1, b <- 2, };"); test_parse("const r = { r | a <- 1 };"); // compat. test_parse("const r = { r | a <- 1, };"); test_parse("const r = { r | a <- 1, b <- 2 };"); test_parse("const r = { r | a <- 1, b <- 2, };"); test_parse("const r = case 1 {};"); test_parse("const r = case 1 { 1 => 2; };"); test_parse("const r = case 1 { 1 => 2; Just x => Ok y; };"); test_parse("const r = if 1 { 2 } else { 3 };"); test_parse("const r = [];"); test_parse("const r = [ 1 ];"); test_parse("const r = [ 1, ];"); test_parse("const r = [ 1, 2 ];"); test_parse("const r = [ 1, 2, ];"); test_parse("const r = [1] ++ [2];"); test_parse("const r = [1] -- [2];"); test_parse("const r = [ 1 | 2 ];"); test_parse("const r = [ 1 | 2, ];"); test_parse("const r = [ 1 | 2, 3 ];"); test_parse("const r = [ 1 | 2, 3, ];"); test_parse("const r = [ f a | a <- s, a < threshold ];"); test_parse("const r = [ f a | a : T, a < threshold ];"); test_parse("const r = [ f a | a in s & a < threshold ];"); // deprecated. test_parse("const r = [ f a | a : T & a < threshold ];"); // deprecated. // empty set or empty map. test_parse("const x = {};"); test_parse("const x = __set {};"); test_parse("const x = __set { 1 };"); test_parse("const x = __set { 1, };"); test_parse("const x = __set { 1, 2 };"); test_parse("const x = __set { 1, 2, };"); test_parse("const x = __set { 1, 2, 3 };"); test_parse("const x = __set { 1, 2, 3, };"); test_parse("const x = __map {};"); test_parse("const x = __map { |-> };"); test_parse("const x = __map { 1 |-> 2 };"); test_parse("const x = __map { 1 |-> 2, };"); test_parse("const x = __map { 1 |-> 2, 3 |-> 4 };"); test_parse("const x = __map { 1 |-> 2, 3 |-> 4, };"); test_parse("const x = __map { 1 |-> 2, 3 |-> 4, 5 |-> 6 };"); test_parse("const x = __map { 1 |-> 2, 3 |-> 4, 5 |-> 6, };"); test_parse("const x = let a = 1 in y;"); test_parse("const x = let a = 1, in y;"); test_parse("const x = let a = 1, b = 2 in y;"); test_parse("const x = let a = 1, b = 2, in y;"); test_parse("const x = let a = 1, b = 2, c = 3 in y;"); test_parse("const x = let a = 1, b = 2, c = 3, in y;"); test_parse("const x = let a : Int = 1 in y;"); test_parse("const x = {| a |};"); test_parse("const x = |[ a ]|;"); test_parse("const x = fn:t -> e;"); test_parse("const x = fn x :t -> e;"); test_parse("const x = fn x (y:Y) (z 1: Z 2) :t -> e;"); test_parse("const x : fn x (y:Y) (z 1: Z 2) :t = fn x (y:Y) (z 1: Z 2) :t -> e;"); test_parse("const x = a $ b;"); test_parse("const x = a ;>> b;"); test_parse("const x = a ;>>= b;"); // tuple? }
rust_cleaned_test_functions.jsonl/91400
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1464 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21915, 741, 515, 18185, 21039, 445, 1024, 856, 284, 220, 16, 34649, 18185, 21039, 445, 1024, 856, 284, 668, 666, 16, 62, 17, 18, 34649, 18185, 21039, 445, 1024, 856, 284, 716, 34649, 18185, 2103...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tx_rate_limiter_handling() { let mut event_manager = EventManager::new().unwrap(); let mut net = Net::default_net(TestMutators::default()); let mem_clone = net.mem.clone(); let (rxq, txq) = Net::virtqueues(&mem_clone); net.assign_queues(rxq.create_queue(), txq.create_queue()); net.tx_rate_limiter = RateLimiter::new(0, None, 0, 0, None, 0).unwrap(); let rate_limiter_event = EpollEvent::new(EventSet::IN, net.tx_rate_limiter.as_raw_fd() as u64); net.process(&rate_limiter_event, &mut event_manager); check_metric_after_block!( &METRICS.net.event_fails, 1, net.process(&rate_limiter_event, &mut event_manager) ); }
rust_cleaned_test_functions.jsonl/63430
{ "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, 17805, 9246, 907, 17700, 75642, 368, 341, 286, 1077, 5206, 1538, 12144, 284, 3665, 2043, 486, 931, 1005, 15454, 543, 286, 1077, 5206, 4179, 284, 9374, 486, 2258, 19722, 31159, 51440, 2973, 486, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_enforce_pass_sessions() { let mut envelope = envelope![Session, Session, Session]; let mut mock = MockLimiter::default().deny(DataCategory::Error); let (_, limits) = EnvelopeLimiter::new(|s, q| mock.check(s, q)) .enforce(&mut envelope, &scoping()) .unwrap(); assert!(!limits.is_limited()); assert_eq!(envelope.len(), 3); mock.assert_call(DataCategory::Error, None); mock.assert_call(DataCategory::Attachment, None); mock.assert_call(DataCategory::Session, Some(3)); }
rust_cleaned_test_functions.jsonl/101167
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 263 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6205, 8833, 15464, 71385, 368, 341, 286, 1077, 5206, 34398, 284, 34398, 20703, 5283, 11, 9164, 11, 9164, 4821, 286, 1077, 5206, 7860, 284, 14563, 43, 17700, 486, 2258, 1005, 89963, 18959, 6746, 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_case_38() { let key = "387d7247fa5055489bbd4b7d4de256de723566c1c2d3ecee8c10e7d98233dbef"; let nonce = "90494951ec91a843f6701f8216a7326b"; let expected_output = "8c4bc60a1e05004ec93aef4ae162aeff43d679ea1ba048739c700d6a168bc6cc"; hchacha_test_runner(key, nonce, expected_output); }
rust_cleaned_test_functions.jsonl/44700
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 223 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19096, 62, 18, 23, 368, 341, 310, 1077, 1376, 284, 330, 18, 23, 22, 67, 22, 17, 19, 22, 3632, 20, 15, 20, 20, 19, 23, 24, 6066, 67, 19, 65, 22, 67, 19, 450, 17, 20, 21, 450, 22, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tera_templates() { let client = Client::debug(rocket()).unwrap(); let mut map = HashMap::new(); map.insert("title", "_test_"); map.insert("content", "<script />"); let template = Template::show(client.rocket(), "tera/txt_test", &map); assert_eq!(template, Some(UNESCAPED_EXPECTED.into())); let template = Template::show(client.rocket(), "tera/html_test", &map); assert_eq!(template, Some(ESCAPED_EXPECTED.into())); }
rust_cleaned_test_functions.jsonl/84750
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 232 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 50037, 49526, 368, 341, 286, 1077, 2943, 284, 8423, 486, 8349, 7, 46790, 6011, 15454, 543, 286, 1077, 5206, 2415, 284, 10528, 486, 931, 543, 286, 2415, 7030, 445, 2102, 497, 9000, 1944, 62, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format_julia_version() { let input = "julia version 1.4.0"; assert_eq!(format_julia_version(input), Some("v1.4.0".to_string())); }
rust_cleaned_test_functions.jsonl/6398
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 84 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 5374, 69745, 9438, 368, 341, 286, 1077, 1946, 284, 330, 73, 69745, 2319, 220, 16, 13, 19, 13, 15, 876, 286, 2060, 10714, 10297, 2243, 5374, 69745, 9438, 5384, 701, 4329, 445, 85, 16, 13,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_enum() { #[derive(Serialize)] enum E { Unit, Newtype(u32), Array(Vec<u32>), Tuple(u32, u32), Struct { a: u32}, } let lua = Lua::new(); lua.context(|lua| { let u = E::Unit; let value = to_value(lua, &u).unwrap(); lua.globals().set("value", value).unwrap(); lua.load(r#" assert(value == "Unit") "#).exec().unwrap(); let n = E::Newtype(1); let value = to_value(lua, &n).unwrap(); lua.globals().set("value", value).unwrap(); lua.load(r#" assert(value["Newtype"] == 1) "#).exec().unwrap(); let t = E::Array(vec![10, 20, 30]); let value = to_value(lua, &t).unwrap(); lua.globals().set("value", value).unwrap(); lua.load(r#" assert(value["Array"][1] == 10) assert(value["Array"][2] == 20) assert(value["Array"][3] == 30) "#).exec().unwrap(); let t = E::Tuple(1, 2); let value = to_value(lua, &t).unwrap(); lua.globals().set("value", value).unwrap(); lua.load(r#" assert(value["Tuple"][1] == 1) assert(value["Tuple"][2] == 2) "#).exec().unwrap(); let s = E::Struct { a: 1 }; let value = to_value(lua, &s).unwrap(); lua.globals().set("value", value).unwrap(); lua.load(r#" assert(value["Struct"]["a"] == 1) "#).exec() }).unwrap(); }
rust_cleaned_test_functions.jsonl/4215
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1000 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31054, 368, 341, 286, 11506, 27098, 3759, 9050, 5563, 286, 7618, 468, 341, 310, 7954, 345, 310, 1532, 1313, 8154, 18, 17, 1326, 310, 2910, 49923, 34837, 18, 17, 29, 1326, 310, 24622, 8154, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_commit() { let ctx = CryptoContext::new().unwrap(); let mut seed = [0; 64]; let rng = ctx.rng(); { let mut rng = rng.lock().unwrap(); rng.fill_bytes(&mut seed); } let commit_ctx = PedersenCtx::new(&seed); let x = ctx.random_scalar(); let r = ctx.random_scalar(); let x_prime = ctx.random_scalar(); let r_prime = ctx.random_scalar(); let commitment = commit_ctx.commit(&x, &r); assert!(commitment.validate(&commit_ctx, &x, &r)); assert_eq!(commitment.validate(&commit_ctx, &x_prime, &r_prime), false); }
rust_cleaned_test_functions.jsonl/65061
{ "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, 36346, 368, 341, 286, 1077, 5635, 284, 32886, 1972, 486, 931, 1005, 15454, 543, 286, 1077, 5206, 10320, 284, 508, 15, 26, 220, 21, 19, 935, 286, 1077, 28422, 284, 5635, 1746, 968, 543, 286, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_push_on_full() { let mut vec = LocalVec::<_, 1>::new(); vec.push(0); assert!(vec.is_full()); // this one should panic vec.push(0); }
rust_cleaned_test_functions.jsonl/126339
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 108 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 4470, 16372, 368, 341, 286, 1077, 5206, 7486, 284, 8774, 10050, 27638, 6878, 220, 16, 6831, 931, 543, 286, 7486, 2552, 7, 15, 626, 286, 2060, 10297, 4083, 2079, 16372, 1423, 286, 442, 419...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_extremes() { let mut p = BitVec::default(); p.set(std::u8::MAX); p.set(0); assert!(p.is_set(std::u8::MAX)); assert!(p.is_set(0)); for i in 1..std::u8::MAX { assert_eq!(false, p.is_set(i)); } }
rust_cleaned_test_functions.jsonl/123550
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 174 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9927, 1826, 288, 368, 341, 286, 1077, 5206, 281, 284, 6495, 10050, 486, 2258, 543, 286, 281, 980, 5194, 486, 84, 23, 486, 10586, 317, 286, 281, 980, 7, 15, 317, 286, 2060, 10297, 79, 2079, 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_wrong_scheme() { let value = HeaderValue::from_static("THOUSHALLNOTPASS please?"); let scheme = Basic::parse(&value); assert!(scheme.is_err()); }
rust_cleaned_test_functions.jsonl/27911
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 87 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75198, 53293, 368, 341, 286, 1077, 897, 284, 12104, 1130, 486, 1499, 25360, 445, 3617, 46, 19518, 3919, 14065, 49792, 4486, 46091, 286, 1077, 12859, 284, 14625, 486, 6400, 2099, 957, 626, 286, 206...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_totp_std() { let totp_url = "otpauth://totp/Example:someone@somewhere.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"; let otpauth = OTPAuthUrl::parse(totp_url).unwrap(); assert_that(&otpauth.algorithm).is_equal_to(OTPAlgorithm::SHA1); assert_that(&otpauth.digits).is_equal_to(6); assert_that(&otpauth.issuer).is_equal_to(Some("Example".to_string())); assert_that(&otpauth.account_name).is_equal_to("someone@somewhere.com".to_string()); assert_that(&otpauth.generate(1_556_733_311)).is_equal_to(("184557".to_string(), 1_556_733_330)); assert_that(&otpauth.generate(1_556_733_406)).is_equal_to(("757120".to_string(), 1_556_733_420)); assert_that(&otpauth.to_url()) .is_equal_to("otpauth://totp/Example:someone%40somewhere.com?secret=JBSWY3DPEHPK3PXP&issuer=Example".to_string()); }
rust_cleaned_test_functions.jsonl/125406
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 356 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36138, 79, 15656, 368, 341, 220, 1077, 311, 790, 2903, 284, 330, 48708, 3242, 1110, 27779, 79, 14, 13314, 14495, 635, 603, 31, 56739, 60652, 905, 30, 20474, 28, 41, 7347, 54, 56, 18, 35, 1740,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_asset_lifecycle() { let dir = create_dir_and_file("fake.png"); let asset_server = setup(dir.path()); asset_server.add_loader(FakePngLoader); let assets = asset_server.register_asset_type::<PngAsset>(); #[derive(SystemLabel, Clone, Hash, Debug, PartialEq, Eq)] struct FreeUnusedAssets; let mut app = App::new(); app.insert_resource(assets); app.insert_resource(asset_server); app.add_system(free_unused_assets_system.label(FreeUnusedAssets)); app.add_system(update_asset_storage_system::<PngAsset>.after(FreeUnusedAssets)); fn load_asset(path: AssetPath, world: &World) -> HandleUntyped { let asset_server = world.get_resource::<AssetServer>().unwrap(); let id = futures_lite::future::block_on(asset_server.load_async(path.clone(), true)) .unwrap(); asset_server.get_handle_untyped(id) } fn get_asset(id: impl Into<HandleId>, world: &World) -> Option<&PngAsset> { world .get_resource::<Assets<PngAsset>>() .unwrap() .get(id.into()) } fn get_load_state(id: impl Into<HandleId>, world: &World) -> LoadState { world .get_resource::<AssetServer>() .unwrap() .get_load_state(id.into()) } // Start of the actual lifecycle test let path: AssetPath = "fake.png".into(); assert_eq!( LoadState::NotLoaded, get_load_state(path.get_id(), &app.world) ); // load the asset let handle = load_asset(path.clone(), &app.world); let weak_handle = handle.clone_weak(); // asset is loading assert_eq!(LoadState::Loading, get_load_state(&handle, &app.world)); app.update(); // asset should exist and be loaded at this point assert_eq!(LoadState::Loaded, get_load_state(&handle, &app.world)); assert!(get_asset(&handle, &app.world).is_some()); drop(handle); app.update(); assert_eq!(LoadState::Loaded, get_load_state(&weak_handle, &app.world)); assert!(get_asset(&weak_handle, &app.world).is_some()); // second call to tick will actually remove the asset. app.update(); assert_eq!( LoadState::Unloaded, get_load_state(&weak_handle, &app.world) ); assert!(get_asset(&weak_handle, &app.world).is_none()); let handle = load_asset(path.clone(), &app.world); assert_eq!(LoadState::Loading, get_load_state(&handle, &app.world)); app.update(); assert_eq!(LoadState::Loaded, get_load_state(&handle, &app.world)); assert!(get_asset(&handle, &app.world).is_some()); }
rust_cleaned_test_functions.jsonl/3154
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1366 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42299, 907, 19517, 368, 341, 286, 1077, 5419, 284, 1855, 4334, 8378, 2458, 445, 30570, 3508, 797, 286, 1077, 9329, 12015, 284, 6505, 14161, 3875, 1423, 286, 9329, 12015, 1364, 22139, 7832, 726, 47...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_command() { parse_tokens( ClassifiedCommandShape, vec![b::bare("ls"), b::sp(), b::pattern("*.txt")], |tokens| { let bare = tokens[0].expect_bare(); let pat = tokens[2].expect_pattern(); let mut map = IndexMap::new(); map.insert("full".to_string(), NamedValue::AbsentSwitch); ClassifiedCommand::Internal(InternalCommand::new( "ls".to_string(), Tag { span: bare, anchor: None, }, hir::Call { head: Box::new(hir::RawExpression::Command(bare).into_expr(bare)), positional: Some(vec![hir::Expression::pattern("*.txt", pat)]), named: Some(NamedArguments { named: map }), span: bare.until(pat), }, )) }, ); }
rust_cleaned_test_functions.jsonl/77831
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 525 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 10811, 368, 341, 262, 4715, 28838, 1006, 286, 79436, 4062, 12301, 345, 286, 7486, 20703, 65, 486, 54102, 445, 4730, 3975, 293, 486, 2154, 1507, 293, 486, 14339, 445, 19922, 8586, 899, 1259,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_farmer_fixed_rate_reward() { let r = FarmerFixedRateReward::new(); assert_eq!(50, r.loyal_staker_bonus_time().unwrap()); assert_eq!(210, r.end_schedule_ts().unwrap()); assert_eq!(true, r.is_time_to_graduate(210).unwrap()); assert_eq!(210, r.reward_upper_bound(250).unwrap()); assert_eq!(55, r.time_from_staking_to_update().unwrap()); // last update - staking = 55 // ub - staking = 110 assert_eq!((50 + 70 + 11 * 35) * 10, r.voided_reward(10).unwrap()); // last update - staking = 55 // now - staking = 85 assert_eq!( (50 + 70 + 110) * 10, r.newly_accrued_reward(185, 10).unwrap() ); }
rust_cleaned_test_functions.jsonl/51349
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 386 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 67513, 1174, 37839, 9246, 38260, 368, 341, 286, 1077, 435, 284, 67464, 13520, 11564, 59622, 486, 931, 1428, 286, 2060, 10714, 10297, 20, 15, 11, 435, 13, 1989, 278, 1261, 4407, 59541, 3009, 1005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_product_list_builder() { let product_list = build_product_list(); assert_eq!(product_list.products.len(), 2); // Test product 1 assert_eq!(product_list.products[0].product_id(), "688955434684"); assert_eq!( *product_list.products[0].product_namespace(), ProductNamespace::GS1 ); assert_eq!(product_list.products[0].owner(), "Target"); assert_eq!( product_list.products[0].properties()[0].name(), "description" ); assert_eq!( *product_list.products[0].properties()[0].data_type(), DataType::String ); assert_eq!( product_list.products[0].properties()[0].string_value(), "This is a product description" ); assert_eq!(product_list.products[0].properties()[1].name(), "price"); assert_eq!( *product_list.products[0].properties()[1].data_type(), DataType::Number ); assert_eq!(*product_list.products[0].properties()[1].number_value(), 3); // Test product 2 assert_eq!(product_list.products[1].product_id(), "688955434685"); assert_eq!( *product_list.products[1].product_namespace(), ProductNamespace::GS1 ); assert_eq!(product_list.products[1].owner(), "Cargill"); assert_eq!( product_list.products[1].properties()[0].name(), "description" ); assert_eq!( *product_list.products[1].properties()[0].data_type(), DataType::String ); assert_eq!( product_list.products[1].properties()[0].string_value(), "This is a product description" ); assert_eq!(product_list.products[1].properties()[1].name(), "price"); assert_eq!( *product_list.products[1].properties()[1].data_type(), DataType::Number ); assert_eq!(*product_list.products[1].properties()[1].number_value(), 3); }
rust_cleaned_test_functions.jsonl/84858
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1008 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9840, 2019, 28532, 368, 341, 286, 1077, 1985, 2019, 284, 1936, 9840, 2019, 1428, 286, 2060, 10714, 10297, 3031, 2019, 36162, 19406, 1507, 220, 17, 626, 286, 442, 3393, 1985, 220, 16, 198, 286, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_assemble() { let mut c = Compiler::new().unwrap(); let result = c.assemble(VOID_MAIN_ASSEMBLY, None).unwrap(); assert!(result.len() > 20); assert!(result.as_binary().first() == Some(&0x0723_0203)); let function_end_word: u32 = (1 << 16) | 56; assert!(result.as_binary().last() == Some(&function_end_word)); }
rust_cleaned_test_functions.jsonl/41046
{ "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, 11898, 15790, 368, 341, 286, 1077, 5206, 272, 284, 45631, 486, 931, 1005, 15454, 543, 286, 1077, 1102, 284, 272, 5357, 15790, 7, 24053, 32276, 28028, 77373, 8932, 11, 2240, 568, 15454, 543, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_multiple_patch() { let dir = TempDir::new("exonum_rocksdb_multiple_patch").unwrap(); let path = dir.path(); let db = rocksdb_database(path); fn list_index<View: AsRef<dyn Snapshot>>(view: View) -> ListIndex<View, u64> { ListIndex::new("list_index", view) } // create first patch let patch1 = { let mut fork = db.fork(); { let mut index = list_index(&mut fork); index.push(1); index.push(3); index.push(4); } fork.into_patch() }; // create second patch let patch2 = { let mut fork = db.fork(); { let mut index = list_index(&mut fork); index.push(2); } fork.into_patch() }; db.merge(patch1).unwrap(); db.merge(patch2).unwrap(); let snapshot = db.snapshot(); let index = list_index(snapshot); let iter = index.iter(); assert_eq!(index.len() as usize, iter.count()); }
rust_cleaned_test_functions.jsonl/12970
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 608 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45233, 39643, 368, 341, 286, 1077, 5419, 284, 19944, 6184, 486, 931, 445, 327, 263, 372, 26608, 14553, 1999, 45233, 39643, 1827, 15454, 543, 286, 1077, 1815, 284, 5419, 3875, 543, 286, 1077, 2927,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_try_panic_message_any() { match thread::spawn(move|| { panic!(box 413u16 as Box<Any + Send>); }).join() { Err(e) => { type T = Box<Any + Send>; assert!(e.is::<T>()); let any = e.downcast::<T>().unwrap(); assert!(any.is::<u16>()); assert_eq!(*any.downcast::<u16>().unwrap(), 413); } Ok(()) => panic!() } }
rust_cleaned_test_functions.jsonl/18928
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 291 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53283, 620, 31270, 6462, 37248, 368, 341, 286, 2432, 4516, 486, 46087, 34081, 8484, 341, 310, 21975, 10297, 2011, 220, 19, 16, 18, 84, 16, 21, 438, 8261, 86712, 488, 11000, 42013, 286, 8533, 598...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_has_enough_stake_no() { new_test_ext().execute_with(|| { let hotkey_id = 4334; let coldkey_id = 87989; let intial_amount = 0; assert_ok!(Subtensor::set_registeration_key(<<Test as Config>::Origin>::root(), 0)); let neuron = register_ok_neuron(0,0,hotkey_id, coldkey_id); Subtensor::add_stake_to_neuron_hotkey_account(neuron.uid, intial_amount); assert_eq!(Subtensor::has_enough_stake(&neuron, 5000), false); }); }
rust_cleaned_test_functions.jsonl/17178
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 196 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21778, 6205, 1384, 1261, 726, 6536, 368, 341, 8638, 4452, 9927, 1005, 10257, 6615, 79453, 341, 197, 10217, 4017, 792, 842, 284, 220, 19, 18, 18, 19, 280, 197, 10217, 9255, 792, 842, 284, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_load_font_packages_registry_invalid_font_packages() -> Result<(), Error> { let file_name = "font_packages.json"; let (_temp_dir, file_path) = create_json_file( file_name, vec![ "fuchsia-pkg://fuchsia.com/font1", "fuchsia-pkg://fuchsia.com/font2#meta/font2.cmx", "fuchsia-pkg://fuchsia.com/", ], )?; let builder = FontPackageManagerBuilder::new(); let result = builder.add_registry_file(&file_path); assert_matches!( result, Err((_, errs)) => assert_eq!(errs.len(), 2) ); Ok(()) }
rust_cleaned_test_functions.jsonl/15579
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 366 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12411, 17451, 41874, 50650, 31433, 17451, 41874, 368, 1464, 5714, 68843, 4600, 29, 341, 286, 1077, 1034, 1269, 284, 330, 4026, 41874, 4323, 876, 286, 1077, 5453, 3888, 4334, 11, 1034, 2638, 8, 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_verify_cut_through_plain() -> Result<(), Error> { global::set_local_chain_type(global::ChainTypes::UserTesting); let keychain = ExtKeychain::from_random_seed(false)?; let key_id1 = ExtKeychain::derive_key_id(1, 1, 0, 0, 0); let key_id2 = ExtKeychain::derive_key_id(1, 2, 0, 0, 0); let key_id3 = ExtKeychain::derive_key_id(1, 3, 0, 0, 0); let builder = proof::ProofBuilder::new(&keychain); let mut tx = build::transaction( KernelFeatures::Plain { fee: 0 }, &[ build::input(10, key_id1.clone()), build::input(10, key_id2.clone()), build::output(10, key_id1.clone()), build::output(6, key_id2.clone()), build::output(4, key_id3.clone()), ], &keychain, &builder, ) .expect("valid tx"); let verifier_cache = Arc::new(RwLock::new(LruVerifierCache::new())); // Transaction should fail validation due to cut-through. assert_eq!( tx.validate(Weighting::AsTransaction, verifier_cache.clone()), Err(Error::CutThrough), ); // Transaction should fail lightweight "read" validation due to cut-through. assert_eq!(tx.validate_read(), Err(Error::CutThrough)); // Apply cut-through to eliminate the offending input and output. let mut inputs: Vec<_> = tx.inputs().into(); let mut outputs = tx.outputs().to_vec(); let (inputs, outputs, _, _) = transaction::cut_through(&mut inputs[..], &mut outputs[..])?; tx.body = tx .body .replace_inputs(inputs.into()) .replace_outputs(outputs); // Transaction validates successfully after applying cut-through. tx.validate(Weighting::AsTransaction, verifier_cache.clone())?; // Transaction validates via lightweight "read" validation as well. tx.validate_read()?; Ok(()) }
rust_cleaned_test_functions.jsonl/51630
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 627 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35638, 41317, 87399, 41015, 368, 1464, 5714, 68843, 4600, 29, 341, 18842, 486, 746, 13564, 30583, 1819, 31951, 486, 18837, 4173, 486, 1474, 16451, 626, 10217, 1376, 8819, 284, 9447, 1592, 8819, 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...
5
#[test] fn test_invalid_election_timeout_config_produces_expected_error() { let res = Config::build("cluster0".into()).election_timeout_min(1000).election_timeout_max(700).validate(); assert!(res.is_err()); let err = res.unwrap_err(); assert_eq!(err, ConfigError::InvalidElectionTimeoutMinMax); }
rust_cleaned_test_functions.jsonl/129748
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 137 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31433, 2204, 1170, 20537, 5332, 2540, 1054, 1603, 32190, 4096, 368, 341, 286, 1077, 592, 284, 5532, 486, 5834, 445, 18855, 15, 3263, 18122, 6011, 61472, 20537, 7260, 7, 16, 15, 15, 15, 568, 6147...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cmp_memindex_reg() { let p = MachineMode::Ptr; assert_emit!(0x48, 0x39, 0x4c, 0xd8, 1; emit_cmp_memindex_reg(p, RAX, RBX, 8, 1, RCX)); assert_emit!(0x48, 0x39, 0x0c, 0xd8; emit_cmp_memindex_reg(p, RAX, RBX, 8, 0, RCX)); assert_emit!(0x48, 0x39, 0x8c, 0xd8, 0, 1, 0, 0; emit_cmp_memindex_reg(p, RAX, RBX, 8, 256, RCX)); assert_emit!(0x49, 0x39, 0x24, 0x28; emit_cmp_memindex_reg(p, R8, RBP, 1, 0, RSP)); assert_emit!(0x4a, 0x39, 0x3c, 0x0e; emit_cmp_memindex_reg(p, RSI, R9, 1, 0, RDI)); assert_emit!(0x4c, 0x39, 0x3c, 0x34; emit_cmp_memindex_reg(p, RSP, RSI, 1, 0, R15)); assert_emit!(0x48, 0x39, 0x04, 0x2c; emit_cmp_memindex_reg(p, RSP, RBP, 1, 0, RAX)); }
rust_cleaned_test_functions.jsonl/85469
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 545 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35193, 12976, 1252, 4920, 368, 341, 286, 1077, 281, 284, 12960, 3636, 486, 5348, 401, 1789, 286, 2060, 69082, 10297, 15, 87, 19, 23, 11, 220, 15, 87, 18, 24, 11, 220, 15, 87, 19, 66, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pathops_concat_relative() { let actual = Path::new("../foo") .concat("bar") .expect("Could not create relative path with concat"); let expected = PathBuf::from(r"../foo/bar"); assert_eq!(actual, expected); let actual = Path::new("../foo") .concat("..") .expect("Could not create relative path with concat"); let expected = PathBuf::from(r".."); assert_eq!(actual, expected); let actual = Path::new("../foo") .concat("../..") .expect("Could not create relative path with concat"); let expected = PathBuf::from(r"../.."); assert_eq!(actual, expected); let actual = Path::new("../foo/../bar") .concat("../..") .expect("Could not create relative path with concat"); let expected = PathBuf::from(r"../.."); assert_eq!(actual, expected); let actual = Path::new("../foo/../bar/..") .concat("../..") .expect("Could not create relative path with concat"); let expected = PathBuf::from(r"../../.."); assert_eq!(actual, expected); let actual = PathBuf::from("../foo/..") .concat("../../baz") .expect("Could not create relative path with concat"); let expected = PathBuf::from(r"../../../baz"); assert_eq!(actual, expected); }
rust_cleaned_test_functions.jsonl/14052
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 775 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2638, 3721, 57478, 29286, 368, 341, 310, 1077, 5042, 284, 7933, 486, 931, 17409, 7975, 1138, 394, 659, 20164, 445, 2257, 1138, 394, 659, 17119, 445, 12895, 537, 1855, 8674, 1815, 448, 33720, 797, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_struct_material_db_entry_std140() { assert_eq!(std::mem::size_of::<MaterialDbEntryStd140>(), 80); assert_eq!(std::mem::size_of::<[f32; 4]>(), 16); assert_eq!(std::mem::align_of::<[f32; 4]>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, base_color_factor), 0 ); assert_eq!(std::mem::size_of::<[f32; 3]>(), 12); assert_eq!(std::mem::align_of::<[f32; 3]>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, emissive_factor), 16 ); assert_eq!(std::mem::size_of::<f32>(), 4); assert_eq!(std::mem::align_of::<f32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, metallic_factor), 28 ); assert_eq!(std::mem::size_of::<f32>(), 4); assert_eq!(std::mem::align_of::<f32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, roughness_factor), 32 ); assert_eq!(std::mem::size_of::<f32>(), 4); assert_eq!(std::mem::align_of::<f32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, normal_texture_scale), 36 ); assert_eq!(std::mem::size_of::<f32>(), 4); assert_eq!(std::mem::align_of::<f32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, alpha_threshold), 40 ); assert_eq!(std::mem::size_of::<u32>(), 4); assert_eq!(std::mem::align_of::<u32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, enable_alpha_blend), 44 ); assert_eq!(std::mem::size_of::<u32>(), 4); assert_eq!(std::mem::align_of::<u32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, enable_alpha_clip), 48 ); assert_eq!(std::mem::size_of::<i32>(), 4); assert_eq!(std::mem::align_of::<i32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, color_texture), 52 ); assert_eq!(std::mem::size_of::<u32>(), 4); assert_eq!(std::mem::align_of::<u32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, base_color_texture_has_alpha_channel), 56 ); assert_eq!(std::mem::size_of::<i32>(), 4); assert_eq!(std::mem::align_of::<i32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, metallic_roughness_texture), 60 ); assert_eq!(std::mem::size_of::<i32>(), 4); assert_eq!(std::mem::align_of::<i32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, normal_texture), 64 ); assert_eq!(std::mem::size_of::<i32>(), 4); assert_eq!(std::mem::align_of::<i32>(), 4); assert_eq!( memoffset::offset_of!(MaterialDbEntryStd140, emissive_texture), 68 ); assert_eq!(std::mem::size_of::<[u8; 8]>(), 8); assert_eq!(std::mem::align_of::<[u8; 8]>(), 1); assert_eq!(memoffset::offset_of!(MaterialDbEntryStd140, _padding0), 72); }
rust_cleaned_test_functions.jsonl/50159
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1789 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15126, 33884, 8685, 9078, 15656, 16, 19, 15, 368, 341, 286, 2060, 10714, 10297, 1834, 486, 10536, 486, 2141, 3575, 27638, 13415, 7994, 5874, 22748, 16, 19, 15, 39019, 220, 23, 15, 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
#[test] fn test_parse_expectations_multiple() { let mut expected: Vec<Expectation> = Vec::new(); expected.push(Expectation::Regex("foo.*".to_owned())); expected.push(Expectation::Latency(10)); assert_expectations( indoc!( " mysql: expectation: - type: REGEX regex: \"foo.*\" - type: LATENCY threshold: 10 " ), expected, ); }
rust_cleaned_test_functions.jsonl/74665
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 238 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 68918, 804, 45233, 368, 341, 286, 1077, 5206, 3601, 25, 11312, 27, 17536, 367, 29, 284, 11312, 486, 931, 543, 286, 3601, 2552, 7, 17536, 367, 486, 32464, 445, 7975, 4908, 3263, 983, 51973...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_eth_transfer_insufficient_balance() { let (mut runner, mut source_account, dest_address) = initialize_transfer(); let source_address = test_utils::address_from_secret_key(&source_account.secret_key); // validate pre-state test_utils::validate_address_balance_and_nonce( &runner, source_address, INITIAL_BALANCE, INITIAL_NONCE.into(), ); test_utils::validate_address_balance_and_nonce(&runner, dest_address, Wei::zero(), 0.into()); // attempt transfer let result = runner .submit_with_signer(&mut source_account, |nonce| { // try to transfer more than we have test_utils::transfer(dest_address, INITIAL_BALANCE + INITIAL_BALANCE, nonce) }) .unwrap(); assert_eq!(result.status, TransactionStatus::OutOfFund); // validate post-state test_utils::validate_address_balance_and_nonce( &runner, source_address, INITIAL_BALANCE, // the nonce is still incremented even though the transfer failed (INITIAL_NONCE + 1).into(), ); test_utils::validate_address_balance_and_nonce(&runner, dest_address, Wei::zero(), 0.into()); }
rust_cleaned_test_functions.jsonl/131045
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 495 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 57757, 35403, 34386, 26683, 29396, 368, 341, 262, 1077, 320, 6984, 22259, 11, 5206, 2530, 13500, 11, 3201, 6744, 8, 284, 9468, 35403, 543, 262, 1077, 2530, 6744, 284, 1273, 17309, 486, 4995, 5673,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_retention_policy_empty() { let actual = RetentionPolicy::from_str("").unwrap(); let expected = RetentionPolicy { yearly: None, monthly: None, weekly: None, daily: None, hourly: None, }; assert_eq!(actual, expected); }
rust_cleaned_test_functions.jsonl/48503
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 171 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21695, 2939, 22773, 15124, 368, 341, 286, 1077, 5042, 284, 10392, 78165, 486, 1499, 2895, 80821, 15454, 543, 286, 1077, 3601, 284, 10392, 78165, 341, 310, 44270, 25, 2240, 345, 310, 15088, 25, 224...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_block_finalize() -> anyhow::Result<()> { let root = Box::new(Echo::<Msg>::new(false)); let mut console = test_console(root); let msg = Msg(vec![vec!["state"].try_into()?; 1]); let state = crate::state![&msg]; console.test_output_mut()?.should_render = false; console.emit(vec![vec!["line 1"].try_into()?]); console.emit(vec![vec!["line 2"].try_into()?]); console.render_with_mode(&state, DrawMode::Final)?; let frame = console .test_output_mut()? .frames .pop() .context("No frame was emitted")?; assert!(frame_contains(&frame, "state".as_bytes())); assert!(frame_contains(&frame, "line 1".as_bytes())); assert!(frame_contains(&frame, "line 2".as_bytes())); Ok(()) }
rust_cleaned_test_functions.jsonl/122139
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 407 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7113, 70616, 368, 1464, 88964, 486, 2077, 71698, 341, 286, 1077, 3704, 284, 8261, 486, 931, 10722, 958, 27638, 6611, 6831, 931, 3576, 1106, 286, 1077, 5206, 2339, 284, 1273, 51724, 9206, 626, 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...
8
#[test] fn test_double_custom_legalization() { use crate::cdsl::formats::{FormatRegistry, InstructionFormatBuilder}; use crate::cdsl::instructions::{AllInstructions, InstructionBuilder, InstructionGroupBuilder}; let mut dummy_all = AllInstructions::new(); let mut format = FormatRegistry::new(); format.insert(InstructionFormatBuilder::new("nullary")); let mut inst_group = InstructionGroupBuilder::new("test", "", &mut dummy_all, &format); inst_group.push(InstructionBuilder::new("dummy", "doc")); let inst_group = inst_group.build(); let dummy_inst = inst_group.by_name("dummy"); let mut transform_group = TransformGroupBuilder::new("test", "doc"); transform_group.custom_legalize(&dummy_inst, "custom 1"); transform_group.custom_legalize(&dummy_inst, "custom 2"); }
rust_cleaned_test_functions.jsonl/58459
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 273 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24598, 15875, 82324, 2022, 368, 341, 262, 990, 17717, 486, 4385, 3226, 486, 63482, 22964, 4061, 15603, 11, 29051, 4061, 3297, 2440, 262, 990, 17717, 486, 4385, 3226, 486, 62295, 22964, 2403, 55291, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_common_prefix_nibbles_len() { { let hash1 = b"hello".test_only_hash(); let hash2 = b"HELLO".test_only_hash(); assert_eq!(hash1[0], 0b0011_0011); assert_eq!(hash2[0], 0b1011_1000); assert_eq!(hash1.common_prefix_nibbles_len(hash2), 0); } { let hash1 = b"hello".test_only_hash(); let hash2 = b"world".test_only_hash(); assert_eq!(hash1[0], 0b0011_0011); assert_eq!(hash2[0], 0b0100_0010); assert_eq!(hash1.common_prefix_nibbles_len(hash2), 0); } { let hash1 = b"hello".test_only_hash(); let hash2 = b"100011001000".test_only_hash(); assert_eq!(hash1[0], 0b0011_0011); assert_eq!(hash2[0], 0b0011_0011); assert_eq!(hash1[1], 0b0011_1000); assert_eq!(hash2[1], 0b0010_0010); assert_eq!(hash1.common_prefix_nibbles_len(hash2), 2); } { let hash1 = b"hello".test_only_hash(); let hash2 = b"hello".test_only_hash(); assert_eq!( hash1.common_prefix_nibbles_len(hash2), HashValue::LENGTH * 2 ); } }
rust_cleaned_test_functions.jsonl/85911
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 739 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21107, 13974, 1089, 579, 38763, 6043, 368, 341, 286, 341, 310, 1077, 5175, 16, 284, 293, 1, 14990, 3263, 1944, 18410, 8950, 543, 310, 1077, 5175, 17, 284, 293, 1, 50712, 1593, 3263, 1944, 18410,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_embed_normal() { let mut embed = base_embed(); embed.author.replace(EmbedAuthor { icon_url: None, name: Some("twilight".to_owned()), proxy_icon_url: None, url: None, }); embed.color.replace(0xff_00_00); embed.description.replace("a".repeat(100)); embed.fields.push(EmbedField { inline: true, name: "b".repeat(25), value: "c".repeat(200), }); embed.title.replace("this is a normal title".to_owned()); assert!(super::embed(&embed).is_ok()); }
rust_cleaned_test_functions.jsonl/29941
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 316 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24007, 13973, 368, 341, 286, 1077, 5206, 11579, 284, 2331, 24007, 543, 286, 11579, 16314, 6980, 7, 25486, 7133, 341, 310, 4603, 2903, 25, 2240, 345, 310, 829, 25, 4329, 445, 15560, 34900, 3263, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_toggle() { frp::new_network! { network def toggle_src = source::<()>(); def map_src = source::<()>(); def toggle = toggle_src.toggle(); def _map = map_src.map2(&toggle,|_,value| assert!(*value)); } toggle_src.emit(()); map_src.emit(()); }
rust_cleaned_test_functions.jsonl/98535
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 195 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48860, 368, 341, 286, 1422, 79, 486, 931, 20966, 0, 314, 3922, 198, 310, 707, 14999, 16274, 284, 2530, 27638, 368, 3913, 310, 707, 2415, 16274, 262, 284, 2530, 27638, 368, 3913, 310, 707, 14999,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_flatten_try_folds() { let f = &|acc, x| i32::checked_add(acc*2/3, x); let mr = &|x| (5*x)..(5*x + 5); assert_eq!((0..10).map(mr).flatten().try_fold(7, f), (0..50).try_fold(7, f)); assert_eq!((0..10).map(mr).flatten().try_rfold(7, f), (0..50).try_rfold(7, f)); let mut iter = (0..10).map(mr).flatten(); iter.next(); iter.next_back(); // have front and back iters in progress assert_eq!(iter.try_rfold(7, f), (1..49).try_rfold(7, f)); let mut iter = (0..10).map(|x| (4*x)..(4*x + 4)).flatten(); assert_eq!(iter.try_fold(0, i8::checked_add), None); assert_eq!(iter.next(), Some(17)); assert_eq!(iter.try_rfold(0, i8::checked_add), None); assert_eq!(iter.next_back(), Some(35)); }
rust_cleaned_test_functions.jsonl/54198
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 362 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5081, 14456, 53283, 761, 18431, 368, 341, 262, 1077, 282, 284, 609, 91, 4475, 11, 856, 91, 600, 18, 17, 486, 7549, 2891, 48455, 9, 17, 14, 18, 11, 856, 317, 262, 1077, 17317, 284, 609, 91, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_merge_invalid_account_data() { let stake_address = solana_sdk::pubkey::new_rand(); let merge_from_address = solana_sdk::pubkey::new_rand(); let authorized_address = solana_sdk::pubkey::new_rand(); let stake_lamports = 42; let instruction_accounts = vec![ AccountMeta { pubkey: stake_address, is_signer: false, is_writable: false, }, AccountMeta { pubkey: merge_from_address, is_signer: false, is_writable: false, }, AccountMeta { pubkey: sysvar::clock::id(), is_signer: false, is_writable: false, }, AccountMeta { pubkey: sysvar::stake_history::id(), is_signer: false, is_writable: false, }, AccountMeta { pubkey: authorized_address, is_signer: true, is_writable: false, }, ]; for state in &[ StakeState::Uninitialized, StakeState::RewardsPool, StakeState::Initialized(Meta::auto(&authorized_address)), just_stake(Meta::auto(&authorized_address), stake_lamports), ] { let stake_account = AccountSharedData::new_data_with_space( stake_lamports, state, StakeState::size_of(), &id(), ) .unwrap(); for merge_from_state in &[StakeState::Uninitialized, StakeState::RewardsPool] { let merge_from_account = AccountSharedData::new_data_with_space( stake_lamports, merge_from_state, StakeState::size_of(), &id(), ) .unwrap(); let transaction_accounts = vec![ (stake_address, stake_account.clone()), (merge_from_address, merge_from_account), (authorized_address, AccountSharedData::default()), ( sysvar::clock::id(), account::create_account_shared_data_for_test(&Clock::default()), ), ( sysvar::stake_history::id(), account::create_account_shared_data_for_test(&StakeHistory::default()), ), ]; process_instruction( &serialize(&StakeInstruction::Merge).unwrap(), transaction_accounts, instruction_accounts.clone(), Err(InstructionError::InvalidAccountData), ); } } }
rust_cleaned_test_functions.jsonl/31668
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1675 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20888, 31433, 13500, 1769, 368, 341, 286, 1077, 18279, 6744, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 10880, 5673, 6744, 284, 2048, 3362, 61783, 486, 9585, 792, 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...
3
#[test] fn test_line_rectangle_intersect() { let line = Line2::new(Point2::new(0., -1.), Point2::new(0., 1.)); let rectangle = Rectangle::new(1., 0.2); let transform_1 = transform(1., 0., 0.); let transform_2 = transform(1.1, 0., 0.); let gjk = GJK2::new(); assert!(gjk .intersect(&line, &transform_1, &rectangle, &transform_2) .is_some()); }
rust_cleaned_test_functions.jsonl/9193
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 215 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6528, 61847, 72747, 368, 341, 286, 1077, 1555, 284, 7083, 17, 486, 931, 32737, 17, 486, 931, 7, 15, 2572, 481, 16, 24389, 5126, 17, 486, 931, 7, 15, 2572, 220, 16, 13, 1106, 286, 1077, 22756...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_err_callx_oob_low() { test_interpreter_and_jit_asm!( " mov64 r0, 0x3 callx 0x0 exit", [], (), { |_vm, res: Result| { matches!(res.unwrap_err(), EbpfError::CallOutsideTextSegment(pc, target_pc) if pc == 30 && target_pc == 0 ) } }, 2 ); }
rust_cleaned_test_functions.jsonl/59039
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 287 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9266, 13429, 87, 14179, 674, 23767, 368, 341, 262, 1273, 15318, 28637, 8378, 5374, 275, 67529, 33673, 286, 6228, 286, 1974, 21, 19, 435, 15, 11, 220, 15, 87, 18, 198, 286, 1618, 87, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_is_hash() { use super::is_hash; assert!(is_hash(&*"a".repeat(64)), "alpha allowed"); assert!(is_hash(&*"5".repeat(64)), "digits allowed"); assert!(!is_hash(&*"_".repeat(64)), "other characters disallowed"); assert!(!is_hash(&*"a".repeat(63)), "too short"); assert!(!is_hash(&*"a".repeat(65)), "too long"); }
rust_cleaned_test_functions.jsonl/120546
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 180 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 8950, 368, 341, 286, 990, 2256, 486, 285, 8950, 280, 286, 2060, 10297, 285, 8950, 2099, 64110, 64, 3263, 30624, 7, 21, 19, 5731, 330, 7141, 5420, 797, 286, 2060, 10297, 285, 8950, 2099, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dyn_struct() { struct Named; impl Valuable for Named { fn as_value(&self) -> Value<'_> { Value::Structable(self) } fn visit(&self, visit: &mut dyn Visit) { visit.visit_named_fields(&NamedValues::new(&[NamedField::new("a")], &[Value::U32(1)])); visit.visit_named_fields(&NamedValues::new( &[NamedField::new("b")], &[Value::I32(-1)], )); } } impl Structable for Named { fn definition(&self) -> StructDef<'_> { StructDef::new_dynamic("Named", Fields::Named(&[])) } } struct Unnamed; impl Valuable for Unnamed { fn as_value(&self) -> Value<'_> { Value::Structable(self) } fn visit(&self, visit: &mut dyn Visit) { visit.visit_unnamed_fields(&[Value::U32(1)]); visit.visit_unnamed_fields(&[Value::I32(-1)]); } } impl Structable for Unnamed { fn definition(&self) -> StructDef<'_> { StructDef::new_dynamic("Unnamed", Fields::Unnamed) } } assert_ser_tokens( &Serializable::new(Named), &[ Token::Map { len: None }, Token::Str("a"), Token::U32(1), Token::Str("b"), Token::I32(-1), Token::MapEnd, ], ); assert_ser_tokens( &Serializable::new(Unnamed), &[ Token::Seq { len: None }, Token::U32(1), Token::I32(-1), Token::SeqEnd, ], ); }
rust_cleaned_test_functions.jsonl/44222
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 870 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 69213, 15126, 368, 341, 262, 2036, 40459, 401, 262, 11605, 4104, 13128, 369, 40459, 341, 286, 5168, 438, 3142, 2099, 721, 8, 1464, 5162, 18291, 98377, 341, 310, 5162, 486, 9422, 480, 1193, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format_go_version() { let input = "go version go1.12 darwin/amd64"; assert_eq!(format_go_version(input), Some("v1.12".to_string())); }
rust_cleaned_test_functions.jsonl/27579
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 84 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 25515, 9438, 368, 341, 286, 1077, 1946, 284, 330, 3346, 2319, 728, 16, 13, 16, 17, 15269, 7526, 55417, 67, 21, 19, 876, 286, 2060, 10714, 10297, 2243, 25515, 9438, 5384, 701, 4329, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_merge_segments_with_deletes_above_threshold_different_level_not_involved() { let mut test_merge_policy = test_merge_policy(); test_merge_policy.set_del_docs_ratio_before_merge(0.25f32); let test_input = vec![ create_random_segment_meta(100), create_random_segment_meta(40_000).with_delete_meta(10_001, 1), ]; let merge_candidates = test_merge_policy.compute_merge_candidates(&test_input); assert_eq!(merge_candidates.len(), 1); assert_eq!(merge_candidates[0].0.len(), 1); assert_eq!(merge_candidates[0].0[0], test_input[1].id()); }
rust_cleaned_test_functions.jsonl/57304
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 305 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20888, 55735, 6615, 2259, 13881, 77315, 21858, 82741, 8274, 7913, 19996, 8731, 368, 341, 286, 1077, 5206, 1273, 20888, 22773, 284, 1273, 20888, 22773, 543, 286, 1273, 20888, 22773, 980, 18029, 49692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_day19_part2_extended() { // last example does not match because max rec depth is 4 assert_eq!( 4, part2(&parse( "\ 0: 3 4 1: \"a\" 2: \"b\" 3: 1 2 | 1 2 3 4: 1 1 1 abaaa ababaaa abababaaa abababababaaa ababababababaaa " )) ); }
rust_cleaned_test_functions.jsonl/84992
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 194 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16763, 16, 24, 10495, 17, 61678, 368, 341, 286, 442, 1537, 3110, 1558, 537, 2432, 1576, 1932, 1395, 7990, 374, 220, 19, 198, 286, 2060, 10714, 33673, 310, 220, 19, 345, 310, 949, 17, 2099, 640...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_read_on_replica() { let count = 3; let mut cluster = new_server_cluster(0, count); cluster.run(); let k1 = b"k1"; let (k2, v2) = (b"k2", b"v2"); let (k3, v3) = (b"k3", b"v3"); let (k4, v4) = (b"k4", b"v4"); // make sure leader has been elected. assert_eq!(cluster.must_get(k1), None); let region = cluster.get_region(b""); let leader = cluster.leader_of_region(region.get_id()).unwrap(); let leader_storage = cluster.sim.rl().storages[&leader.get_id()].clone(); let mut leader_ctx = Context::default(); leader_ctx.set_region_id(region.get_id()); leader_ctx.set_region_epoch(region.get_region_epoch().clone()); leader_ctx.set_peer(leader.clone()); // write some data let peers = region.get_peers(); assert_none(&leader_ctx, &leader_storage, k2); must_put(&leader_ctx, &leader_storage, k2, v2); // read on follower let mut follower_peer = None; let mut follower_id = 0; for p in peers { if p.get_id() != leader.get_id() { follower_id = p.get_id(); follower_peer = Some(p.clone()); break; } } assert!(follower_peer.is_some()); let mut follower_ctx = Context::default(); follower_ctx.set_region_id(region.get_id()); follower_ctx.set_region_epoch(region.get_region_epoch().clone()); follower_ctx.set_peer(follower_peer.as_ref().unwrap().clone()); follower_ctx.set_replica_read(true); let follower_storage = cluster.sim.rl().storages[&follower_id].clone(); assert_has(&follower_ctx, &follower_storage, k2, v2); must_put(&leader_ctx, &leader_storage, k3, v3); assert_has(&follower_ctx, &follower_storage, k3, v3); cluster.stop_node(follower_id); must_put(&leader_ctx, &leader_storage, k4, v4); cluster.run_node(follower_id).unwrap(); let follower_storage = cluster.sim.rl().storages[&follower_id].clone(); // sleep to ensure the follower has received a heartbeat from the leader thread::sleep(time::Duration::from_millis(300)); assert_has(&follower_ctx, &follower_storage, k4, v4); }
rust_cleaned_test_functions.jsonl/15824
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 888 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 4470, 25533, 15317, 368, 341, 262, 1077, 1760, 284, 220, 18, 280, 262, 1077, 5206, 10652, 284, 501, 12015, 28441, 7, 15, 11, 1760, 317, 262, 10652, 7634, 1428, 262, 1077, 595, 16, 284, 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...
3
#[test] fn test_serde() { let value = Config::default(); let dump = toml::to_string_pretty(&value).unwrap(); let load = toml::from_str(&dump).unwrap(); assert_eq!(value, load); }
rust_cleaned_test_functions.jsonl/121620
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75861, 450, 368, 341, 286, 1077, 897, 284, 5532, 486, 2258, 543, 286, 1077, 10276, 284, 311, 1014, 486, 983, 3904, 620, 21322, 2099, 957, 568, 15454, 543, 286, 1077, 2795, 284, 311, 1014, 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
#[test] fn test_boundaries_ms() { let start = NaiveDate::from_ymd(2021, 12, 16).and_hms(0, 0, 0); let stop = NaiveDate::from_ymd(2021, 12, 16).and_hms(3, 0, 0); let ts = date_range( start.timestamp_millis(), stop.timestamp_millis(), Duration::parse("30m"), ClosedWindow::Both, TimeUnit::Milliseconds, ); // window: // every 2h // period 1h let w = Window::new( Duration::parse("1h"), Duration::parse("1h"), Duration::parse("0ns"), ); // earliest bound is first datapoint: 2021-12-16 00:00:00 let b = w.get_earliest_bounds_ms(ts[0]); assert_eq!(b.start, start.timestamp_millis()); let (groups, lower, higher) = groupby_windows(w, &ts, true, ClosedWindow::Both, TimeUnit::Milliseconds); // 1st group // expected boundary: // expected members: let g = take_groups_slice(&groups, 0, &ts); let t0 = NaiveDate::from_ymd(2021, 12, 16).and_hms(0, 0, 0); let t1 = NaiveDate::from_ymd(2021, 12, 16).and_hms(0, 30, 0); let t2 = NaiveDate::from_ymd(2021, 12, 16).and_hms(1, 0, 0); assert_eq!( g, &[ t0.timestamp_millis(), t1.timestamp_millis(), t2.timestamp_millis() ] ); let b_start = NaiveDate::from_ymd(2021, 12, 16).and_hms(0, 0, 0); let b_end = NaiveDate::from_ymd(2021, 12, 16).and_hms(1, 0, 0); assert_eq!( &[lower[0], higher[0]], &[b_start.timestamp_millis(), b_end.timestamp_millis()] ); // 2nd group // expected boundary: // expected members: let g = take_groups_slice(&groups, 1, &ts); let t0 = NaiveDate::from_ymd(2021, 12, 16).and_hms(1, 0, 0); let t1 = NaiveDate::from_ymd(2021, 12, 16).and_hms(1, 30, 0); let t2 = NaiveDate::from_ymd(2021, 12, 16).and_hms(2, 0, 0); assert_eq!( g, &[ t0.timestamp_millis(), t1.timestamp_millis(), t2.timestamp_millis() ] ); let b_start = NaiveDate::from_ymd(2021, 12, 16).and_hms(1, 0, 0); let b_end = NaiveDate::from_ymd(2021, 12, 16).and_hms(2, 0, 0); assert_eq!( &[lower[1], higher[1]], &[b_start.timestamp_millis(), b_end.timestamp_millis()] ); assert_eq!(groups[2], [4, 3]); let (groups, _, _) = groupby_windows(w, &ts, false, ClosedWindow::Left, TimeUnit::Milliseconds); assert_eq!(groups[0], [0, 2]); assert_eq!(groups[1], [2, 2]); assert_eq!(groups[2], [4, 2]); let (groups, _, _) = groupby_windows(w, &ts, false, ClosedWindow::Right, TimeUnit::Milliseconds); assert_eq!(groups[0], [1, 2]); assert_eq!(groups[1], [3, 2]); assert_eq!(groups[2], [5, 2]); let (groups, _, _) = groupby_windows(w, &ts, false, ClosedWindow::None, TimeUnit::Milliseconds); assert_eq!(groups[0], [1, 1]); assert_eq!(groups[1], [3, 1]); assert_eq!(groups[2], [5, 1]); }
rust_cleaned_test_functions.jsonl/58724
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1527 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19447, 5431, 21416, 368, 341, 262, 1077, 1191, 284, 12812, 533, 1916, 486, 1499, 62, 1600, 67, 7, 17, 15, 17, 16, 11, 220, 16, 17, 11, 220, 16, 21, 568, 437, 1523, 1011, 7, 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_replace_2c() { let data = "ประเทศไทย中华"; let repl = "دولة الكويت"; let c = "中华"; let c2 = "ประเทศไทยدولة الكويت"; assert_eq!(data.replace(c, repl), c2); }
rust_cleaned_test_functions.jsonl/2435
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 164 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10633, 62, 17, 66, 368, 341, 286, 1077, 821, 284, 330, 130391, 100849, 876, 286, 1077, 5791, 284, 330, 130360, 134385, 3302, 286, 1077, 272, 284, 330, 100849, 876, 286, 1077, 272, 17, 284, 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
#[test] fn test_hex32() { let input: [u8; 9] = [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xff]; let expected_output = unindent( " 0000000 67452301 efcdab89 000000ff 0000011 ", ); new_ucmd!() .arg("--endian=little") .arg("-X") .run_piped_stdin(&input[..]) .success() .no_stderr() .stdout_is(expected_output); }
rust_cleaned_test_functions.jsonl/48803
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 255 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32655, 18, 17, 368, 341, 262, 1077, 1946, 25, 508, 84, 23, 26, 220, 24, 60, 284, 508, 15, 87, 15, 16, 11, 220, 15, 87, 17, 18, 11, 220, 15, 87, 19, 20, 11, 220, 15, 87, 21, 22, 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_missing_fee_amount_for_registration() { let mut deps = mock_dependencies(&[]); test_instantiate(deps.as_mut(), InstArgs::default()).unwrap(); // No fees provided in mock info - this should cause a rejection let rejected_no_coin = register_name(deps.as_mut(), mock_info("theguy", &[]), "newname".into()).unwrap_err(); assert!(matches!( rejected_no_coin, ContractError::NoFundsProvidedForRegistration )); let incorrect_denom_info = mock_info( "theotherguy", &vec![ // Send 3 different types of currencies that the contract is not expected to handle coin(DEFAULT_FEE_AMOUNT, "nothash"), coin(DEFAULT_FEE_AMOUNT, "fakecoin"), coin(DEFAULT_FEE_AMOUNT, "dogecoin"), // Provide the a correct value as well to ensure that the validation will reject all // requests that include excess coin(DEFAULT_FEE_AMOUNT, "nhash"), ], ); let rejected_incorrect_type_coin = register_name(deps.as_mut(), incorrect_denom_info, "newname".into()).unwrap_err(); match rejected_incorrect_type_coin { ContractError::InvalidFundsProvided { types } => { assert_eq!( 3, types.len(), "expected the three invalid types to be returned in the rejection" ); types .iter() .find(|coin_type| coin_type.as_str() == "nothash") .unwrap(); types .iter() .find(|coin_type| coin_type.as_str() == "fakecoin") .unwrap(); types .iter() .find(|coin_type| coin_type.as_str() == "dogecoin") .unwrap(); } _ => panic!("unexpected error encountered when providing invalid fund types"), } }
rust_cleaned_test_functions.jsonl/80123
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1097 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40447, 34305, 13471, 5478, 49101, 368, 341, 286, 1077, 5206, 48178, 284, 7860, 71841, 2099, 56703, 286, 1273, 1243, 42251, 12797, 1690, 5357, 29523, 1507, 5984, 4117, 486, 2258, 6011, 15454, 543, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_ft_transfer_max_value() { let (_, contract) = init(CUSTODIAN_ADDRESS); call_deposit_eth_to_near(&contract, CONTRACT_ACC); let transfer_amount = u128::MAX; let res = contract.call( CONTRACT_ACC.parse().unwrap(), "ft_transfer", json!({ "receiver_id": DEPOSITED_RECIPIENT, "amount": transfer_amount.to_string(), "memo": "transfer memo" }) .to_string() .as_bytes(), DEFAULT_GAS, 1, ); let promises = res.promise_results(); let promise = &promises[promises.len() - 3]; eprintln!("{:#?}", promise.as_ref().unwrap().outcome().clone().status); assert_execution_status_failure( promise.as_ref().unwrap().outcome().clone().status, "ERR_NOT_ENOUGH_BALANCE", "Expected failure as the amount is too large", ); }
rust_cleaned_test_functions.jsonl/112890
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 413 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41572, 35403, 6345, 3142, 368, 341, 262, 1077, 39464, 5116, 8, 284, 2930, 3025, 8553, 2069, 22002, 20135, 317, 262, 1618, 85798, 57757, 2346, 76340, 2099, 20257, 11, 17126, 25666, 626, 262, 1077, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_line_segment_disk_intersection() { let a = point![1.0, 2.0]; let b = point![4.0, 1.0]; let c = point![2.0, 3.0]; let segment = LineSegment2d::new(a, b); { let disk = Disk::from_center_and_radius(c, 1.0); assert!(segment.intersect_disk(&disk).is_none()); } { let disk = Disk::from_center_and_radius(c, 2.0); let intersection_point = point![3.069693845669907, 1.310102051443365]; let expected_intersection = LineSegment2d::new(a, intersection_point); let intersection = segment.intersect_disk(&disk).unwrap(); assert_line_segments_approx_equal!(intersection, expected_intersection, abstol = 1e-14); } { let disk = Disk::from_center_and_radius(c, 3.0); let intersection = segment.intersect_disk(&disk).unwrap(); assert_line_segments_approx_equal!(intersection, segment, abstol = 1e-14); } // Test when the disk is on the other side of the line segment { let c2 = point![2.0, 1.0]; let disk = Disk::from_center_and_radius(c2, 1.0); let expected_intersection = LineSegment2d::new( point![1.465153077165047, 1.844948974278318], point![2.934846922834954, 1.355051025721682], ); let intersection = segment.intersect_disk(&disk).unwrap(); assert_line_segments_approx_equal!(intersection, expected_intersection, abstol = 1e-14); } }
rust_cleaned_test_functions.jsonl/8895
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 671 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6528, 28061, 41687, 82558, 368, 341, 262, 1077, 264, 284, 1459, 20703, 16, 13, 15, 11, 220, 17, 13, 15, 935, 262, 1077, 293, 284, 1459, 20703, 19, 13, 15, 11, 220, 16, 13, 15, 935, 262, 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_reviving_dead_player() { let dead_player = Player { health: 0, mana: Some(0), level: 34, }; let revived_player = dead_player .revive() .expect("reviving a dead player must return Some(player)"); assert_eq!(revived_player.health, 100); assert_eq!(revived_player.mana, Some(100)); assert_eq!(revived_player.level, dead_player.level); }
rust_cleaned_test_functions.jsonl/21560
{ "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, 38082, 2249, 53427, 15524, 368, 341, 262, 1077, 5593, 15524, 284, 7312, 341, 286, 2820, 25, 220, 15, 345, 286, 30131, 25, 4329, 7, 15, 1326, 286, 2188, 25, 220, 18, 19, 345, 262, 2605, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_merge_without_duplicates() { let ps1 = VecPostings { docs: vec![1, 2], tfs: vec![0, 1, 2], // NOTE: tfs must already be cumulated! positions: vec![1, 2], }; let ps2 = VecPostings { docs: vec![2, 3], tfs: vec![0, 2, 5], // NOTE: tfs must already be cumulated! positions: vec![1, 2, 1, 2, 3], }; let ps1c = RawCursor::new(Postings { docs: (&ps1.docs).to_sequence(), tfs: (&ps1.tfs).to_sequence(), positions: (&ps1.positions).to_sequence(), }); let ps2c = RawCursor::new(Postings { docs: (&ps2.docs).to_sequence(), tfs: (&ps2.tfs).to_sequence(), positions: (&ps2.positions).to_sequence(), }); let mut merger = MergerWithoutDuplicates::new(vec![ps1c, ps2c]); let merged = merger.collect(); assert_eq!(merged.docs, vec![1, 2, 3]); assert_eq!(merged.tfs, vec![1, 2, 3]); // NOTE: result tfs are not cumulated though! assert_eq!(merged.positions, vec![1, 1, 2, 1, 2, 3]); }
rust_cleaned_test_functions.jsonl/15066
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 599 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20888, 39904, 75051, 368, 341, 286, 1077, 4726, 16, 284, 11312, 4133, 819, 341, 310, 26340, 25, 7486, 20703, 16, 11, 220, 17, 1259, 310, 259, 3848, 25, 7486, 20703, 15, 11, 220, 16, 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_comma_separated() { assert_eq!( parse_freecells("JH, TD, 9H"), Err("Could not parse freecells: \"JH, TD, 9H\"".to_string()) ); }
rust_cleaned_test_functions.jsonl/3207
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 88 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2965, 1728, 3453, 49600, 368, 341, 262, 2060, 10714, 33673, 286, 4715, 74179, 757, 6436, 445, 41, 39, 11, 27716, 11, 220, 24, 39, 4461, 286, 15495, 445, 12895, 537, 4715, 3457, 757, 6436, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_read_text_string() { assert_eq!( read_text_string(&cbor_int!(123)), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); assert_eq!( read_text_string(&cbor_bool!(true)), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); assert_eq!(read_text_string(&cbor_text!("")), Ok(String::new())); assert_eq!( read_text_string(&cbor_text!("foo")), Ok(String::from("foo")) ); assert_eq!( read_text_string(&cbor_bytes_lit!(b"bar")), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); assert_eq!( read_text_string(&cbor_array![]), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); assert_eq!( read_text_string(&cbor_map! {}), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); }
rust_cleaned_test_functions.jsonl/51438
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 527 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 4326, 3904, 368, 341, 286, 2060, 10714, 33673, 310, 1349, 4326, 3904, 2099, 7221, 269, 4042, 10297, 16, 17, 18, 6965, 310, 15495, 7, 1162, 2537, 17, 9875, 48933, 868, 6735, 80002, 4189, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_unquoting_parts() { assert_eq!(unquote("ab%63d").ok().unwrap(), "abcd"); assert_eq!(unquote_plus("ab%63d").ok().unwrap(), "abcd"); }
rust_cleaned_test_functions.jsonl/21623
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 77 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 446, 11519, 33217, 368, 341, 262, 2060, 10714, 10297, 359, 2949, 445, 370, 4, 21, 18, 67, 1827, 562, 1005, 15454, 1507, 330, 68644, 797, 262, 2060, 10714, 10297, 359, 2949, 28043, 445, 370...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_visibility_operator_other() { let user = test_model::new_operator_user(); let other = test_model::new_general_user(); let (file, _) = test_model::new_file(other.id().clone()); assert!(!file.is_visible_to(&user)); }
rust_cleaned_test_functions.jsonl/5058
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 120 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 71256, 40594, 30456, 368, 341, 286, 1077, 1196, 284, 1273, 5047, 486, 931, 40594, 3317, 543, 286, 1077, 1008, 284, 1273, 5047, 486, 931, 39177, 3317, 543, 286, 1077, 320, 1192, 11, 27439, 284, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rent_debits() { let mut rent_debits = RentDebits::default(); // No entry for 0 rewards rent_debits.push(&Pubkey::default(), 0, 0); assert_eq!(rent_debits.0.len(), 0); rent_debits.push(&Pubkey::default(), u64::MAX, 0); assert_eq!(rent_debits.0.len(), 0); // Some that actually work rent_debits.push(&Pubkey::default(), 1, 0); assert_eq!(rent_debits.0.len(), 1); rent_debits.push(&Pubkey::default(), i64::MAX as u64, 0); assert_eq!(rent_debits.0.len(), 2); }
rust_cleaned_test_functions.jsonl/2683
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 292 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 83127, 2259, 11516, 368, 341, 286, 1077, 5206, 8016, 2259, 11516, 284, 29737, 1912, 11516, 486, 2258, 1428, 286, 442, 2308, 4343, 369, 220, 15, 21160, 198, 286, 8016, 2259, 11516, 2552, 2099, 2916...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_address_equal() { let ip = Ipv4Addr::new(1, 2, 3, 4); let a = IpAddr::V4(ip); assert!(address_equal(&a, &IpAddr::V6(ip.to_ipv6_compatible()))); assert!(address_equal(&a, &IpAddr::V6(ip.to_ipv6_mapped()))); assert!(!address_equal( &a, &IpAddr::V6(Ipv6Addr::new(1, 0, 0, 0, 0, 0, 0x0102, 0x0304)) )); }
rust_cleaned_test_functions.jsonl/84250
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 242 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6744, 11478, 368, 341, 286, 1077, 5997, 284, 358, 30168, 19, 13986, 486, 931, 7, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 317, 286, 1077, 264, 284, 35033, 13986, 486, 53, 19, 23443, 626, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_module_methods_implementation () { // Check for reserve new_test_ext().execute_with(|| { setup_asset_pallet(); let sample_asset = ("Sample").using_encoded(<Test as frame_system::Config>::Hashing::hash); let alice: u64 = 1; assert_ok!(PolkadexCustomAssetsModule::reserve(&alice, sample_asset, 80u128*UNIT)); let alice_balance: AccountData = <Balance<Test>>::get(&sample_asset, &alice); assert_eq!(alice_balance.free_balance, FixedU128::from(20)); assert_eq!(alice_balance.reserved_balance, FixedU128::from(84)); }); // Check for underflow - reserve new_test_ext().execute_with(|| { setup_asset_pallet(); let sample_asset = ("Sample").using_encoded(<Test as frame_system::Config>::Hashing::hash); let alice: u64 = 1; assert_noop!(PolkadexCustomAssetsModule::reserve(&alice, sample_asset, 120u128*UNIT), Error::<Test>::SubUnderflowOrOverflow); // Wrong Account Id let wrong_id: u64 =2; assert_noop!(PolkadexCustomAssetsModule::reserve(&wrong_id, sample_asset, 500u128*UNIT), Error::<Test>::AccountNotFound); // Wrong Asset Id let wrong_asset = ("Wrong").using_encoded(<Test as frame_system::Config>::Hashing::hash); assert_noop!(PolkadexCustomAssetsModule::reserve(&alice, wrong_asset, 500u128*UNIT), Error::<Test>::AccountNotFound); }); // Check for unreserve new_test_ext().execute_with(|| { setup_asset_pallet(); let sample_asset = ("Sample").using_encoded(<Test as frame_system::Config>::Hashing::hash); let alice: u64 = 1; assert_ok!(PolkadexCustomAssetsModule::unreserve(&alice, sample_asset, 2u128*UNIT)); let alice_balance: AccountData = <Balance<Test>>::get(&sample_asset, &alice); assert_eq!(alice_balance.free_balance, FixedU128::from(102)); assert_eq!(alice_balance.reserved_balance, FixedU128::from(2)); // Wrong Account Id let wrong_id: u64 =2; assert_noop!(PolkadexCustomAssetsModule::unreserve(&wrong_id, sample_asset, 500u128*UNIT), Error::<Test>::AccountNotFound); // Wrong Asset Id let wrong_asset = ("Wrong").using_encoded(<Test as frame_system::Config>::Hashing::hash); assert_noop!(PolkadexCustomAssetsModule::unreserve(&alice, wrong_asset, 500u128*UNIT), Error::<Test>::AccountNotFound); }); // Check for underflow - unreserve new_test_ext().execute_with(|| { setup_asset_pallet(); let sample_asset = ("Sample").using_encoded(<Test as frame_system::Config>::Hashing::hash); let alice: u64 = 1; assert_noop!(PolkadexCustomAssetsModule::unreserve(&alice, sample_asset, 120u128*UNIT), Error::<Test>::SubUnderflowOrOverflow); }); // Check for free balance new_test_ext().execute_with(|| { setup_asset_pallet(); let sample_asset = ("Sample").using_encoded(<Test as frame_system::Config>::Hashing::hash); let alice: u64 = 1; assert_eq!(PolkadexCustomAssetsModule::free_balance(&alice, sample_asset), 100u128*UNIT); // Wrong account id let wrong_id: u64 =2; assert_eq!(PolkadexCustomAssetsModule::free_balance(&wrong_id, sample_asset), 0u128*UNIT); }); // Check for Reserved Balance new_test_ext().execute_with(|| { setup_asset_pallet(); let sample_asset = ("Sample").using_encoded(<Test as frame_system::Config>::Hashing::hash); let alice: u64 = 1; assert_eq!(PolkadexCustomAssetsModule::reserved_balance(&alice, sample_asset), 4u128*UNIT); // Wrong account id let wrong_id: u64 =2; assert_eq!(PolkadexCustomAssetsModule::reserved_balance(&wrong_id, sample_asset), 0u128*UNIT); }); }
rust_cleaned_test_functions.jsonl/100187
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1614 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10750, 36084, 62, 14369, 1719, 341, 262, 442, 4248, 369, 20499, 198, 262, 501, 4452, 9927, 1005, 10257, 6615, 79453, 341, 286, 6505, 42299, 620, 7464, 543, 286, 1077, 6077, 42299, 284, 220, 3489, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_payload_non_op_return() { // Payload from old anchoring transaction let script_pubkey = Script::from_hex("a91472b7506704dc074fa46359251052e781d96f939a87"); assert_eq!(Payload::from_script(&script_pubkey), None); }
rust_cleaned_test_functions.jsonl/119540
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 119 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32813, 21637, 10287, 12511, 368, 341, 286, 442, 52916, 504, 2310, 33230, 5503, 7745, 198, 286, 1077, 5316, 34014, 792, 284, 13710, 486, 1499, 32655, 445, 64, 24, 16, 19, 22, 17, 65, 22, 20, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_is_zumkeller() { assert_eq!(is_zumkeller_number(0), false); assert_eq!(is_zumkeller_number(6), true); assert_eq!(is_zumkeller_number(20), true); assert_eq!(is_zumkeller_number(21), false); assert_eq!(is_zumkeller_number(198), true); }
rust_cleaned_test_functions.jsonl/87
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 157 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 6415, 372, 74, 7073, 368, 341, 286, 2060, 10714, 10297, 285, 6415, 372, 74, 7073, 5500, 7, 15, 701, 895, 317, 286, 2060, 10714, 10297, 285, 6415, 372, 74, 7073, 5500, 7, 21, 701, 830, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_field_occurrence() { assert_eq!( parse_field_occurrence(b"/00").unwrap().1, Occurrence::from_unchecked("00") ); assert_eq!( parse_field_occurrence(b"/01").unwrap().1, Occurrence::from_unchecked("01") ); assert_eq!( parse_field_occurrence(b"/001").unwrap().1, Occurrence::from_unchecked("001") ); assert_eq!(parse_field_occurrence(b"/XYZ").is_err(), true); }
rust_cleaned_test_functions.jsonl/101493
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 278 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 5013, 57291, 20559, 368, 341, 286, 2060, 10714, 33673, 310, 4715, 5013, 57291, 20559, 1883, 3115, 15, 15, 1827, 15454, 1005, 16, 345, 310, 19927, 20559, 486, 1499, 4907, 7549, 445, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_serialize_h160() { let tests = vec![ (H160::from(0), "0x0000000000000000000000000000000000000000"), (H160::from(2), "0x0000000000000000000000000000000000000002"), (H160::from(15), "0x000000000000000000000000000000000000000f"), (H160::from(16), "0x0000000000000000000000000000000000000010"), (H160::from(1_000), "0x00000000000000000000000000000000000003e8"), (H160::from(100_000), "0x00000000000000000000000000000000000186a0"), (H160::from(u64::max_value()), "0x000000000000000000000000ffffffffffffffff"), ]; for (number, expected) in tests { assert_eq!(format!("{:?}", expected), ser::to_string_pretty(&number).unwrap()); assert_eq!(number, ser::from_str(&format!("{:?}", expected)).unwrap()); } }
rust_cleaned_test_functions.jsonl/12619
{ "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, 88686, 1523, 16, 21, 15, 368, 341, 197, 10217, 7032, 284, 7486, 90515, 298, 197, 10896, 16, 21, 15, 486, 1499, 7, 15, 701, 330, 15, 87, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_i8042_invalid_reset() { let reset_evt = EventFd::new(libc::EFD_NONBLOCK).unwrap(); let mut i8042 = I8042Device::new(reset_evt.try_clone().unwrap()); // Write something different than CPU reset and check that the reset event // that read doesn't block. assert!(reset_evt.write(1).is_ok()); i8042.write(COMMAND_OFFSET, CMD_RESET_CPU + 1).unwrap(); assert_eq!(reset_evt.read().unwrap(), 1); // Write the CPU reset to a different offset than COMMAND_OFFSET and check that // the reset event was not triggered. // For such accesses we should increment some metric (COMMAND_OFFSET + 1 is not assert!(reset_evt.write(1).is_ok()); i8042.write(COMMAND_OFFSET + 1, CMD_RESET_CPU).unwrap(); assert_eq!(reset_evt.read().unwrap(), 1); }
rust_cleaned_test_functions.jsonl/7216
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 396 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5318, 23, 15, 19, 17, 31433, 18983, 368, 341, 286, 1077, 7585, 60019, 284, 3665, 74476, 486, 931, 44828, 66, 486, 36, 14596, 22128, 39964, 568, 15454, 543, 286, 1077, 5206, 600, 23, 15, 19, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_accumulator_append() { // expected_root_hashes[i] is the root hash of an accumulator that has the first i leaves. let expected_root_hashes = (2000..2100).map(|x| { let leaves = create_leaves(2000..x); compute_root_hash_naive(&leaves) }); let leaves = create_leaves(2000..2100); let mock_store = MockAccumulatorStore::new(); let accumulator = MerkleAccumulator::new( *ACCUMULATOR_PLACEHOLDER_HASH, vec![], 0, 0, Arc::new(mock_store), ); // test to append empty leaf to an empty accumulator accumulator.append(&[]).unwrap(); // Append the leaves one at a time and check the root hashes match. for (i, (leaf, expected_root_hash)) in itertools::zip_eq(leaves.into_iter(), expected_root_hashes).enumerate() { assert_eq!(accumulator.root_hash(), expected_root_hash); assert_eq!(accumulator.num_leaves(), i as LeafCount); accumulator.append(&[leaf]).unwrap(); } // test to append empty leaf to an accumulator which isn't empty accumulator.append(&[]).unwrap(); }
rust_cleaned_test_functions.jsonl/51487
{ "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, 75837, 10511, 26041, 368, 341, 262, 442, 3601, 12993, 91616, 989, 60, 374, 279, 3704, 5175, 315, 458, 56312, 429, 702, 279, 1156, 600, 10901, 624, 262, 1077, 3601, 12993, 91616, 284, 320, 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...
2
#[test] fn test_query_matches_with_different_tokens_with_the_same_string_value() { allocations::record(|| { // and one with higher precedence for generics. let language = get_language("rust"); let query = Query::new( language, r#" "<" @less ">" @greater "#, ) .unwrap(); assert_query_matches( language, &query, "const A: B<C> = d < e || f > g;", &[ (0, vec![("less", "<")]), (1, vec![("greater", ">")]), (0, vec![("less", "<")]), (1, vec![("greater", ">")]), ], ); }); }
rust_cleaned_test_functions.jsonl/25172
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 449 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5738, 38344, 6615, 82741, 28838, 6615, 16068, 33574, 3904, 3142, 368, 341, 262, 69642, 486, 8548, 79453, 341, 1789, 286, 442, 323, 825, 448, 5080, 53056, 369, 95545, 624, 286, 1077, 4128, 284, 633...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_query_matches_with_many_overlapping_results() { allocations::record(|| { let language = get_language("javascript"); let query = Query::new( language, r#" (call_expression function: (member_expression property: (property_identifier) @method)) (call_expression function: (identifier) @function) ((identifier) @constant (#match? @constant "[A-Z\\d_]+")) "#, ) .unwrap(); let count = 1024; // Deeply nested chained function calls: // a let mut source = "a".to_string(); source += &"\n .foo(bar(BAZ))".repeat(count); assert_query_matches( language, &query, &source, &[ (0, vec![("method", "foo")]), (1, vec![("function", "bar")]), (2, vec![("constant", "BAZ")]), ] .iter() .cloned() .cycle() .take(3 * count) .collect::<Vec<_>>(), ); }); }
rust_cleaned_test_functions.jsonl/25152
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 693 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5738, 38344, 6615, 22101, 15431, 90619, 13576, 368, 341, 262, 69642, 486, 8548, 79453, 341, 286, 1077, 4128, 284, 633, 29021, 445, 14073, 797, 286, 1077, 3239, 284, 11361, 486, 931, 1006, 310, 412...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_commute_quickcheck_bug() { let ops = vec![ map::Op::Rm { clock: Dot::new(45, 1).into(), keyset: vec![0].into_iter().collect(), }, map::Op::Up { dot: Dot::new(45, 2), key: 0, op: map::Op::Up { dot: Dot::new(45, 1), key: 0, op: mvreg::Op::Put { clock: VClock::new(), val: 0, }, }, }, ]; let mut m = Map::new(); apply_ops(&mut m, &ops); let m_snapshot = m.clone(); let mut empty_m = Map::new(); m.merge(empty_m.clone()); empty_m.merge(m_snapshot); assert_eq!(m, empty_m); }
rust_cleaned_test_functions.jsonl/61630
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 448 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25149, 1070, 82094, 2028, 73232, 368, 341, 262, 1077, 27132, 284, 7486, 90515, 286, 2415, 486, 7125, 486, 49, 76, 341, 310, 8866, 25, 31262, 486, 931, 7, 19, 20, 11, 220, 16, 568, 18122, 3148,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_grid_to_coordinate() { let grid = GridPosition(GridDimension(7), GridDimension(7)); let coord = grid_to_coordinates(grid); assert!(coord.0 == 224.0 && coord.1 == 224.0); }
rust_cleaned_test_functions.jsonl/81057
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 100 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15604, 2346, 68649, 368, 341, 286, 1077, 5827, 284, 10587, 3812, 86256, 26121, 7, 22, 701, 10587, 26121, 7, 22, 1106, 286, 1077, 16489, 284, 5827, 2346, 50084, 25319, 317, 286, 2060, 10297, 26402,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_hover_extern_crate() { check( r#" //- /main.rs crate:main deps:std extern crate st$0d; //- /std/lib.rs crate:std //! Standard library for this test //! //! Printed? //! abc123 "#, expect![[r#" *std* ```rust extern crate std ``` --- Standard library for this test Printed? abc123 "#]], ); check( r#" //- /main.rs crate:main deps:std extern crate std as ab$0c; //- /std/lib.rs crate:std //! Standard library for this test //! //! Printed? //! abc123 "#, expect![[r#" *abc* ```rust extern crate std ``` --- Standard library for this test Printed? abc123 "#]], ); }
rust_cleaned_test_functions.jsonl/66653
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 588 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53445, 62, 4301, 666, 7698, 368, 341, 286, 1779, 1006, 310, 435, 2, 698, 61463, 608, 3817, 25638, 17717, 25, 3817, 48178, 25, 1834, 198, 4301, 17717, 357, 3, 15, 67, 280, 61463, 608, 1834, 819...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_end_membership() { let time = [ NaiveDate::from_ymd(2021, 2, 1) .and_hms(0, 0, 0) .timestamp_millis(), NaiveDate::from_ymd(2021, 5, 1) .and_hms(0, 0, 0) .timestamp_millis(), ]; let window = Window::new( Duration::parse("1mo"), Duration::parse("2mo"), Duration::parse("-2mo"), ); // windows // 2020-12-01 -> 2021-02-01 members: None // 2021-01-01 -> 2021-03-01 members: [0] // 2021-02-01 -> 2021-04-01 members: [0] // 2021-03-01 -> 2021-05-01 members: None // 2021-04-01 -> 2021-06-01 members: [1] // 2021-05-01 -> 2021-07-01 members: [1] let (groups, _, _) = groupby_windows( window, &time, false, ClosedWindow::Left, TimeUnit::Milliseconds, ); assert_eq!(groups[0], [0, 1]); assert_eq!(groups[1], [0, 1]); assert_eq!(groups[2], [1, 1]); assert_eq!(groups[3], [1, 1]); }
rust_cleaned_test_functions.jsonl/61975
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 537 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6213, 84635, 368, 341, 262, 1077, 882, 284, 2278, 286, 12812, 533, 1916, 486, 1499, 62, 1600, 67, 7, 17, 15, 17, 16, 11, 220, 17, 11, 220, 16, 340, 310, 659, 437, 1523, 1011, 7, 15, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_write_byte_array_stop_encoding() -> io::Result<()> { let mut buf = Vec::new(); write_byte_array_stop_encoding(&mut buf, 0x00, 8)?; let expected = [ 5, // byte array stop encoding ID 2, // args.len 0, // NUL 8, // block content ID ]; assert_eq!(buf, expected); Ok(()) }
rust_cleaned_test_functions.jsonl/34016
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 205 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9165, 19737, 3858, 19039, 37613, 368, 1464, 6399, 486, 2077, 71698, 341, 286, 1077, 5206, 6607, 284, 11312, 486, 931, 543, 286, 3270, 19737, 3858, 19039, 37613, 2099, 6984, 6607, 11, 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...
2
#[test] fn test_classify() { let nan: f64 = Float::nan(); let inf: f64 = Float::infinity(); let neg_inf: f64 = Float::neg_infinity(); let zero: f64 = Float::zero(); let neg_zero: f64 = Float::neg_zero(); assert_eq!(nan.classify(), Fp::Nan); assert_eq!(inf.classify(), Fp::Infinite); assert_eq!(neg_inf.classify(), Fp::Infinite); assert_eq!(zero.classify(), Fp::Zero); assert_eq!(neg_zero.classify(), Fp::Zero); assert_eq!(1e-307f64.classify(), Fp::Normal); assert_eq!(1e-308f64.classify(), Fp::Subnormal); }
rust_cleaned_test_functions.jsonl/7430
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 302 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4790, 1437, 368, 341, 286, 1077, 20021, 25, 282, 21, 19, 284, 13001, 486, 18759, 543, 286, 1077, 4132, 25, 282, 21, 19, 284, 13001, 486, 80016, 543, 286, 1077, 4184, 26051, 25, 282, 21, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_intersection() { fn check_intersection(a: &[i32], b: &[i32], expected: &[i32]) { check(a, b, expected, |x, y, f| x.intersection(y).all(f)) } check_intersection(&[], &[], &[]); check_intersection(&[1, 2, 3], &[], &[]); check_intersection(&[], &[1, 2, 3], &[]); check_intersection(&[2], &[1, 2, 3], &[2]); check_intersection(&[1, 2, 3], &[2], &[2]); check_intersection(&[11, 1, 3, 77, 103, 5, -5], &[2, 11, 77, -9, -42, 5, 3], &[3, 5, 11, 77]); if cfg!(miri) { // Miri is too slow return; } let large = (0..100).collect::<Vec<_>>(); check_intersection(&[], &large, &[]); check_intersection(&large, &[], &[]); check_intersection(&[-1], &large, &[]); check_intersection(&large, &[-1], &[]); check_intersection(&[0], &large, &[0]); check_intersection(&large, &[0], &[0]); check_intersection(&[99], &large, &[99]); check_intersection(&large, &[99], &[99]); check_intersection(&[100], &large, &[]); check_intersection(&large, &[100], &[]); check_intersection(&[11, 5000, 1, 3, 77, 8924], &large, &[1, 3, 11, 77]); }
rust_cleaned_test_functions.jsonl/12204
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 536 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 82558, 368, 341, 262, 5168, 1779, 82558, 2877, 25, 44590, 72, 18, 17, 1125, 293, 25, 44590, 72, 18, 17, 1125, 3601, 25, 44590, 72, 18, 17, 2467, 341, 286, 1779, 2877, 11, 293, 11, 3601, 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_vec() { let fixture = parse_macro( r#" macro_rules! vec { ($($item:expr),*) => { { let mut v = Vec::new(); $( v.push($item); )* v } }; } "#, ); fixture .assert_expand_items(r#"vec!();"#, r#"{let mut v = Vec :: new () ; v}"#) .assert_expand_items( r#"vec![1u32,2];"#, r#"{let mut v = Vec :: new () ; v . push (1u32) ; v . push (2) ; v}"#, ); let tree = fixture.expand_expr(r#"vec![1u32,2];"#); assert_eq!( format!("{:#?}", tree).trim(), r#"BLOCK_EXPR@0..45 L_CURLY@0..1 "{" LET_STMT@1..20 LET_KW@1..4 "let" IDENT_PAT@4..8 MUT_KW@4..7 "mut" NAME@7..8 IDENT@7..8 "v" EQ@8..9 "=" CALL_EXPR@9..19 PATH_EXPR@9..17 PATH@9..17 PATH@9..12 PATH_SEGMENT@9..12 NAME_REF@9..12 IDENT@9..12 "Vec" COLON2@12..14 "::" PATH_SEGMENT@14..17 NAME_REF@14..17 IDENT@14..17 "new" ARG_LIST@17..19 L_PAREN@17..18 "(" R_PAREN@18..19 ")" SEMICOLON@19..20 ";" EXPR_STMT@20..33 METHOD_CALL_EXPR@20..32 PATH_EXPR@20..21 PATH@20..21 PATH_SEGMENT@20..21 NAME_REF@20..21 IDENT@20..21 "v" DOT@21..22 "." NAME_REF@22..26 IDENT@22..26 "push" ARG_LIST@26..32 L_PAREN@26..27 "(" LITERAL@27..31 INT_NUMBER@27..31 "1u32" R_PAREN@31..32 ")" SEMICOLON@32..33 ";" EXPR_STMT@33..43 METHOD_CALL_EXPR@33..42 PATH_EXPR@33..34 PATH@33..34 PATH_SEGMENT@33..34 NAME_REF@33..34 IDENT@33..34 "v" DOT@34..35 "." NAME_REF@35..39 IDENT@35..39 "push" ARG_LIST@39..42 L_PAREN@39..40 "(" LITERAL@40..41 INT_NUMBER@40..41 "2" R_PAREN@41..42 ")" SEMICOLON@42..43 ";" PATH_EXPR@43..44 PATH@43..44 PATH_SEGMENT@43..44 NAME_REF@43..44 IDENT@43..44 "v" R_CURLY@44..45 "}""# ); }
rust_cleaned_test_functions.jsonl/28761
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1462 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 368, 341, 262, 1077, 12507, 284, 4715, 58810, 1006, 286, 435, 2, 698, 260, 18072, 21407, 0, 7486, 341, 310, 1711, 699, 1203, 96011, 701, 3764, 589, 341, 394, 341, 503, 1077, 5206, 348, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vec3mask_and() { assert_eq!( (Vec3Mask::new(false, false, false) & Vec3Mask::new(false, false, false)).bitmask(), 0b000, ); assert_eq!( (Vec3Mask::new(true, true, true) & Vec3Mask::new(true, true, true)).bitmask(), 0b111, ); assert_eq!( (Vec3Mask::new(true, false, true) & Vec3Mask::new(false, true, false)).bitmask(), 0b000, ); assert_eq!( (Vec3Mask::new(true, false, true) & Vec3Mask::new(true, true, true)).bitmask(), 0b101, ); let mut mask = Vec3Mask::new(true, true, false); mask &= Vec3Mask::new(true, false, false); assert_eq!(mask.bitmask(), 0b001); }
rust_cleaned_test_functions.jsonl/48598
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 336 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 18, 11258, 8378, 368, 341, 262, 2060, 10714, 33673, 286, 320, 10050, 18, 12686, 486, 931, 3576, 11, 895, 11, 895, 8, 609, 11312, 18, 12686, 486, 931, 3576, 11, 895, 11, 895, 4579, 4489,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_reschedule() { set_logger_for_test(); let mut executor = fasync::Executor::new_with_fake_time().unwrap(); let (mut t, mut rcv) = TestContext::new(); // timer 1 and 2 are scheduled. // timer 1 is going to be rescheduled even before we allow the loop to // run. let time1 = nanos_from_now(1); let time2 = nanos_from_now(2); let resched1 = nanos_from_now(3); let resched2 = nanos_from_now(4); t.with_disp_sync(|d| { assert!(d.schedule_timer(1, time1).is_none()); assert!(d.schedule_timer(2, time2).is_none()); assert_eq!(d.schedule_timer(1, resched1).unwrap(), time1); }); executor.set_fake_time(time2.0); let r = run_in_executor(&mut executor, rcv.next()).unwrap(); // only event 2 should come out: assert_eq!(r, 2); t.with_disp_sync(|d| { // already fired. assert!(d.schedule_timer(2, resched2).is_none()); }); // now we can go at it again and get the rescheduled timers: executor.set_fake_time(resched2.0); assert_eq!(run_in_executor(&mut executor, rcv.next()).unwrap(), 1); assert_eq!(run_in_executor(&mut executor, rcv.next()).unwrap(), 2); }
rust_cleaned_test_functions.jsonl/52881
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 655 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4918, 8796, 368, 341, 286, 738, 27413, 5478, 4452, 543, 286, 1077, 5206, 31558, 284, 282, 7692, 486, 25255, 486, 931, 6615, 56881, 3009, 1005, 15454, 543, 286, 1077, 320, 6984, 259, 11, 5206, 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_bool_array_or() { let a = BooleanArray::from(vec![false, false, true, true]); let b = BooleanArray::from(vec![false, true, false, true]); let c = or(&a, &b).unwrap(); assert_eq!(false, c.value(0)); assert_eq!(true, c.value(1)); assert_eq!(true, c.value(2)); assert_eq!(true, c.value(3)); }
rust_cleaned_test_functions.jsonl/118976
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 185 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22159, 3858, 8734, 368, 341, 286, 1077, 264, 284, 6992, 1857, 486, 1499, 25592, 20703, 3849, 11, 895, 11, 830, 11, 830, 2558, 286, 1077, 293, 284, 6992, 1857, 486, 1499, 25592, 20703, 3849, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_adjust_lockouts_after_replay_all_rooted_with_no_too_old() { let mut tower = Tower::new_for_tests(10, 0.9); tower.record_vote(0, Hash::default()); tower.record_vote(1, Hash::default()); tower.record_vote(2, Hash::default()); let mut slot_history = SlotHistory::default(); slot_history.add(0); slot_history.add(1); slot_history.add(2); slot_history.add(3); slot_history.add(4); slot_history.add(5); let replayed_root_slot = 5; tower = tower .adjust_lockouts_after_replay(replayed_root_slot, &slot_history) .unwrap(); assert_eq!(tower.voted_slots(), vec![] as Vec<Slot>); assert_eq!(tower.root(), replayed_root_slot); assert_eq!(tower.stray_restored_slot, None); }
rust_cleaned_test_functions.jsonl/61165
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 403 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44153, 9818, 11672, 19844, 1288, 1363, 5705, 12993, 291, 6615, 6536, 2346, 78, 21108, 368, 341, 286, 1077, 5206, 21271, 284, 21938, 486, 931, 5478, 32509, 7, 16, 15, 11, 220, 15, 13, 24, 317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_primitive_array_neq() { cmp_i64!( neq, neq_dyn, vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8], vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10], vec![true, true, false, true, true, true, true, false, true, true] ); cmp_vec!( neq, neq_dyn, TimestampMillisecondArray, vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8], vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10], vec![true, true, false, true, true, true, true, false, true, true] ); }
rust_cleaned_test_functions.jsonl/98170
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 370 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84087, 3858, 13925, 80, 368, 341, 286, 26089, 5318, 21, 19, 33673, 310, 834, 80, 345, 310, 834, 80, 69213, 345, 310, 7486, 20703, 23, 11, 220, 23, 11, 220, 23, 11, 220, 23, 11, 220, 23, 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_write_header_linux() -> Result<(), Error> { let buffer = ByteView::open(fixture("linux/crash.debug"))?; let object = Object::parse(&buffer)?; let mut buffer = Vec::new(); SymCacheWriter::write_object(&object, Cursor::new(&mut buffer))?; let symcache = SymCache::parse(&buffer)?; insta::assert_debug_snapshot!(symcache, @r###" SymCache { debug_id: DebugId { uuid: "c0bcc3f1-9827-fe65-3058-404b2831d9e6", appendix: 0, }, arch: Amd64, has_line_info: true, has_file_info: true, functions: 1838, } "###); Ok(()) }
rust_cleaned_test_functions.jsonl/84088
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 309 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9165, 8757, 77463, 368, 1464, 5714, 68843, 4600, 29, 341, 262, 1077, 4147, 284, 10906, 851, 486, 2508, 94886, 445, 14210, 2899, 81, 988, 7883, 2761, 37445, 262, 1077, 1633, 284, 3002, 486, 6400, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_custom_state() { fn hash<T: Hash>(t: &T) -> u64 { let mut c = CustomHasher { output: 0 }; t.hash(&mut c); c.finish() } assert_eq!(hash(&Custom { hash: 5 }), 5); }
rust_cleaned_test_functions.jsonl/42838
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 114 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15875, 4387, 368, 341, 262, 5168, 5175, 3125, 25, 6531, 2235, 83, 25, 609, 51, 8, 1464, 575, 21, 19, 341, 286, 1077, 5206, 272, 284, 8406, 6370, 261, 314, 2550, 25, 220, 15, 2605, 286, 259, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dashmap_secondary_index_same_slot_and_forks() { let (key_start, key_end, account_index) = create_dashmap_secondary_index_state(); let index = AccountsIndex::<bool>::default_for_tests(); run_test_secondary_indexes_same_slot_and_forks( &index, &index.spl_token_mint_index, key_start, key_end, &account_index, ); }
rust_cleaned_test_functions.jsonl/99742
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 216 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84585, 2186, 77759, 3560, 33574, 27563, 8378, 761, 73302, 368, 341, 286, 1077, 320, 792, 4906, 11, 1376, 6213, 11, 2692, 3560, 8, 284, 1855, 84585, 2186, 77759, 3560, 4387, 543, 286, 1077, 1922, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_check_unique_pubkeys() { let pubkey0 = Pubkey::new_rand(); let pubkey_clone = pubkey0; let pubkey1 = Pubkey::new_rand(); check_unique_pubkeys((&pubkey0, "foo".to_string()), (&pubkey1, "bar".to_string())) .expect("unexpected result"); check_unique_pubkeys((&pubkey0, "foo".to_string()), (&pubkey1, "foo".to_string())) .expect("unexpected result"); assert!(check_unique_pubkeys( (&pubkey0, "foo".to_string()), (&pubkey_clone, "bar".to_string()) ) .is_err()); }
rust_cleaned_test_functions.jsonl/38828
{ "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, 7200, 21218, 34014, 10563, 368, 341, 286, 1077, 95116, 15, 284, 22611, 792, 486, 931, 33864, 543, 286, 1077, 95116, 54742, 284, 95116, 15, 280, 286, 1077, 95116, 16, 284, 22611, 792, 486, 931, 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_parse() { let mut buf = &hdr_prefix_to_bytes(new_hdr_prefix())[..]; let segment = buf .parse_with::<_, TcpSegment<_>>(TcpParseArgs::new(TEST_SRC_IPV4, TEST_DST_IPV4)) .unwrap(); assert_eq!(segment.src_port().get(), 1); assert_eq!(segment.dst_port().get(), 2); assert_eq!(segment.body(), []); }
rust_cleaned_test_functions.jsonl/32083
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 206 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 368, 341, 286, 1077, 5206, 6607, 284, 609, 28785, 13974, 2346, 12524, 1755, 28238, 13974, 66600, 496, 935, 286, 1077, 10238, 284, 6607, 198, 310, 659, 6400, 6615, 27638, 6878, 64876, 21086, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_account() { let cycles_limit = 1024 * 1024 * 1024; let caller = Address::from_hex("0x755cdba6ae4f479f7164792b318b2a06c759833b").unwrap(); let context = mock_context(cycles_limit, caller); let tx_hash = context.get_tx_hash().unwrap(); let mut service = new_multi_signature_service(); let owner = gen_one_keypair(); let owner_address = Address::from_pubkey_bytes(owner.1.clone()).unwrap(); let keypairs = gen_keypairs(15); let mut account_pubkeys = keypairs .iter() .map(|pair| to_multi_sig_account(pair.1.clone())) .collect::<Vec<_>>(); let multi_sig_address = service .generate_account(context.clone(), GenerateMultiSigAccountPayload { owner: owner_address.clone(), addr_with_weight: account_pubkeys.clone(), threshold: 3, memo: String::new(), }) .succeed_data .address; // test add new account success let new_keypair = gen_one_keypair(); account_pubkeys.push(to_multi_sig_account(new_keypair.1.clone())); let res = service.add_account(context.clone(), AddAccountPayload { witness: gen_single_witness(&owner.0, &tx_hash), multi_sig_address: multi_sig_address.clone(), new_account: to_multi_sig_account(new_keypair.1).into_signle_account(), }); assert_eq!(res.error_message, "".to_owned()); // test add new account success above max count value let new_keypair = gen_one_keypair(); let res = service.add_account(context.clone(), AddAccountPayload { witness: gen_single_witness(&owner.0, &tx_hash), multi_sig_address: multi_sig_address.clone(), new_account: to_multi_sig_account(new_keypair.1).into_signle_account(), }); assert_eq!( res.error_message, "the account count reach max value".to_owned() ); // test get permission after add a new account let permission = service.get_account_from_address(context, GetMultiSigAccountPayload { multi_sig_address }); assert_eq!(permission.succeed_data.permission, MultiSigPermission { owner: owner_address, accounts: to_accounts_list(account_pubkeys), threshold: 3, memo: String::new(), }); }
rust_cleaned_test_functions.jsonl/130834
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1021 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 13500, 368, 341, 262, 1077, 24484, 14763, 284, 220, 16, 15, 17, 19, 353, 220, 16, 15, 17, 19, 353, 220, 16, 15, 17, 19, 26, 715, 262, 1077, 19865, 284, 9177, 486, 1499, 32655, 445, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_process_calling_cmdline() { // Github runs CI tests for arm under qemu where where sysinfo can not find the parent process. if std::env::vars().any(|(key, _)| key == "CROSS_RUNNER" || key == "QEMU_LD_PREFIX") { return; } let mut info = ProcInfo::new(); info.refresh_processes(); let mut ppid_distance = Vec::new(); iter_parents(&info, std::process::id() as Pid, |pid, distance| { ppid_distance.push(pid as i32); ppid_distance.push(distance as i32) }); assert!(ppid_distance[1] == 1); fn find_calling_process(args: &[String], want: &[&str]) -> ProcessArgs<()> { if args.iter().any(|have| want.iter().any(|want| want == have)) { ProcessArgs::Args(()) } else { ProcessArgs::ArgError } } // Tests that caller is something like "cargo test" or "cargo tarpaulin" let find_test = |args: &[String]| find_calling_process(args, &["test", "tarpaulin"]); assert_eq!(calling_process_cmdline(info, find_test), Some(())); let nonsense = ppid_distance .iter() .map(|i| i.to_string()) .join("Y40ii4RihK6lHiK4BDsGSx"); let find_nothing = |args: &[String]| find_calling_process(args, &[&nonsense]); assert_eq!(calling_process_cmdline(ProcInfo::new(), find_nothing), None); }
rust_cleaned_test_functions.jsonl/95009
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 692 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11305, 13429, 287, 11684, 1056, 368, 341, 286, 442, 48923, 8473, 20694, 7032, 369, 6773, 1212, 85108, 1380, 1380, 5708, 2733, 646, 537, 1477, 279, 2681, 1882, 624, 286, 421, 1460, 486, 3160, 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...
2
#[test] fn test_box_slice_clone() { let data = String::from("hello HELLO hello HELLO yes YES 5 中ä华!!!"); let data2 = data.clone().into_boxed_str().clone().into_string(); assert_eq!(data, data2); }
rust_cleaned_test_functions.jsonl/17661
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 90 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10194, 26488, 54742, 368, 341, 262, 1077, 821, 284, 923, 486, 1499, 445, 14990, 37657, 1593, 23811, 37657, 1593, 9834, 14080, 220, 20, 72858, 2305, 85361, 2928, 11142, 262, 1077, 821, 17, 284, 821...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_divsd() { assert_emit!(0xf2, 0x0f, 0x5e, 0xc1; divsd(XMM0, XMM1)); assert_emit!(0xf2, 0x41, 0x0f, 0x5e, 0xdf; divsd(XMM3, XMM15)); assert_emit!(0xf2, 0x44, 0x0f, 0x5e, 0xc4; divsd(XMM8, XMM4)); }
rust_cleaned_test_functions.jsonl/85493
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 160 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16237, 13446, 368, 341, 286, 2060, 69082, 10297, 15, 5848, 17, 11, 220, 15, 87, 15, 69, 11, 220, 15, 87, 20, 68, 11, 220, 15, 8148, 16, 26, 3429, 13446, 7644, 8035, 15, 11, 1599, 8035, 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
#[test] fn test_one_topic() { let translator = super::DydxCommandTranslator {}; let commands = translator.translate_to_commands( true, &vec![("v3_trades".to_string(), "BTC-USD".to_string())], ); assert_eq!(1, commands.len()); assert_eq!( r#"{"type": "subscribe", "channel": "v3_trades", "id": "BTC-USD"}"#, commands[0] ); }
rust_cleaned_test_functions.jsonl/90379
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 226 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11667, 31414, 368, 341, 286, 1077, 45488, 284, 2256, 486, 35, 88, 12719, 4062, 51653, 9321, 286, 1077, 11293, 284, 45488, 25909, 2346, 44151, 1006, 310, 830, 345, 310, 609, 4083, 20703, 445, 85, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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() { let p = Point1::new(27.6189); let v = Vector1::new(258.083); let expected = Point1::new(p.x + v.x); let result = p + v; assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/4521
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 120 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 680, 368, 341, 286, 1077, 281, 284, 5126, 16, 486, 931, 7, 17, 22, 13, 21, 16, 23, 24, 317, 286, 1077, 348, 284, 4196, 16, 486, 931, 7, 17, 20, 23, 13, 15, 23, 18, 317, 286, 1077...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_default_remote() { let td = TempDir::new().unwrap(); debug_cmd_print( td.path().as_os_str().to_str().unwrap(), "git clone https://github.com/extrawurst/brewdump.git", ); debug_cmd_print( td.path().as_os_str().to_str().unwrap(), "cd brewdump && git remote add second https://github.com/extrawurst/brewdump.git", ); let repo_path = td.path().join("brewdump"); let repo_path = repo_path.as_os_str().to_str().unwrap(); let remotes = get_remotes(repo_path).unwrap(); assert_eq!( remotes, vec![String::from("origin"), String::from("second")] ); let first = get_default_remote_in_repo( &utils::repo(repo_path).unwrap(), ) .unwrap(); assert_eq!(first, String::from("origin")); }
rust_cleaned_test_functions.jsonl/41124
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 446 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9993, 36425, 368, 341, 286, 1077, 17941, 284, 19944, 6184, 486, 931, 1005, 15454, 1428, 286, 7390, 11684, 10064, 1006, 310, 17941, 3875, 1005, 300, 29387, 2895, 1005, 983, 2895, 1005, 15454, 3148, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_child_slots_of_same_parent() { let ledger_path = get_tmp_ledger_path!(); { let blocktree = Arc::new( Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger"), ); let genesis_block = create_genesis_block(10_000).genesis_block; let bank0 = Bank::new(&genesis_block); let leader_schedule_cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank0)); let mut bank_forks = BankForks::new(0, bank0); bank_forks.working_bank().freeze(); let (shreds, _) = make_slot_entries(1, 0, 8); blocktree.insert_shreds(shreds, None).unwrap(); assert!(bank_forks.get(1).is_none()); ReplayStage::generate_new_bank_forks( &blocktree, &mut bank_forks, &leader_schedule_cache, ); assert!(bank_forks.get(1).is_some()); let (shreds, _) = make_slot_entries(2, 0, 8); blocktree.insert_shreds(shreds, None).unwrap(); assert!(bank_forks.get(2).is_none()); ReplayStage::generate_new_bank_forks( &blocktree, &mut bank_forks, &leader_schedule_cache, ); assert!(bank_forks.get(1).is_some()); assert!(bank_forks.get(2).is_some()); } let _ignored = remove_dir_all(&ledger_path); }
rust_cleaned_test_functions.jsonl/43051
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 822 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17268, 54161, 3575, 33574, 15960, 368, 341, 286, 1077, 46933, 2638, 284, 633, 16125, 38367, 1389, 2638, 0, 543, 286, 341, 310, 1077, 2504, 9344, 284, 19689, 486, 931, 1006, 394, 8362, 9344, 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_if() { let query = Query::from(If::cond(true, "is true", "is false")); let serialized = serde_json::to_value(&query).unwrap(); let expected = json!({ "if": true, "then": "is true", "else": "is false", }); assert_eq!(expected, serialized); }
rust_cleaned_test_functions.jsonl/49623
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 174 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11119, 368, 341, 286, 1077, 3239, 284, 11361, 486, 1499, 7, 2679, 486, 1297, 3715, 11, 330, 285, 830, 497, 330, 285, 895, 4010, 286, 1077, 32916, 284, 61570, 9455, 486, 983, 3142, 2099, 1631, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_multisig() { solana_logger::setup(); let tx = test_multisig_tx(); let mut packet = sigverify::make_packet_from_transaction(tx); let n = 4; let num_batches = 3; let mut batches = generate_packet_vec(&packet, n, num_batches); packet.data[40] = packet.data[40].wrapping_add(8); batches[0].packets.push(packet); let recycler = Recycler::default(); let recycler_out = Recycler::default(); // verify packets let ans = sigverify::ed25519_verify(&batches, &recycler, &recycler_out); // check result let ref_ans = 1u8; let mut ref_vec = vec![vec![ref_ans; n]; num_batches]; ref_vec[0].push(0u8); assert_eq!(ans, ref_vec); }
rust_cleaned_test_functions.jsonl/73482
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 380 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35638, 26290, 285, 343, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 1428, 286, 1077, 9854, 284, 1273, 26290, 285, 343, 17805, 543, 286, 1077, 5206, 10151, 284, 8366, 12446, 486, 6927, 21078, 567...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_key_derivation_timer() { let mut clock = Clock::default(); let now = clock.get_time(); let mut keyset = KeySet::new(TestKey::default(), Default::default()); keyset.rotate_phase(); keyset.set_derivation_timer(now + Duration::from_millis(10)); clock.inc_by(Duration::from_millis(8)); keyset.on_timeout(clock.get_time()); //= type=test //# An endpoint SHOULD //# retain old keys for some time after unprotecting a packet sent using //# the new keys. assert_eq!(keyset.crypto[KeyPhase::Zero].key().derivations, 0); clock.inc_by(Duration::from_millis(8)); keyset.on_timeout(clock.get_time()); //= type=test //# SHOULD be discarded. assert_eq!(keyset.crypto[KeyPhase::Zero].key().derivations, 2); }
rust_cleaned_test_functions.jsonl/61044
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 402 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3097, 35345, 39127, 16255, 368, 341, 286, 1077, 5206, 8866, 284, 26142, 486, 2258, 543, 286, 1077, 1431, 284, 8866, 670, 3009, 543, 286, 1077, 5206, 1376, 746, 284, 5309, 1649, 486, 931, 31159, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1