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_shorten_ray_top() {
let rect = Rect::new(2, 3, 2, 2);
let mut segment = Segment {
point: (3., 0.),
vector: Vector2D { x: 0., y: 4. },
};
let side = shorten_ray(&mut segment, &rect);
assert_eq!(side, Some(CollisionSide::Top));
assert_eq!(
segment,
Segment {
point: (3., 0.),
vector: Vector2D { x: 0., y: 3. },
}
);
} | rust_cleaned_test_functions.jsonl/110315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
268,
72690,
10426,
368,
341,
286,
1077,
7608,
284,
11920,
486,
931,
7,
17,
11,
220,
18,
11,
220,
17,
11,
220,
17,
317,
286,
1077,
5206,
10238,
284,
37103,
341,
310,
1459,
25,
320,
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_vec4mask_and() {
assert_eq!(
(Vec4Mask::new(false, false, false, false) & Vec4Mask::new(false, false, false, false))
.bitmask(),
0b0000,
);
assert_eq!(
(Vec4Mask::new(true, true, true, true) & Vec4Mask::new(true, true, true, true)).bitmask(),
0b1111,
);
assert_eq!(
(Vec4Mask::new(true, false, true, false) & Vec4Mask::new(false, true, false, true))
.bitmask(),
0b0000,
);
assert_eq!(
(Vec4Mask::new(true, false, true, true) & Vec4Mask::new(true, true, true, false)).bitmask(),
0b0101,
);
let mut mask = Vec4Mask::new(true, true, false, false);
mask &= Vec4Mask::new(true, false, true, false);
assert_eq!(mask.bitmask(), 0b0001);
} | rust_cleaned_test_functions.jsonl/68877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
19,
11258,
8378,
368,
341,
262,
2060,
10714,
33673,
286,
320,
10050,
19,
12686,
486,
931,
3576,
11,
895,
11,
895,
11,
895,
8,
609,
11312,
19,
12686,
486,
931,
3576,
11,
895,
11,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_literals() {
assert_has_variable!(interpret("X = 3.14"), "X!", 3.14_f32);
assert_has_variable!(interpret("X# = 3.14"), "X#", 3.14);
assert_has_variable!(interpret("X$ = \"hello\""), "X$", "hello");
assert_has_variable!(interpret("X% = 42"), "X%", 42);
assert_has_variable!(interpret("X& = 42"), "X&", 42_i64);
} | rust_cleaned_test_functions.jsonl/22644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49643,
368,
341,
286,
2060,
21778,
14635,
10297,
16897,
445,
55,
284,
220,
18,
13,
16,
19,
3975,
330,
55,
18789,
220,
18,
13,
16,
19,
761,
18,
17,
317,
286,
2060,
21778,
14635,
10297,
16897,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_system_account_kind_uninitialized_nonce_account_fail() {
assert_eq!(
get_system_account_kind(&nonce_account::create_account(42).borrow()),
None
);
} | rust_cleaned_test_functions.jsonl/73079 | {
"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,
3062,
17687,
13500,
33162,
4907,
36161,
48508,
13500,
22121,
368,
341,
286,
2060,
10714,
33673,
310,
633,
17687,
13500,
33162,
2099,
39593,
13500,
486,
3182,
13500,
7,
19,
17,
568,
71141,
14702,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vhost_user_activate() {
use vmm_vhost::{
connection::socket::{Endpoint as SocketEndpoint, Listener as SocketListener},
SlaveListener,
};
const QUEUES_NUM: usize = 2;
let dir = temp_dir();
let mut path = dir.path().to_owned();
path.push("sock");
let listener = SocketListener::new(&path, true).unwrap();
let vmm_bar = Arc::new(Barrier::new(2));
let dev_bar = vmm_bar.clone();
let (tx, rx) = channel();
std::thread::spawn(move || {
// VMM side
rx.recv().unwrap(); // Ensure the device is ready.
let allow_features = VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
let init_features = VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
let allow_protocol_features = VhostUserProtocolFeatures::CONFIG;
let mut vmm_handler = VhostUserHandler::new_from_path(
&path,
QUEUES_NUM as u64,
allow_features,
init_features,
allow_protocol_features,
)
.unwrap();
vmm_handler_send_requests(&mut vmm_handler, QUEUES_NUM);
// The VMM side is supposed to stop before the device side.
drop(vmm_handler);
vmm_bar.wait();
});
// Device side
let handler = Arc::new(std::sync::Mutex::new(DeviceRequestHandler::new(
FakeBackend::new(),
)));
let mut listener = SlaveListener::<SocketEndpoint<_>, _>::new(listener, handler).unwrap();
// Notify listener is ready.
tx.send(()).unwrap();
let mut listener = listener.accept().unwrap().unwrap();
test_handle_requests(&mut listener, QUEUES_NUM);
dev_bar.wait();
match listener.handle_request() {
Err(VhostError::ClientExit) => (),
r => panic!("Err(ClientExit) was expected but {:?}", r),
}
} | rust_cleaned_test_functions.jsonl/111009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 963
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
3790,
3317,
67894,
368,
341,
286,
990,
348,
3821,
2273,
3790,
74843,
310,
3633,
486,
9556,
22964,
27380,
438,
20954,
27380,
11,
47999,
438,
20954,
2743,
1583,
310,
59368,
2743,
345,
286,
363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_shutdown_initiate_immediate_shutdown() {
let (tx_initiate_shutdown, rx_initiate_shutdown) = oneshot::channel();
let (tx_shutdown_event, rx_shutdown_event) = oneshot::channel();
let mut shutdown = ShutdownHandler::new(rx_initiate_shutdown, tx_shutdown_event);
assert_eq!(shutdown.state(), ShutdownState::Running);
tx_initiate_shutdown.send(ShutdownType::Immediate).unwrap();
assert!(current_thread::block_on_all(&mut shutdown).is_ok());
assert!(current_thread::block_on_all(rx_shutdown_event).is_ok());
assert_eq!(shutdown.state(), ShutdownState::Shutdown);
} | rust_cleaned_test_functions.jsonl/36425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54804,
6137,
6493,
17895,
14636,
54804,
368,
341,
286,
1077,
320,
3998,
6137,
6493,
54804,
11,
19111,
6137,
6493,
54804,
8,
284,
389,
4288,
354,
486,
10119,
543,
286,
1077,
320,
3998,
54804,
6748,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hamming_dist() {
let s1 = b"this is a test";
let s2 = b"wokka wokka!!!";
let dist = 37;
match hamming_dist_bits(s1,s2) {
Ok(d) => {
println!("d = {}",d);
assert!(d == dist);
},
_ => assert!(false),
}
} | rust_cleaned_test_functions.jsonl/105360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
309,
5311,
16031,
368,
341,
262,
1077,
274,
16,
284,
293,
1,
574,
374,
264,
1273,
876,
262,
1077,
274,
17,
284,
293,
80377,
562,
4554,
289,
562,
4554,
12069,
876,
262,
1077,
1582,
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_parse_customer() {
assert!("cus_123".parse::<CustomerId>().is_ok());
let bad_parse = "zzz_123".parse::<CustomerId>();
assert!(bad_parse.is_err());
if let Err(err) = bad_parse {
assert_eq!(
format!("{}", err),
"invalid `CustomerId`, expected id to start with \"cus_\""
);
}
} | rust_cleaned_test_functions.jsonl/85300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
28840,
368,
341,
286,
2060,
17223,
56340,
62,
16,
17,
18,
3263,
6400,
27638,
95485,
10483,
285,
19817,
1423,
286,
1077,
3873,
21039,
284,
330,
10400,
89,
62,
16,
17,
18,
3263,
6400,
27638... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expand_to_item_list() {
let rules = create_rules(
"
macro_rules! structs {
($($i:ident),*) => {
$(struct $i { field: u32 } )*
}
}
",
);
let expansion = expand(&rules, "structs!(Foo, Bar);");
let tree = token_tree_to_macro_items(&expansion);
assert_eq!(
tree.unwrap().syntax().debug_dump().trim(),
r#"
MACRO_ITEMS@[0; 40)
STRUCT_DEF@[0; 20)
STRUCT_KW@[0; 6) "struct"
NAME@[6; 9)
IDENT@[6; 9) "Foo"
NAMED_FIELD_DEF_LIST@[9; 20)
L_CURLY@[9; 10) "{"
NAMED_FIELD_DEF@[10; 19)
NAME@[10; 15)
IDENT@[10; 15) "field"
COLON@[15; 16) ":"
PATH_TYPE@[16; 19)
PATH@[16; 19)
PATH_SEGMENT@[16; 19)
NAME_REF@[16; 19)
IDENT@[16; 19) "u32"
R_CURLY@[19; 20) "}"
STRUCT_DEF@[20; 40)
STRUCT_KW@[20; 26) "struct"
NAME@[26; 29)
IDENT@[26; 29) "Bar"
NAMED_FIELD_DEF_LIST@[29; 40)
L_CURLY@[29; 30) "{"
NAMED_FIELD_DEF@[30; 39)
NAME@[30; 35)
IDENT@[30; 35) "field"
COLON@[35; 36) ":"
PATH_TYPE@[36; 39)
PATH@[36; 39)
PATH_SEGMENT@[36; 39)
NAME_REF@[36; 39)
IDENT@[36; 39) "u32"
R_CURLY@[39; 40) "}""#
.trim()
);
} | rust_cleaned_test_functions.jsonl/85774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 884
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
2346,
5634,
2019,
368,
341,
262,
1077,
5601,
284,
1855,
21407,
1006,
286,
6228,
310,
18072,
21407,
0,
62845,
341,
394,
1711,
699,
72,
25,
1713,
701,
3764,
589,
341,
503,
4930,
1235,
400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_div() {
let a = Vec1::new(4.0) / 2.0;
assert_eq!(a.x, 2.0);
let b = 4.0f64 / Vec1::new(2.0); // TODO: Why is the f64 needed?
assert_eq!(b.x, 2.0);
} | rust_cleaned_test_functions.jsonl/29308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
368,
341,
310,
1077,
264,
284,
11312,
16,
486,
931,
7,
19,
13,
15,
8,
608,
220,
17,
13,
15,
280,
310,
2060,
10714,
10297,
64,
1993,
11,
220,
17,
13,
15,
317,
310,
1077,
293,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_layout() {
let tx = test_tx();
let tx_bytes = serialize(&tx).unwrap();
let packet = serialize(&tx).unwrap();
assert_matches!(memfind(&packet, &tx_bytes), Some(0));
assert_matches!(memfind(&packet, &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), None);
} | rust_cleaned_test_functions.jsonl/22070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14466,
368,
341,
286,
1077,
9854,
284,
1273,
17805,
543,
286,
1077,
9854,
12524,
284,
24235,
2099,
3998,
568,
15454,
543,
286,
1077,
10151,
284,
24235,
2099,
3998,
568,
15454,
543,
286,
2060,
3834... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mhdr_mtype() {
let examples = [
(0x00, MType::JoinRequest),
(0x20, MType::JoinAccept),
(0x40, MType::UnconfirmedDataUp),
(0x60, MType::UnconfirmedDataDown),
(0x80, MType::ConfirmedDataUp),
(0xa0, MType::ConfirmedDataDown),
(0xc0, MType::RFU),
(0xe0, MType::Proprietary),
];
for &(ref v, ref expected) in &examples {
let mhdr = MHDR::new(*v);
assert_eq!(mhdr.mtype(), *expected);
}
} | rust_cleaned_test_functions.jsonl/81585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
28785,
717,
1313,
368,
341,
262,
1077,
10295,
284,
2278,
286,
320,
15,
87,
15,
15,
11,
386,
929,
486,
12292,
1900,
1326,
286,
320,
15,
87,
17,
15,
11,
386,
929,
486,
12292,
16646,
1326,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bit_extract_long() {
let a = bits::<48>(0xabcd_dead_cafe_babe);
let b: Bits<44> = a.get_bits(4);
assert_eq!(b, bits::<44>(0xabcd_dead_cafe_bab));
let b: Bits<32> = a.get_bits(16);
assert_eq!(b, bits::<32>(0xdead_cafe));
} | rust_cleaned_test_functions.jsonl/75136 | {
"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,
13996,
39123,
17799,
368,
341,
286,
1077,
264,
284,
9472,
27638,
19,
23,
2235,
15,
52616,
4385,
53427,
666,
5645,
880,
8229,
317,
286,
1077,
293,
25,
49457,
27,
19,
19,
29,
284,
264,
670,
2003... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spill1() {
VM::start_logging_trace();
let vm = Arc::new(create_spill1());
let compiler = Compiler::new(CompilerPolicy::default(), &vm);
let func_id = vm.id_of("spill1");
{
let funcs = vm.funcs().read().unwrap();
let func = funcs.get(&func_id).unwrap().read().unwrap();
let func_vers = vm.func_vers().read().unwrap();
let mut func_ver = func_vers
.get(&func.cur_ver.unwrap())
.unwrap()
.write()
.unwrap();
compiler.compile(&mut func_ver);
}
backend::emit_context(&vm);
let dylib = aot::link_dylib(
vec![Mu("spill1")],
&linkutils::get_dylib_name("spill1"),
&vm
);
let lib = libloading::Library::new(dylib.as_os_str()).unwrap();
unsafe {
let spill1: libloading::Symbol<unsafe extern "C" fn() -> u64> = match lib.get(b"spill1") {
Ok(symbol) => symbol,
Err(e) => panic!("cannot find symbol spill1 in dylib: {:?}", e)
};
}
} | rust_cleaned_test_functions.jsonl/133331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
483,
16,
368,
341,
262,
17792,
486,
2468,
59982,
23575,
1428,
262,
1077,
10995,
284,
19689,
486,
931,
32602,
10123,
483,
16,
5231,
262,
1077,
19415,
284,
45631,
486,
931,
7,
38406,
13825,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serialize_parameters() {
let program_id = analog_sdk::pubkey::new_rand();
let dup_key = analog_sdk::pubkey::new_rand();
let dup_key2 = analog_sdk::pubkey::new_rand();
let keyed_accounts = [
(
false,
false,
program_id,
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 0,
data: vec![],
owner: bpf_loader::id(),
executable: true,
rent_epoch: 0,
}))),
),
(
false,
false,
dup_key,
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 1,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
}))),
),
(
false,
false,
dup_key,
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 1,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
}))),
),
(
false,
false,
analog_sdk::pubkey::new_rand(),
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 2,
data: vec![11u8, 12, 13, 14, 15, 16, 17, 18, 19],
owner: bpf_loader::id(),
executable: true,
rent_epoch: 200,
}))),
),
(
false,
false,
analog_sdk::pubkey::new_rand(),
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 3,
data: vec![],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 3100,
}))),
),
(
false,
true,
dup_key2,
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 4,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
}))),
),
(
false,
true,
dup_key2,
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 4,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
}))),
),
(
false,
true,
analog_sdk::pubkey::new_rand(),
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 5,
data: vec![11u8, 12, 13, 14, 15, 16, 17, 18, 19],
owner: bpf_loader::id(),
executable: true,
rent_epoch: 200,
}))),
),
(
false,
true,
analog_sdk::pubkey::new_rand(),
Rc::new(RefCell::new(AccountSharedData::from(Account {
tock: 6,
data: vec![],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 3100,
}))),
),
];
let instruction_data = vec![1u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
let program_indices = [0];
let preparation =
prepare_mock_invoke_context(&program_indices, &instruction_data, &keyed_accounts);
let mut invoke_context = ThisInvokeContext::new_mock(&preparation.accounts, &[]);
invoke_context
.push(
&preparation.message,
&preparation.message.instructions[0],
&program_indices,
Some(&preparation.account_indices),
)
.unwrap();
// check serialize_parameters_aligned
let ser_keyed_accounts = invoke_context.get_keyed_accounts().unwrap();
let (mut serialized, account_lengths) = serialize_parameters(
&bpf_loader::id(),
&program_id,
&ser_keyed_accounts[1..],
&instruction_data,
)
.unwrap();
let (de_program_id, de_accounts, de_instruction_data) =
unsafe { deserialize(&mut serialized.as_slice_mut()[0] as *mut u8) };
assert_eq!(&program_id, de_program_id);
assert_eq!(instruction_data, de_instruction_data);
assert_eq!(
(&de_instruction_data[0] as *const u8).align_offset(align_of::<u128>()),
0
);
for ((_, _, key, account), account_info) in keyed_accounts.iter().skip(1).zip(de_accounts) {
assert_eq!(key, account_info.key);
let account = account.borrow();
assert_eq!(account.tock(), account_info.tock());
assert_eq!(account.data(), &account_info.data.borrow()[..]);
assert_eq!(account.owner(), account_info.owner);
assert_eq!(account.executable(), account_info.executable);
assert_eq!(account.rent_epoch(), account_info.rent_epoch);
assert_eq!(
(*account_info.tock.borrow() as *const u64).align_offset(align_of::<u64>()),
0
);
assert_eq!(
account_info
.data
.borrow()
.as_ptr()
.align_offset(align_of::<u128>()),
0
);
}
let de_keyed_accounts = invoke_context.get_keyed_accounts().unwrap();
deserialize_parameters(
&bpf_loader::id(),
&de_keyed_accounts[1..],
serialized.as_slice(),
&account_lengths,
true,
)
.unwrap();
for ((_, _, key, account), de_keyed_account) in keyed_accounts.iter().zip(de_keyed_accounts)
{
assert_eq!(key, de_keyed_account.unsigned_key());
let account = account.borrow();
assert_eq!(account.executable(), de_keyed_account.executable().unwrap());
assert_eq!(account.rent_epoch(), de_keyed_account.rent_epoch().unwrap());
}
// check serialize_parameters_unaligned
let ser_keyed_accounts = invoke_context.get_keyed_accounts().unwrap();
let (mut serialized, account_lengths) = serialize_parameters(
&bpf_loader_deprecated::id(),
&program_id,
&ser_keyed_accounts[1..],
&instruction_data,
)
.unwrap();
let (de_program_id, de_accounts, de_instruction_data) =
unsafe { deserialize_unaligned(&mut serialized.as_slice_mut()[0] as *mut u8) };
assert_eq!(&program_id, de_program_id);
assert_eq!(instruction_data, de_instruction_data);
for ((_, _, key, account), account_info) in keyed_accounts.iter().skip(1).zip(de_accounts) {
assert_eq!(key, account_info.key);
let account = account.borrow();
assert_eq!(account.tock(), account_info.tock());
assert_eq!(account.data(), &account_info.data.borrow()[..]);
assert_eq!(account.owner(), account_info.owner);
assert_eq!(account.executable(), account_info.executable);
assert_eq!(account.rent_epoch(), account_info.rent_epoch);
}
let de_keyed_accounts = invoke_context.get_keyed_accounts().unwrap();
deserialize_parameters(
&bpf_loader_deprecated::id(),
&de_keyed_accounts[1..],
serialized.as_slice(),
&account_lengths,
true,
)
.unwrap();
for ((_, _, key, account), de_keyed_account) in keyed_accounts.iter().zip(de_keyed_accounts)
{
assert_eq!(key, de_keyed_account.unsigned_key());
let account = account.borrow();
assert_eq!(account.tock(), de_keyed_account.tock().unwrap());
assert_eq!(
account.data(),
de_keyed_account.try_account_ref().unwrap().data()
);
assert_eq!(*account.owner(), de_keyed_account.owner().unwrap());
assert_eq!(account.executable(), de_keyed_account.executable().unwrap());
assert_eq!(account.rent_epoch(), de_keyed_account.rent_epoch().unwrap());
}
} | rust_cleaned_test_functions.jsonl/35196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
18263,
368,
341,
286,
1077,
2025,
842,
284,
23400,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
22737,
3097,
284,
23400,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_sort_utf8() {
let ca = Utf8Chunked::new("a", &[Some("a"), None, Some("c"), None, Some("b")]);
let out = ca.sort_with(SortOptions {
descending: false,
nulls_last: false,
});
let expected = &[None, None, Some("a"), Some("b"), Some("c")];
assert_eq!(Vec::from(&out), expected);
let out = ca.sort_with(SortOptions {
descending: true,
nulls_last: false,
});
let expected = &[None, None, Some("c"), Some("b"), Some("a")];
assert_eq!(Vec::from(&out), expected);
let out = ca.sort_with(SortOptions {
descending: false,
nulls_last: true,
});
let expected = &[Some("a"), Some("b"), Some("c"), None, None];
assert_eq!(Vec::from(&out), expected);
let out = ca.sort_with(SortOptions {
descending: true,
nulls_last: true,
});
let expected = &[Some("c"), Some("b"), Some("a"), None, None];
assert_eq!(Vec::from(&out), expected);
// no nulls
let ca = Utf8Chunked::new("a", &[Some("a"), Some("c"), Some("b")]);
let out = ca.sort(false);
let expected = &[Some("a"), Some("b"), Some("c")];
assert_eq!(Vec::from(&out), expected);
let out = ca.sort(true);
let expected = &[Some("c"), Some("b"), Some("a")];
assert_eq!(Vec::from(&out), expected);
} | rust_cleaned_test_functions.jsonl/16391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
39453,
23,
368,
341,
286,
1077,
2162,
284,
43432,
23,
28304,
291,
486,
931,
445,
64,
497,
44590,
8373,
445,
64,
3975,
2240,
11,
4329,
445,
66,
3975,
2240,
11,
4329,
445,
65,
899,
2558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wasi_get_wasi_version_invalid() {
(assert_c! {
#include "tests/wasmer.h"
int main() {
wasm_engine_t* engine = wasm_engine_new();
wasm_store_t* store = wasm_store_new(engine);
wasm_byte_vec_t wat;
wasmer_byte_vec_new_from_string(&wat, "(module (import \"wasi_snpsht_prvw1\" \"args_get\" (func (param i32 i32) (result i32))))");
wasm_byte_vec_t wasm;
wat2wasm(&wat, &wasm);
wasm_module_t* module = wasm_module_new(store, &wasm);
assert(module);
assert(wasi_get_wasi_version(module) == INVALID_VERSION);
wasm_module_delete(module);
wasm_byte_vec_delete(&wasm);
wasm_byte_vec_delete(&wat);
wasm_store_delete(store);
wasm_engine_delete(engine);
return 0;
}
})
.success();
} | rust_cleaned_test_functions.jsonl/86304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
10215,
3062,
1670,
10215,
9438,
31433,
368,
341,
286,
320,
2207,
666,
0,
341,
310,
671,
997,
330,
23841,
6324,
300,
1174,
860,
1837,
310,
526,
1887,
368,
341,
394,
98263,
24823,
528,
9,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatch_with_discover_available_requested_addr_returns_requested_addr() {
let mut disc = new_test_discover();
disc.options.push(ConfigOption {
code: OptionCode::RequestedIpAddr,
value: vec![192, 168, 1, 3],
});
let mut server = new_test_server(|| 42);
server
.pool
.available_addrs
.insert(Ipv4Addr::new(192, 168, 1, 2));
server
.pool
.available_addrs
.insert(Ipv4Addr::new(192, 168, 1, 3));
let got = server.dispatch(disc).unwrap();
let mut want = new_test_offer();
want.yiaddr = Ipv4Addr::new(192, 168, 1, 3);
assert_eq!(got, want);
} | rust_cleaned_test_functions.jsonl/61717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
6615,
9932,
3688,
26962,
72709,
7387,
58900,
72709,
7387,
368,
341,
286,
1077,
5206,
2560,
284,
501,
4452,
9932,
3688,
543,
286,
2560,
10912,
2552,
33687,
5341,
341,
310,
2038,
25,
6959,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_issue29() {
for w in 2..9 {
let mut vec = BitEnc::with_capacity(w, 1000);
for i in 0..1000 {
println!("Push {}", i);
vec.push(1);
}
}
} | rust_cleaned_test_functions.jsonl/17103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
17,
24,
368,
341,
286,
369,
289,
304,
220,
17,
496,
24,
341,
310,
1077,
5206,
7486,
284,
6495,
7408,
486,
4197,
35603,
3622,
11,
220,
16,
15,
15,
15,
317,
310,
369,
600,
304,
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... | 3 |
#[test]
fn test_extend_packed_from_empty() {
let s = " 0\u{80}A\u{0}𐀀 𐀀¡a𐀀0";
let mut compact = CompactString::new(s);
assert!(!compact.is_heap_allocated());
// extend from an empty iterator
compact.extend("".chars());
// we should still be heap allocated
assert!(!compact.is_heap_allocated());
} | rust_cleaned_test_functions.jsonl/2786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
620,
11191,
5673,
15124,
368,
341,
262,
1077,
274,
284,
330,
220,
220,
15,
3770,
90,
23,
15,
92,
32,
3770,
90,
15,
92,
123934,
222,
222,
220,
123934,
222,
222,
39832,
64,
123934,
222,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drain_filter_pred_panic_leak() {
let a = CrashTestDummy::new(0);
let b = CrashTestDummy::new(1);
let c = CrashTestDummy::new(2);
let mut set = BTreeSet::new();
set.insert(a.spawn(Panic::Never));
set.insert(b.spawn(Panic::InQuery));
set.insert(c.spawn(Panic::InQuery));
catch_unwind(AssertUnwindSafe(|| drop(set.drain_filter(|dummy| dummy.query(true))))).ok();
assert_eq!(a.queried(), 1);
assert_eq!(b.queried(), 1);
assert_eq!(c.queried(), 0);
assert_eq!(a.dropped(), 1);
assert_eq!(b.dropped(), 0);
assert_eq!(c.dropped(), 0);
assert_eq!(set.len(), 2);
assert_eq!(set.first().unwrap().id(), 1);
assert_eq!(set.last().unwrap().id(), 2);
} | rust_cleaned_test_functions.jsonl/13748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
8727,
12830,
620,
31270,
11751,
585,
368,
341,
262,
1077,
264,
284,
50335,
2271,
43344,
486,
931,
7,
15,
317,
262,
1077,
293,
284,
50335,
2271,
43344,
486,
931,
7,
16,
317,
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... | 2 |
#[test]
fn test_ease_point_in_quad() {
let start = Point { x: 0.0, y: 0.0 };
let end = Point { x: 1.0, y: 1.0 };
assert_eq!(ease_point(ease_in_quad, start, end, 1.0), end);
} | rust_cleaned_test_functions.jsonl/40070 | {
"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,
2204,
519,
6085,
1243,
68631,
368,
341,
286,
1077,
1191,
284,
5126,
314,
856,
25,
220,
15,
13,
15,
11,
379,
25,
220,
15,
13,
15,
2605,
286,
1077,
835,
284,
5126,
314,
856,
25,
220,
16,
13,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_example() {
let input = r#"
#1 @ 1,3: 4x4
#2 @ 3,1: 4x4
#3 @ 5,5: 2x2
"#;
assert_eq!(4, part1(input).unwrap());
} | rust_cleaned_test_functions.jsonl/131958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
368,
341,
286,
1077,
1946,
284,
435,
2,
698,
2,
16,
569,
220,
16,
11,
18,
25,
220,
19,
87,
19,
198,
2,
17,
569,
220,
18,
11,
16,
25,
220,
19,
87,
19,
198,
2,
18,
569,
220,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hierarchy() {
let mut a = Hierarchy::new();
let root = a.add_root_node(1i32);
let sub1 = a.add_sub_node(root, 8);
let sub2 = a.add_sub_node(root, 9);
let _sub3 = a.add_sub_node(sub1, 11);
assert_eq!(4, a.len());
assert_eq!(Some(&8), a.get(sub1));
assert_eq!(Some(&9), a.get(sub2));
assert_eq!(9, a[sub2]);
assert_eq!(None, a.get(5));
assert_eq!(vec![sub1, root], a.parents(_sub3));
assert_eq!(vec![&1, &8, &9, &11], a.iter().collect::<Vec<&i32>>());
assert_eq!(vec![&8, &9, &11], a.iter_child(root).collect::<Vec<&i32>>());
assert_eq!(vec![&11], a.iter_child(sub1).collect::<Vec<&i32>>());
} | rust_cleaned_test_functions.jsonl/119133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
95043,
368,
341,
286,
1077,
5206,
264,
284,
472,
33880,
486,
931,
543,
286,
1077,
3704,
284,
264,
1364,
12993,
5084,
7,
16,
72,
18,
17,
317,
286,
1077,
1186,
16,
284,
264,
1364,
5228,
5084,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_endpoint_not_async() {
let (_, errors) = do_endpoint(
quote! {
method = GET,
path = "/a/b/c",
},
quote! {
fn handler_xyz(_rqctx: Arc<RequestContext>) {}
},
)
.unwrap();
assert!(!errors.is_empty());
assert_eq!(
errors.get(1).map(ToString::to_string),
Some("endpoint handler functions must be async".to_string())
);
} | rust_cleaned_test_functions.jsonl/39859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36699,
7913,
28346,
368,
341,
286,
1077,
39464,
5975,
8,
284,
653,
36699,
1006,
310,
12641,
0,
341,
394,
1714,
284,
7890,
345,
394,
1815,
284,
3521,
64,
3470,
2899,
756,
310,
1153,
310,
12641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert() {
let text1 = r#"
a
c
"#;
let text2 = r#"
a
b
c
"#;
let diff = line_diff(text1, text2);
assert_eq!(diff.len(), 1);
for item in diff {
println!("{}", item);
}
} | rust_cleaned_test_functions.jsonl/90341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
286,
1077,
1467,
16,
284,
435,
2,
698,
64,
198,
66,
198,
57676,
280,
286,
1077,
1467,
17,
284,
435,
2,
698,
64,
198,
65,
198,
66,
198,
57676,
401,
286,
1077,
3638,
284,
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_op_convert() {
// Doesn't matter for this test.
let encoding = encoding4();
check_op_parse(
|s| s.D8(constants::DW_OP_convert.0).uleb(100),
&Operation::Convert {
base_type: UnitOffset(100),
},
encoding,
);
check_op_parse(
|s| s.D8(constants::DW_OP_GNU_convert.0).uleb(100),
&Operation::Convert {
base_type: UnitOffset(100),
},
encoding,
);
} | rust_cleaned_test_functions.jsonl/45759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
34910,
368,
341,
286,
442,
48832,
944,
4925,
369,
419,
1273,
624,
286,
1077,
11170,
284,
11170,
19,
1428,
286,
1779,
10287,
21039,
1006,
310,
760,
82,
91,
274,
909,
23,
80368,
486,
54219,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_request_exceeds_size() {
let mut codec = build_codec();
let mut buffer = BytesMut::new();
while !buffer.len() <= MAX_HTTP_REQUEST_SIZE {
buffer.put_slice(b"CONNECT foo.bar.com:443 HTTP/1.1\r\n");
}
buffer.put_slice(REQUEST_END_MARKER);
let result = codec.decode(&mut buffer);
assert_eq!(result, Err(EstablishTunnelResult::BadRequest));
} | rust_cleaned_test_functions.jsonl/8077 | {
"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,
7893,
2702,
4635,
82,
2368,
368,
341,
286,
1077,
5206,
34647,
284,
1936,
51084,
543,
286,
1077,
5206,
4147,
284,
30024,
51440,
486,
931,
543,
286,
1393,
753,
7573,
19406,
368,
2651,
8334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_create_float_from_str() {
assert_eq!(Value::Float("2.22507e-308".into()), Value::float_from_str("2.22507e-308").unwrap());
} | rust_cleaned_test_functions.jsonl/86200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
17586,
5673,
2895,
368,
341,
262,
2060,
10714,
10297,
1130,
486,
5442,
445,
17,
13,
17,
17,
20,
15,
22,
68,
12,
18,
15,
23,
3263,
18122,
11858,
5162,
486,
3649,
5673,
2895,
445,
17,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_byte_array_new_with_error() {
use crate::exceptions::PyValueError;
Python::with_gil(|py| {
let py_bytearray_result = PyByteArray::new_with(py, 10, |_b: &mut [u8]| {
Err(PyValueError::new_err("Hello Crustaceans!"))
});
assert!(py_bytearray_result.is_err());
assert!(py_bytearray_result
.err()
.unwrap()
.is_instance::<PyValueError>(py));
})
} | rust_cleaned_test_functions.jsonl/47848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
3858,
5921,
6615,
4096,
368,
341,
286,
990,
17717,
486,
61752,
486,
13828,
1130,
1454,
280,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
4510,
19737,
1653,
5287,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_empty_prefix() {
let (cid, pk, payload) = make_certified_delta(
vec![
make_change(vec![upsert("key1", "value1")]),
make_change(vec![upsert("key2", "value2")]),
],
1..1,
GarbleResponse::LeaveAsIs,
);
match decode_certified_deltas(0, &cid, &pk, &payload[..]) {
Err(CertificationError::InvalidDeltas(_)) => (),
other => panic!("Expected InvalidDeltas error, got {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/122446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
15124,
13974,
368,
341,
262,
1077,
320,
20558,
11,
22458,
11,
7729,
8,
284,
1281,
37097,
1870,
26710,
1006,
286,
7486,
90515,
310,
1281,
15947,
25592,
20703,
454,
6047,
445,
792,
16,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_packet_params() {
// Dummy keys -- we will use the same key for each layer
let user_secret_bytes = randombytes(32);
let mix_secret_bytes = randombytes(32);
let user_secret: curve25519::Scalar =
curve25519::Scalar::from_slice(&user_secret_bytes).unwrap();
let mix_secret: curve25519::Scalar =
curve25519::Scalar::from_slice(&mix_secret_bytes).unwrap();
let mix_public_key = curve25519::scalarmult_base(&mix_secret);
let routing = [0; 32];
let mut params = MixCreationParameters::new(1025);
params.add_outer_layer(32);
params.add_outer_layer(32);
params.add_outer_layer(32);
let mut buf = vec![0; params.total_packet_length()];
let (range0, layer_params0) = params.get_stage_params(0);
let _ = layer_params0
.encode_mix_layer(
&mut buf[range0.clone()],
&user_secret,
&mix_public_key,
&routing[..],
)
.unwrap();
let (range1, layer_params1) = params.get_stage_params(1);
let _ = layer_params1
.encode_mix_layer(
&mut buf[range1.clone()],
&user_secret,
&mix_public_key,
&routing[..],
)
.unwrap();
let (range2, layer_params2) = params.get_stage_params(2);
let _ = layer_params2
.encode_mix_layer(
&mut buf[range2.clone()],
&user_secret,
&mix_public_key,
&routing[..],
)
.unwrap();
assert!(
&buf[params.total_packet_length() - 1025..params.total_packet_length()] != [0; 1025]
);
let _ = layer_params2
.decode_mix_layer(&mut buf[range2], &mix_secret)
.unwrap();
let _ = layer_params1
.decode_mix_layer(&mut buf[range1], &mix_secret)
.unwrap();
let _ = layer_params0
.decode_mix_layer(&mut buf[range0], &mix_secret)
.unwrap();
} | rust_cleaned_test_functions.jsonl/114623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21078,
6745,
368,
341,
286,
442,
50567,
6894,
1177,
582,
686,
990,
279,
1852,
1376,
369,
1817,
6193,
198,
286,
1077,
1196,
21962,
12524,
284,
4194,
9651,
7,
18,
17,
317,
286,
1077,
6514,
21962,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_output_error() {
let Output {status, stdout, stderr}
= Command::new("mkdir").arg(".").output().unwrap();
assert!(status.code() == Some(1));
assert_eq!(stdout, Vec::new());
assert!(!stderr.is_empty());
} | rust_cleaned_test_functions.jsonl/5982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
7645,
4096,
368,
341,
286,
1077,
9258,
314,
2829,
11,
20075,
11,
26436,
532,
1797,
284,
7348,
486,
931,
445,
26117,
1827,
858,
73133,
568,
3006,
1005,
15454,
1428,
286,
2060,
10297,
2829,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_frame_allocator_add() {
let mut frame = FrameAllocator::new();
assert!(frame.alloc(1).is_none());
frame.insert(0..3);
let num = frame.alloc(1);
assert_eq!(num, Some(2));
let num = frame.alloc(2);
assert_eq!(num, Some(0));
assert!(frame.alloc(1).is_none());
assert!(frame.alloc(2).is_none());
} | rust_cleaned_test_functions.jsonl/99755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8929,
56910,
2891,
368,
341,
262,
1077,
5206,
4034,
284,
16321,
42730,
486,
931,
543,
262,
2060,
10297,
6763,
78224,
7,
16,
568,
285,
31488,
5231,
262,
4034,
7030,
7,
15,
496,
18,
317,
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_to_usize() { //NOTE: Also tests LE or BE of get_uint256's hex string input
let val = to_usize(&get_uint256("12345"));
assert_eq!(val , 74565);
} | rust_cleaned_test_functions.jsonl/78454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
11306,
551,
368,
314,
442,
27792,
25,
7281,
7032,
11148,
476,
7206,
315,
633,
15807,
17,
20,
21,
594,
12371,
914,
1946,
198,
286,
1077,
1044,
284,
311,
11306,
551,
2099,
455,
15807,
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_set_quota_and_period() {
// arrange
const QUOTA: i64 = 200000;
const PERIOD: u64 = 100000;
let (tmp, max) = setup("test_set_quota_and_period", CGROUP_CPU_MAX);
let cpu = LinuxCpuBuilder::new()
.with_quota(QUOTA)
.with_period(PERIOD)
.build();
// act
Cpu::apply(&tmp, &cpu).expect("apply cpu");
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_MAX));
assert_eq!(content, format!("{} {}", QUOTA, PERIOD));
} | rust_cleaned_test_functions.jsonl/126563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
97093,
8378,
20818,
368,
341,
286,
442,
30893,
198,
286,
733,
25999,
36544,
25,
600,
21,
19,
284,
220,
17,
15,
15,
15,
15,
15,
280,
286,
733,
17854,
33291,
25,
575,
21,
19,
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... | 1 |
#[test]
fn test_forward() {
let mut masm = MacroAssembler::new();
let lbl = masm.create_label();
masm.emit_label(lbl);
masm.bind_label(lbl);
assert_eq!(vec![0, 0, 0, 0], masm.data());
} | rust_cleaned_test_functions.jsonl/17050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32121,
368,
341,
286,
1077,
5206,
9243,
76,
284,
53317,
77858,
486,
931,
543,
286,
1077,
16421,
284,
9243,
76,
2520,
6106,
543,
286,
9243,
76,
16812,
6106,
70491,
317,
286,
9243,
76,
6090,
6106,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_results_and_options() {
common::setup();
#[derive(PolarClass)]
struct Foo;
#[derive(Error, Debug)]
#[error("Test error")]
struct Error;
impl Foo {
fn new() -> Self {
Self
}
#[allow(clippy::unnecessary_wraps)]
fn ok(&self) -> Result<i32, Error> {
Ok(1)
}
#[allow(clippy::unnecessary_wraps)]
fn err(&self) -> Result<i32, Error> {
Err(Error)
}
#[allow(clippy::unnecessary_wraps)]
fn some(&self) -> Option<i32> {
Some(1)
}
#[allow(clippy::unnecessary_wraps)]
fn none(&self) -> Option<i32> {
None
}
}
let mut test = OsoTest::new();
test.oso
.register_class(
Foo::get_polar_class_builder()
.set_constructor(Foo::new)
.add_method("ok", Foo::ok)
.add_method("err", Foo::err)
.add_method("some", Foo::some)
.add_method("none", Foo::none)
.build(),
)
.unwrap();
test.qvar_one(r#"new Foo().ok() = x"#, "x", 1);
test.query_err("new Foo().err()");
test.qvar_one(r#"new Foo().some() = x"#, "x", Some(1));
test.qvar_one(r#"x in new Foo().some()"#, "x", 1);
test.qvar_one(r#"new Foo().none() = nil and y = 1"#, "y", 1);
let results = test.query("x in new Foo().none()");
assert!(results.is_empty());
} | rust_cleaned_test_functions.jsonl/30393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 813
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13576,
8378,
8743,
368,
341,
262,
4185,
486,
15188,
1428,
262,
11506,
27098,
5304,
7417,
1957,
5563,
262,
2036,
33428,
401,
262,
11506,
27098,
37396,
11,
11091,
5563,
262,
11506,
841,
445,
2271,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_highlighting() {
check_highlighting(
r#"
//- /main.rs crate:main deps:foo
use inner::{self as inner_mod};
mod inner {}
#[rustc_builtin_macro]
macro Copy {}
// Needed for function consuming vs normal
pub mod marker {
#[lang = "copy"]
pub trait Copy {}
}
pub mod ops {
#[lang = "fn_once"]
pub trait FnOnce<Args> {}
#[lang = "fn_mut"]
pub trait FnMut<Args>: FnOnce<Args> {}
#[lang = "fn"]
pub trait Fn<Args>: FnMut<Args> {}
}
struct Foo {
pub x: i32,
pub y: i32,
}
trait Bar where Self: {
fn bar(&self) -> i32;
}
impl Bar for Foo where Self: {
fn bar(&self) -> i32 {
self.x
}
}
impl Foo {
fn baz(mut self, f: Foo) -> i32 {
f.baz(self)
}
fn qux(&mut self) {
self.x = 0;
}
fn quop(&self) -> i32 {
self.x
}
}
#[derive(Copy)]
struct FooCopy {
x: u32,
}
impl FooCopy {
fn baz(self, f: FooCopy) -> u32 {
f.baz(self)
}
fn qux(&mut self) {
self.x = 0;
}
fn quop(&self) -> u32 {
self.x
}
}
fn str() {
str();
}
static mut STATIC_MUT: i32 = 0;
fn foo<'a, T>() -> T {
foo::<'a, i32>()
}
fn never() -> ! {
loop {}
}
fn const_param<const FOO: usize>() -> usize {
FOO
}
use ops::Fn;
fn baz<F: Fn() -> ()>(f: F) {
f()
}
fn foobar() -> impl Copy {}
fn foo() {
let bar = foobar();
}
macro_rules! def_fn {
($($tt:tt)*) => {$($tt)*}
}
def_fn! {
fn bar() -> u32 {
100
}
}
macro_rules! dont_color_me_braces {
() => {0}
}
macro_rules! noop {
($expr:expr) => {
$expr
}
}
macro_rules! keyword_frag {
($type:ty) => ($type)
}
macro with_args($i:ident) {
$i
}
macro without_args {
($i:ident) => {
$i
}
}
// comment
fn main() {
println!("Hello, {}!", 92);
dont_color_me_braces!();
let mut vec = Vec::new();
if true {
let x = 92;
vec.push(Foo { x, y: 1 });
}
unsafe {
vec.set_len(0);
STATIC_MUT = 1;
}
for e in vec {
// Do nothing
}
noop!(noop!(1));
let mut x = 42;
let y = &mut x;
let z = &y;
let Foo { x: z, y } = Foo { x: z, y };
y;
let mut foo = Foo { x, y: x };
let foo2 = Foo { x, y: x };
foo.quop();
foo.qux();
foo.baz(foo2);
let mut copy = FooCopy { x };
copy.quop();
copy.qux();
copy.baz(copy);
let a = |x| x;
let bar = Foo::baz;
let baz = (-42,);
let baz = -baz.0;
let _ = !true;
'foo: loop {
break 'foo;
continue 'foo;
}
}
enum Option<T> {
Some(T),
None,
}
use Option::*;
impl<T> Option<T> {
fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
match other {
None => unimplemented!(),
Nope => Nope,
}
}
}
async fn learn_and_sing() {
let song = learn_song().await;
sing_song(song).await;
}
async fn async_main() {
let f1 = learn_and_sing();
let f2 = dance();
futures::join!(f1, f2);
}
unsafe trait Dangerous {}
impl Dangerous for () {}
fn use_foo_items() {
let bob = foo::Person {
name: "Bob",
age: foo::consts::NUMBER,
};
let control_flow = foo::identity(foo::ControlFlow::Continue);
if control_flow.should_die() {
foo::die!();
}
}
//- /foo.rs crate:foo
pub struct Person {
pub name: &'static str,
pub age: u8,
}
pub enum ControlFlow {
Continue,
Die,
}
impl ControlFlow {
pub fn should_die(self) -> bool {
matches!(self, ControlFlow::Die)
}
}
pub fn identity<T>(x: T) -> T { x }
pub mod consts {
pub const NUMBER: i64 = 92;
}
macro_rules! die {
() => {
panic!();
};
}
"#
.trim(),
expect_file!["./test_data/highlighting.html"],
false,
);
} | rust_cleaned_test_functions.jsonl/5119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1943
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74546,
287,
368,
341,
262,
1779,
74546,
287,
1006,
286,
435,
2,
698,
61463,
608,
3817,
25638,
17717,
25,
3817,
48178,
25,
7975,
198,
810,
9179,
22964,
721,
438,
9179,
7480,
2440,
2593,
9179,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_out_of_range_positive() {
let arr = [10000, 256, 1000];
let _ = Color::try_from(&arr[..]).unwrap();
} | rust_cleaned_test_functions.jsonl/14004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
6068,
3575,
9698,
54160,
368,
341,
286,
1077,
2890,
284,
508,
16,
15,
15,
15,
15,
11,
220,
17,
20,
21,
11,
220,
16,
15,
15,
15,
935,
286,
1077,
716,
284,
3478,
486,
1539,
5673,
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 |
#[test]
fn test_incompatible_type() {
make_helpers();
let lib = Library::new(LIBPATH).unwrap();
unsafe {
assert!(match lib.get::<()>(b"test_identity_u32\0") {
Err(libloading::Error::IncompatibleSize) => true,
_ => false,
})
}
} | rust_cleaned_test_functions.jsonl/40724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
34842,
1819,
368,
341,
262,
1281,
54473,
543,
262,
1077,
3051,
284,
11635,
486,
931,
4957,
3256,
13593,
568,
15454,
543,
262,
19860,
341,
286,
2060,
10297,
6347,
3051,
670,
27638,
368,
2235,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_format_docs_handles_plain_text() {
let comment = "```text\nthis is plain text\n```";
assert_eq!(format_docs(comment), "```text\nthis is plain text\n```");
} | rust_cleaned_test_functions.jsonl/57083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
49692,
68017,
41015,
4326,
368,
341,
286,
1077,
3980,
284,
330,
73594,
1318,
1699,
574,
374,
14396,
1467,
1699,
73594,
876,
286,
2060,
10714,
10297,
2243,
49692,
39327,
701,
330,
73594,
1318,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bpe_from_files_merge_token_oov() {
// Set up vocab file.
let mut vocab_file = NamedTempFile::new().unwrap();
vocab_file
.write_all(b"{\"a\": 0, \"b\": 1, \"c\": 2, \"ab\": 3}")
.unwrap();
// Set up merges file.
let mut merges_file = NamedTempFile::new().unwrap();
merges_file.write_all(b"#version: 0.2\na b\na d").unwrap();
// Ensure the result of BPE::from_files is a MergeTokenOutOfVocabulary error.
match BPE::from_files(
vocab_file.path().to_str().unwrap(),
merges_file.path().to_str().unwrap(),
)
.build()
{
Ok(_) => unreachable!(),
Err(err) => match err.downcast_ref::<Error>() {
Some(Error::MergeTokenOutOfVocabulary(token)) => {
assert_eq!(*token, String::from("d"))
}
_ => unreachable!(),
},
}
} | rust_cleaned_test_functions.jsonl/43352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
375,
5673,
10931,
20888,
6458,
14179,
859,
368,
341,
286,
442,
2573,
705,
23820,
1034,
624,
286,
1077,
5206,
23820,
2458,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
543,
286,
23820,
2458... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_merge_nulls_constant_null() {
#[rpn_fn]
fn foo(v: &Real) -> Result<Option<Real>> {
Ok(Some(*v * 2.5))
}
let exp = RpnExpressionBuilder::new_for_test()
.push_constant_for_test(ScalarValue::Real(None))
.push_fn_call_for_test(foo_fn_meta(), 1, FieldTypeTp::Double)
.build_for_test();
let mut ctx = EvalContext::default();
let mut columns = LazyBatchColumnVec::empty();
let val = exp.eval(&mut ctx, &[], &mut columns, &[], 10).unwrap();
assert!(val.is_vector());
assert_eq!(
val.vector_value().unwrap().as_ref().to_real_vec(),
(0..10).map(|_| None).collect::<Vec<Option<Real>>>()
);
} | rust_cleaned_test_functions.jsonl/92677 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
15162,
82,
34967,
15162,
368,
341,
394,
11506,
81,
19958,
15246,
921,
286,
5168,
15229,
3747,
25,
609,
12768,
8,
1464,
5714,
94150,
64829,
2452,
341,
310,
7622,
65405,
4071,
85,
353,
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_read_leader_in_lease() {
let count = 3;
let mut cluster = new_server_cluster(0, count);
cluster.run();
let k1 = b"k1";
let (k2, v2) = (b"k2", b"v2");
// 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 storage = cluster.sim.rl().storages[&leader.get_id()].clone();
let mut ctx = Context::default();
ctx.set_region_id(region.get_id());
ctx.set_region_epoch(region.get_region_epoch().clone());
ctx.set_peer(leader.clone());
// write some data
assert_none(&ctx, &storage, k2);
must_put(&ctx, &storage, k2, v2);
// isolate leader
cluster.add_send_filter(IsolationFilterFactory::new(leader.get_store_id()));
assert_eq!(can_read(&ctx, &storage, k2, v2), true);
} | rust_cleaned_test_functions.jsonl/15822 | {
"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,
6443,
79991,
1243,
62,
1623,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_generic_generate_constructor() {
let gen = no_generic_fn();
let expected: TokenStream = quote! {
pub const fn foo_fn_meta() -> crate::coprocessor::dag::rpn_expr::function::RpnFnMeta {
#[inline]
fn run(
ctx: &mut crate::coprocessor::dag::expr::EvalContext,
payload: &crate::coprocessor::dag::rpn_expr::types::RpnFnCallPayload,
) -> crate::coprocessor::Result<crate::coprocessor::codec::data_type::VectorValue> {
use crate::coprocessor::dag::rpn_expr::function::{ArgConstructor, Evaluator, Null};
ArgConstructor::new(
1usize,
ArgConstructor::new(
0usize,
Foo_Evaluator(std::marker::PhantomData)
)
).eval(Null, ctx, payload)
}
crate::coprocessor::dag::rpn_expr::function::RpnFnMeta {
name: "foo",
args_len: 2usize,
fn_ptr: run,
}
}
};
assert_eq!(expected.to_string(), gen.generate_constructor().to_string());
} | rust_cleaned_test_functions.jsonl/93544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 753
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
41232,
48851,
66210,
368,
341,
286,
1077,
4081,
284,
902,
41232,
15246,
543,
286,
1077,
3601,
25,
9660,
3027,
284,
12641,
0,
341,
310,
6675,
733,
5168,
15229,
15246,
13381,
368,
1464,
17717,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold_comparison3() {
fold("x = !1 == !0", "x = false");
fold("x = !0 == !0", "x = true");
fold("x = !1 == !1", "x = true");
fold("x = !1 == null", "x = false");
fold("x = !1 == !0", "x = false");
fold("x = !0 == null", "x = false");
fold("!0 == !0", "true");
fold("!1 == null", "false");
fold("!1 == !0", "false");
fold("!0 == null", "false");
fold("x = !0 === !0", "x = true");
fold("x = !1 === !1", "x = true");
fold("x = !1 === null", "x = false");
fold("x = !1 === !0", "x = false");
fold("x = !0 === null", "x = false");
fold("!0 === !0", "true");
fold("!1 === null", "false");
fold("!1 === !0", "false");
fold("!0 === null", "false");
} | rust_cleaned_test_functions.jsonl/122190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
90797,
18,
368,
341,
262,
11555,
445,
87,
284,
753,
16,
621,
753,
15,
497,
330,
87,
284,
895,
3071,
262,
11555,
445,
87,
284,
753,
15,
621,
753,
15,
497,
330,
87,
284,
830,
797,
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_color_linear() -> Result<(), Error> {
let color = "#fe801970".parse()?;
assert_eq!(RGBA::from(ColorLinear::from(color)), color);
for input in 0..256 {
let output = (linear_to_srgb(SRGB_TO_LIN[input]) * 255.0).round() as u8;
assert_eq!(input as u8, output);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/129472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
40674,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1894,
284,
5869,
1859,
23,
15,
16,
24,
22,
15,
3263,
6400,
94136,
286,
2060,
10714,
10297,
58927,
486,
1499,
15028,
31898,
486,
149... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_multiple_generate_setter() {
check_assist(
generate_setter,
r#"
struct Context<T: Clone> {
data: T,
cou$0nt: usize,
}
impl<T: Clone> Context<T> {
/// Set the context's data.
fn set_data(&mut self, data: T) {
self.data = data;
}
}"#,
r#"
struct Context<T: Clone> {
data: T,
count: usize,
}
impl<T: Clone> Context<T> {
/// Set the context's data.
fn set_data(&mut self, data: T) {
self.data = data;
}
/// Set the context's count.
fn set_count(&mut self, count: usize) {
self.count = count;
}
}"#,
);
} | rust_cleaned_test_functions.jsonl/115750 | {
"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,
45233,
48851,
2602,
465,
368,
341,
286,
1779,
12083,
380,
1006,
310,
6923,
2602,
465,
345,
310,
435,
2,
698,
1235,
9608,
3125,
25,
27913,
29,
341,
262,
821,
25,
350,
345,
262,
3933,
3,
15,
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_process_nonce_ix_only_nonce_acc_fail() {
assert_eq!(
process_instruction(
&Pubkey::default(),
vec![KeyedAccount::new(
&Pubkey::default(),
true,
&create_default_account(),
)],
&serialize(&SystemInstruction::AdvanceNonceAccount).unwrap(),
),
Err(InstructionError::NotEnoughAccountKeys),
);
} | rust_cleaned_test_functions.jsonl/73061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
48508,
62686,
18410,
48508,
17737,
22121,
368,
341,
286,
2060,
10714,
33673,
310,
1882,
54923,
1006,
394,
609,
29162,
792,
486,
2258,
3148,
394,
7486,
20703,
1592,
291,
7365,
486,
931,
1006,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buf_into_options_with_invalid_option_parses_other_valid_options() {
let mut msg = Message::new();
msg.options.push(ConfigOption {
code: OptionCode::SubnetMask,
value: vec![255, 255, 255, 0],
});
msg.options.push(ConfigOption {
code: OptionCode::Router,
value: vec![192, 168, 1, 1],
});
msg.options.push(ConfigOption {
code: OptionCode::DhcpMessageType,
value: vec![MessageType::DHCPDISCOVER.into()],
});
let mut buf = msg.serialize();
// introduce invalid option code in first option
buf[OPTIONS_START_IDX + 4] = 99;
let result = Message::from_buffer(&buf).unwrap();
// Expect that everything but the invalid option deserializes.
msg.options.remove(0);
assert_eq!(msg, result);
} | rust_cleaned_test_functions.jsonl/93683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10363,
45514,
8743,
6615,
31433,
9672,
77113,
288,
30456,
8337,
8743,
368,
341,
286,
1077,
5206,
3750,
284,
4856,
486,
931,
543,
286,
3750,
10912,
2552,
33687,
5341,
341,
310,
2038,
25,
6959,
2078... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_at_utc() {
let _reset = set_time_zone();
let time = Timespec::new(1234567890, 54321);
let utc = at_utc(time);
assert_eq!(utc.tm_sec, 30);
assert_eq!(utc.tm_min, 31);
assert_eq!(utc.tm_hour, 23);
assert_eq!(utc.tm_mday, 13);
assert_eq!(utc.tm_mon, 1);
assert_eq!(utc.tm_year, 109);
assert_eq!(utc.tm_wday, 5);
assert_eq!(utc.tm_yday, 43);
assert_eq!(utc.tm_isdst, 0);
assert_eq!(utc.tm_utcoff, 0);
assert_eq!(utc.tm_nsec, 54321);
} | rust_cleaned_test_functions.jsonl/7337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
84259,
368,
341,
286,
1077,
716,
9716,
284,
738,
3009,
28692,
1428,
286,
1077,
882,
284,
8523,
992,
486,
931,
7,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
11,
220,
20,
19,
18,
17,
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_timestamp_year_out_of_range() {
#[derive(Debug, FromValue, Default, Empty, ToValue)]
struct Helper {
foo: Annotated<Timestamp>,
}
let x: Annotated<Helper> = Annotated::from_json(r#"{"foo": 1562770897893}"#).unwrap();
assert_eq_str!(
x.to_json_pretty().unwrap(),
r#"{
"foo": null,
"_meta": {
"foo": {
"": {
"err": [
[
"invalid_data",
{
"reason": "timestamp out of range"
}
]
],
"val": 1562770897893.0
}
}
}
}"#
);
} | rust_cleaned_test_functions.jsonl/57490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
14645,
6068,
3575,
9698,
368,
341,
262,
11506,
27098,
42618,
11,
5542,
1130,
11,
7899,
11,
22228,
11,
2014,
1130,
5563,
262,
2036,
12906,
341,
286,
15229,
25,
1527,
87029,
3125,
4702,
12520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_to_end() {
let helper = StorageHelper::new();
// Each identity works in their own namespace
// Dave is the libra root.
// Each user will upload their contents to *_ns + "shared"
// Common is used by the technical staff for coordination.
let alice_ns = "alice";
let bob_ns = "bob";
let carol_ns = "carol";
let operator_alice_ns = "operator_alice";
let operator_bob_ns = "operator_bob";
let operator_carol_ns = "operator_carol";
let dave_ns = "dave";
let shared = "_shared";
// is uploaded to the common namespace:
let layout_text = "\
operators = [\"operator_alice_shared\", \"operator_bob_shared\", \"operator_carol_shared\"]\n\
owners = [\"alice_shared\", \"bob_shared\", \"carol_shared\"]\n\
libra_root = [\"dave_shared\"]\n\
";
let temppath = libra_temppath::TempPath::new();
temppath.create_as_file().unwrap();
let mut file = File::create(temppath.path()).unwrap();
file.write_all(&layout_text.to_string().into_bytes())
.unwrap();
file.sync_all().unwrap();
helper
.set_layout(temppath.path().to_str().unwrap(), constants::COMMON_NS)
.unwrap();
// Step 2) Upload the libra root key:
helper.initialize(dave_ns.into());
helper
.libra_root_key(dave_ns, &(dave_ns.to_string() + shared))
.unwrap();
// Step 3) Upload each owner key:
for ns in [alice_ns, bob_ns, carol_ns].iter() {
let ns = (*ns).to_string();
let ns_shared = (*ns).to_string() + shared;
helper.initialize(ns.clone());
helper.owner_key(&ns, &ns_shared).unwrap();
}
// Step 4) Upload each operator key:
for ns in [operator_alice_ns, operator_bob_ns, operator_carol_ns].iter() {
let ns = (*ns).to_string();
let ns_shared = (*ns).to_string() + shared;
helper.initialize(ns.clone());
helper.operator_key(&ns, &ns_shared).unwrap();
}
// Step 5) Set the operator for each owner:
for ns in [alice_ns, bob_ns, carol_ns].iter() {
let ns = (*ns).to_string();
let ns_shared = (*ns).to_string() + shared;
let operator_name = format!("operator_{}", ns_shared);
helper
.set_operator(&operator_name, &ns, &ns_shared)
.unwrap();
}
// Step 6) Upload a signed validator config transaction for each operator:
for ns in [operator_alice_ns, operator_bob_ns, operator_carol_ns].iter() {
let ns = (*ns).to_string();
let ns_shared = (*ns).to_string() + shared;
let owner_name: String = (*ns).chars().skip(9).collect(); // Remove "operator_" prefix
let owner_name = owner_name + shared;
helper
.validator_config(
&owner_name,
"/ip4/0.0.0.0/tcp/6180".parse().unwrap(),
"/ip4/0.0.0.0/tcp/6180".parse().unwrap(),
ChainId::test(),
&ns,
&ns_shared,
)
.unwrap();
}
// Step 7) Produce genesis
let genesis_path = libra_temppath::TempPath::new();
genesis_path.create_as_file().unwrap();
helper.genesis(genesis_path.path()).unwrap();
let mut file = File::open(genesis_path.path()).unwrap();
let mut contents = Vec::new();
assert!(contents.is_empty());
file.read_to_end(&mut contents).unwrap();
assert!(!contents.is_empty());
// Step 9) Verify
for ns in [operator_alice_ns, operator_bob_ns, operator_carol_ns].iter() {
helper.create_waypoint(ns).unwrap();
helper.verify_genesis(ns, genesis_path.path()).unwrap();
}
} | rust_cleaned_test_functions.jsonl/8043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1986
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6213,
2346,
6213,
368,
341,
286,
1077,
13137,
284,
14693,
5511,
486,
931,
1428,
286,
442,
8886,
9569,
4278,
304,
862,
1828,
4473,
79133,
286,
442,
20238,
374,
279,
3051,
956,
3704,
624,
286,
442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_dequantize_and_idct_block_8x8_all_zero() {
let mut output = [0u8; 8 * 8];
dequantize_and_idct_block_8x8(
&[0; 8*8],
&[666; 8*8],
8,
&mut output);
assert_eq!(&output[..], &[128; 8*8][..]);
} | rust_cleaned_test_functions.jsonl/38781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
30448,
551,
8378,
842,
302,
7113,
62,
23,
87,
23,
5705,
19359,
368,
341,
262,
1077,
5206,
2550,
284,
508,
15,
84,
23,
26,
220,
23,
353,
220,
23,
935,
262,
409,
30448,
551,
8378,
842,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_day_of_month_backward() {
let context = build_context(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 10, 11)));
let day_of_month = DayOfMonth(10);
let walker = day_of_month.to_walker(&context.reference, &context);
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 05, 10).and_hms(0, 0, 0)),
Grain::Day)),
walker.forward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 06, 10).and_hms(0, 0, 0)),
Grain::Day)),
walker.forward.clone().skip(1).next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 10).and_hms(0, 0, 0)),
Grain::Day)),
walker.backward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 03, 10).and_hms(0, 0, 0)),
Grain::Day)),
walker.backward.clone().skip(1).next());
} | rust_cleaned_test_functions.jsonl/114662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 630
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
3575,
18933,
70477,
368,
341,
286,
1077,
2266,
284,
1936,
8467,
3189,
12913,
7,
59604,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
568,
437,
1523,
1011,
7,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_context() -> Result<(), failure::Error> {
let decoded = HashType::ContextHash.bytes_to_string(&hex::decode("934484026d24be9ad40c98341c20e51092dd62bbf470bb9ff85061fa981ebbd9")?);
let expected = "CoVmAcMV64uAQo8XvfLr9VDuz7HVZLT4cgK1w1qYmTjQNbGwQwDd";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/65920 | {
"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,
11224,
8467,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
29213,
284,
6531,
929,
486,
1972,
6370,
42697,
2346,
3904,
2099,
17308,
486,
18196,
445,
24,
18,
19,
19,
23,
19,
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... | 2 |
#[test]
fn test_default_cc() {
let s = UnusualSwiftcallStruct { x0: 0x1111_1111, x1: 0x2222_2222, x2: 0x4444_4444 };
let func_differentiator = 0xffff_0000;
assert_eq!(function_with_default_cc(s), 0x7777_7777 + func_differentiator);
} | rust_cleaned_test_functions.jsonl/106167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
28955,
368,
341,
286,
1077,
274,
284,
1230,
80224,
55336,
6659,
9422,
314,
856,
15,
25,
220,
15,
87,
16,
16,
16,
16,
62,
16,
16,
16,
16,
11,
856,
16,
25,
220,
15,
87,
17,
17,
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_signing() {
// which we are treating as an oracle in this test.
let string_to_sign = "53d7e14aee681a00340300032015-01-01T10:00:00.0000000".to_owned();
let hmac_key = "pXeTVaaaaU9XxH6fPcPlq8Y9D9G3Cdo5Eh2nMSgKj/DWqeSFFXDdmpz5Trv+L2hQNM+nGa704Rf8Z22W9O1jdQ=="
.to_owned();
assert_eq!(
signature(&string_to_sign, &hmac_key),
"gZzaRaIkvC9jYRY123tq3xXZdsMAcgAbjKQo8y0p0Fs=".to_owned()
);
} | rust_cleaned_test_functions.jsonl/19852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
287,
368,
341,
1789,
286,
442,
892,
582,
525,
26625,
438,
458,
52741,
304,
419,
1273,
624,
286,
1077,
914,
2346,
11172,
284,
330,
20,
18,
67,
22,
68,
16,
19,
64,
2127,
21,
23,
16,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrong_indentation_char() {
let parsed_data = common::get_file_content_parsed(PARENT_FOLDER, "different_chars.ura");
assert!(parsed_data
.unwrap_err()
.downcast_ref::<InvalidIndentationError>()
.is_some());
} | rust_cleaned_test_functions.jsonl/33289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75198,
69045,
367,
9232,
368,
341,
262,
1077,
15676,
1769,
284,
4185,
486,
455,
2458,
7495,
75788,
5304,
28155,
33637,
11,
330,
63650,
37418,
13,
5690,
797,
262,
2060,
10297,
41030,
1769,
198,
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 |
#[test]
fn test_rpc_request_processor_allow_validator_exit_config() {
let exit = Arc::new(AtomicBool::new(false));
let validator_exit = create_validator_exit(&exit);
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let block_commitment_cache = Arc::new(RwLock::new(
BlockCommitmentCache::default_with_blockstore(blockstore.clone()),
));
let mut config = JsonRpcConfig::default();
config.enable_validator_exit = true;
let bank_forks = new_bank_forks().0;
let cluster_info = Arc::new(ClusterInfo::default());
let request_processor = JsonRpcRequestProcessor::new(
config,
bank_forks.clone(),
block_commitment_cache,
blockstore,
validator_exit,
RpcHealth::stub(),
cluster_info.clone(),
Hash::default(),
Arc::new(SendTransactionService::new(
&cluster_info,
&bank_forks,
&exit,
)),
);
assert_eq!(request_processor.validator_exit(), Ok(true));
assert_eq!(exit.load(Ordering::Relaxed), true);
} | rust_cleaned_test_functions.jsonl/14449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 606
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
7893,
50127,
55731,
64959,
16880,
5332,
368,
341,
286,
1077,
4869,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
286,
1077,
22935,
16880,
284,
1855,
64959,
16880,
2099,
13652,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_path() {
let path = ActorPath::from("/acme");
let child = path.clone() / "child";
println!("{}", &child);
assert!(path.is_parent_of(&child))
} | rust_cleaned_test_functions.jsonl/32099 | {
"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,
2891,
2638,
368,
341,
286,
1077,
1815,
284,
24718,
1820,
486,
1499,
4283,
580,
2660,
797,
286,
1077,
1682,
284,
1815,
15997,
368,
608,
330,
3048,
876,
286,
13751,
79878,
609,
3048,
317,
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,
1,
1,
1
] | 1 |
#[test]
fn test_which_absolute_path_case() {
// Test that an absolute path with an uppercase extension
// is accepted.
let f = TestFixture::new();
let p = &f.bins[4];
assert_eq!(_which(&f, &p).unwrap(), f.bins[4].canonicalize().unwrap());
} | rust_cleaned_test_functions.jsonl/13404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
8206,
50874,
2638,
19096,
368,
341,
262,
442,
3393,
429,
458,
10740,
1815,
448,
458,
39482,
8894,
198,
262,
442,
374,
11666,
624,
262,
1077,
282,
284,
3393,
18930,
486,
931,
543,
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_handle_100_continue_sends_header_if_expects_is_wrong() {
let mut req = http::request::Builder::new();
req.headers_mut().expect("Request builder error").append(
HeaderName::from_bytes(b"expect").unwrap(),
HeaderValue::from_bytes(b"111-wrong").unwrap(),
);
let mut io = Cursor::new(Vec::new());
smol::block_on(async {
let result = handle_100_continue(&req, &mut io).await;
assert_eq!(
std::str::from_utf8(&io.into_inner()).unwrap(),
"",
);
assert!(result.is_ok())
});
} | rust_cleaned_test_functions.jsonl/42142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
62,
16,
15,
15,
75297,
643,
1412,
8757,
11119,
2702,
7973,
6892,
75198,
368,
341,
286,
1077,
5206,
4232,
284,
1758,
486,
2035,
486,
3297,
486,
931,
543,
286,
4232,
18022,
29523,
1005,
171... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ledger_options_full_leader_cache() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(123);
let (ledger_path, _blockhash) = create_new_tmp_ledger_auto_delete!(&genesis_config);
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let opts = ProcessOptions {
full_leader_cache: true,
accounts_db_test_hash_calculation: true,
..ProcessOptions::default()
};
let (_bank_forks, leader_schedule, _) =
test_process_blockstore(&genesis_config, &blockstore, opts);
assert_eq!(leader_schedule.max_schedules(), std::usize::MAX);
} | rust_cleaned_test_functions.jsonl/46805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
38367,
1389,
8743,
16372,
79991,
11529,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
17,
18,
317,
286,
1077,
320,
50704,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stake_delegate_stake() {
let vote_keypair = Keypair::new();
let mut vote_state = VoteState::default();
for i in 0..1000 {
vote_state.process_vote(&Vote::new(i));
}
let vote_pubkey = vote_keypair.pubkey();
let mut vote_account =
vote_state::create_account(&vote_pubkey, &Pubkey::new_rand(), 0, 100);
let mut vote_keyed_account = KeyedAccount::new(&vote_pubkey, false, &mut vote_account);
vote_keyed_account.set_state(&vote_state).unwrap();
let stake_pubkey = Pubkey::default();
let mut stake_account = Account::new(0, std::mem::size_of::<StakeState>(), &id());
let mut stake_keyed_account = KeyedAccount::new(&stake_pubkey, false, &mut stake_account);
assert_eq!(
stake_keyed_account.delegate_stake(&vote_keyed_account),
Err(InstructionError::MissingRequiredSignature)
);
let mut stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &mut stake_account);
assert!(stake_keyed_account
.delegate_stake(&vote_keyed_account)
.is_ok());
let stake_state: StakeState = stake_keyed_account.state().unwrap();
assert_eq!(
stake_state,
StakeState::Delegate {
voter_id: vote_keypair.pubkey(),
credits_observed: vote_state.credits()
}
);
let stake_state = StakeState::MiningPool;
stake_keyed_account.set_state(&stake_state).unwrap();
assert!(stake_keyed_account
.delegate_stake(&vote_keyed_account)
.is_err());
} | rust_cleaned_test_functions.jsonl/43334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
55312,
1261,
726,
368,
341,
286,
1077,
6910,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5206,
6910,
4387,
284,
34034,
1397,
486,
2258,
543,
286,
369,
600,
304,
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_cp_backup_no_clobber_conflicting_options() {
let ts = TestScenario::new(util_name!());
ts.ucmd()
.arg("--backup")
.arg("--no-clobber")
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE)
.fails().stderr_is(&format!(
"{0}: options --backup and --no-clobber are mutually exclusive\nTry '{1} {0} --help' for more information.",
ts.util_name,
ts.bin_path.to_string_lossy()
));
} | rust_cleaned_test_functions.jsonl/39642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
44710,
6536,
666,
91397,
16059,
78208,
8743,
368,
341,
262,
1077,
10591,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
10591,
56334,
2277,
741,
286,
659,
858,
21549,
31371,
1138,
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_read_line() -> io::Result<()> {
let mut buf = Vec::new();
let data = b"noodles\n";
let mut reader = &data[..];
buf.clear();
read_line(&mut reader, &mut buf)?;
assert_eq!(buf, b"noodles");
let data = b"noodles\r\n";
let mut reader = &data[..];
buf.clear();
read_line(&mut reader, &mut buf)?;
assert_eq!(buf, b"noodles");
let data = b"noodles";
let mut reader = &data[..];
buf.clear();
read_line(&mut reader, &mut buf)?;
assert_eq!(buf, b"noodles");
Ok(())
} | rust_cleaned_test_functions.jsonl/28634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
6528,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
1428,
286,
1077,
821,
284,
293,
1,
77,
97121,
1699,
876,
286,
1077,
5206,
6604,
284,
609,
691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_simple_nullable_grammar() {
let g = examples::make_simple_nullable();
let nullables = calculate_nullables(&g).unwrap();
let nullable_set = nullables.get_nullable_set();
assert!(nullable_set.contains(&NonTerminal::new("start")));
assert!(nullable_set.contains(&NonTerminal::new("a")));
assert!(nullable_set.contains(&NonTerminal::new("b")));
assert!(nullable_set.contains(&NonTerminal::new("c")));
} | rust_cleaned_test_functions.jsonl/27891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
69743,
62,
41094,
368,
341,
262,
1077,
342,
284,
10295,
486,
6927,
30015,
69743,
543,
262,
1077,
845,
4788,
284,
11047,
15162,
4788,
2099,
70,
568,
15454,
543,
262,
1077,
13258,
2602,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_adaptive_composition_poly() -> Fallible<()> {
let meas1 = make_dummy_meas::<i32>().into_poly();
let meas2 = make_dummy_meas::<i64>().into_poly();
let data = 999;
let d_in_budget = 1.0;
let d_out_budget = 1.0;
let adaptive = make_adaptive_composition(meas1.input_domain.clone(), PolyDomain::new(), meas1.input_metric.clone(), meas1.output_measure.clone(), d_in_budget, d_out_budget);
let mut queryable = adaptive.function.eval(&data)?;
let res1: i32 = queryable.eval_poly(&(meas1, d_out_budget / 2.0))?;
assert_eq!(res1, 999_i32);
let res2: i64 = queryable.eval_poly(&(meas2, d_out_budget / 2.0))?;
assert_eq!(res2, 999_i64);
Ok(())
} | rust_cleaned_test_functions.jsonl/115910 | {
"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,
10027,
27781,
2965,
3487,
36133,
368,
1464,
14785,
1238,
71698,
341,
286,
1077,
6893,
16,
284,
1281,
60321,
95786,
27638,
72,
18,
17,
10483,
18122,
36133,
543,
286,
1077,
6893,
17,
284,
1281,
6032... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_failure_in_first_script() {
let _pool = ConstPool::new();
let text = r"
script {
fun step_1() {
assert(false, 1);
}
}
script {
fun step_2() {
assert(true, 2);
}
}
";
let res = execute_script(
MoveFile::with_content(script_path(), text),
vec![stdlib_mod("signer.move"), modules_mod("record.move")],
"libra",
"0x1",
vec![],
)
.unwrap()
.last()
.unwrap();
assert_eq!(
res.error(),
"Execution aborted with code 1 in transaction script"
);
} | rust_cleaned_test_functions.jsonl/43931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43618,
1243,
12978,
14660,
368,
341,
262,
1077,
716,
10285,
284,
24522,
10551,
486,
931,
1428,
262,
1077,
1467,
284,
435,
698,
2282,
341,
262,
2464,
3019,
62,
16,
368,
341,
286,
2060,
3576,
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_parse_wrq_only_use_filename() {
let s = [
0x00, 0x02, 0x2f, 0x66, 0x6f, 0x6f, 0x2f, 0x62, 0x61, 0x72, 0x2e, 0x74, 0x78, 0x74,
0x00, 0x6e, 0x65, 0x74, 0x61, 0x73, 0x63, 0x69, 0x69, 0x00,
];
let res = WritePacket::parse(&s).unwrap();
assert_eq!(res.filename, "bar.txt");
assert_eq!(res.mode, Mode::NETASCII);
} | rust_cleaned_test_functions.jsonl/104026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
44074,
80,
18410,
15951,
13323,
368,
341,
1789,
286,
1077,
274,
284,
2278,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
17,
69,
11,
220,
15,
87,
21,
21,
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_force_read_decrement() {
let m = RwLock::new(());
::std::mem::forget(m.read());
::std::mem::forget(m.read());
::std::mem::forget(m.read());
assert!(m.try_write().is_none());
unsafe {
m.force_read_decrement();
m.force_read_decrement();
}
assert!(m.try_write().is_none());
unsafe {
m.force_read_decrement();
}
assert!(m.try_write().is_some());
} | rust_cleaned_test_functions.jsonl/125135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40739,
6443,
2259,
13477,
368,
341,
286,
1077,
296,
284,
55294,
11989,
486,
931,
7,
1423,
286,
3504,
1834,
486,
10536,
486,
40019,
1255,
4125,
1423,
286,
3504,
1834,
486,
10536,
486,
40019,
1255,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ignore_unnamed_trait_members_and_default_methods() {
check_assist_not_applicable(
add_missing_impl_members,
r#"
trait Foo {
fn (arg: u32);
fn valid(some: u32) -> bool { false }
}
struct S;
impl Foo for S { <|> }"#,
)
} | rust_cleaned_test_functions.jsonl/110451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
4907,
30245,
78491,
30397,
8378,
9993,
36084,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
1006,
310,
912,
40447,
21007,
30397,
345,
310,
435,
2,
698,
29432,
33428,
341,
262,
5168,
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_rust_feature_name() {
assert_eq!("2019-06", to_rust_feature_name("2019-06"));
assert_eq!("2019_06", to_rust_feature_name("2019.06"));
assert_eq!("2019_06", to_rust_feature_name("2019!06"));
} | rust_cleaned_test_functions.jsonl/58215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
590,
17069,
1269,
368,
341,
286,
2060,
10714,
17223,
17,
15,
16,
24,
12,
15,
21,
497,
311,
1710,
590,
17069,
1269,
445,
17,
15,
16,
24,
12,
15,
21,
4010,
286,
2060,
10714,
17223,
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_subscribe_to_with_invalid_topic() {
let id = "id1".to_string();
let client_id = ClientId::from(id.clone());
let connect1 = transient_connect(id);
let handle1 = connection_handle();
let req1 = ConnReq::new(
client_id.clone(),
peer_addr(),
connect1,
Auth::Unknown,
handle1,
);
let auth_id = "auth-id1".into();
let state = SessionState::new(client_id, default_config());
let mut session = Session::new_transient(auth_id, req1, state);
let subscribe_to = proto::SubscribeTo {
topic_filter: "topic/#/#".to_string(),
qos: proto::QoS::AtMostOnce,
};
let (ack, subscription) = session.subscribe_to(subscribe_to).unwrap();
assert_eq!(ack, proto::SubAckQos::Failure);
assert_eq!(subscription, None);
} | rust_cleaned_test_functions.jsonl/29334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88935,
2346,
6615,
31433,
31414,
368,
341,
286,
1077,
877,
284,
330,
307,
16,
3263,
983,
3904,
543,
286,
1077,
2943,
842,
284,
8423,
764,
486,
1499,
3724,
15997,
1423,
286,
1077,
4564,
16,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_font_memory_layout() {
use std::mem;
assert_eq!(mem::size_of::<Font>(), mem::size_of::<sys::ImFont>());
assert_eq!(mem::align_of::<Font>(), mem::align_of::<sys::ImFont>());
use memoffset::offset_of;
use sys::ImFont;
macro_rules! assert_field_offset {
($l:ident, $r:ident) => {
assert_eq!(offset_of!(Font, $l), offset_of!(ImFont, $r));
};
};
assert_field_offset!(index_advance_x, IndexAdvanceX);
assert_field_offset!(fallback_advance_x, FallbackAdvanceX);
assert_field_offset!(font_size, FontSize);
assert_field_offset!(index_lookup, IndexLookup);
assert_field_offset!(glyphs, Glyphs);
assert_field_offset!(fallback_glyph, FallbackGlyph);
assert_field_offset!(display_offset, DisplayOffset);
assert_field_offset!(container_atlas, ContainerAtlas);
assert_field_offset!(config_data, ConfigData);
assert_field_offset!(config_data_count, ConfigDataCount);
assert_field_offset!(fallback_char, FallbackChar);
assert_field_offset!(ellipsis_char, EllipsisChar);
assert_field_offset!(dirty_lookup_tables, DirtyLookupTables);
assert_field_offset!(scale, Scale);
assert_field_offset!(ascent, Ascent);
assert_field_offset!(descent, Descent);
assert_field_offset!(metrics_total_surface, MetricsTotalSurface);
assert_field_offset!(used_4k_pages_map, Used4kPagesMap);
} | rust_cleaned_test_functions.jsonl/98283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 575
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17451,
19195,
14466,
368,
341,
262,
990,
1460,
486,
10536,
280,
262,
2060,
10714,
10297,
10536,
486,
2141,
3575,
27638,
5447,
39019,
1833,
486,
2141,
3575,
27638,
7791,
486,
1427,
5447,
32872,
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_tokenizer_point() {
let test_str = "POINT (10 -20)";
let tokens: Vec<Token> = Tokens::from_str(test_str).collect();
assert_eq!(
tokens,
vec![
Token::Word("POINT".to_string()),
Token::ParenOpen,
Token::Number(10.0),
Token::Number(-20.0),
Token::ParenClose,
]
);
} | rust_cleaned_test_functions.jsonl/109319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
3135,
6085,
368,
341,
262,
1077,
1273,
2895,
284,
330,
21531,
320,
16,
15,
481,
17,
15,
24023,
262,
1077,
11211,
25,
11312,
83416,
29,
284,
58166,
486,
1499,
2895,
8623,
2895,
568,
17384,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_log_tag_kv() {
let mut script = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
script.push("resources/tests/scripts");
let script_dir = script.clone();
script.push("remove_keys.lua");
let config = ProgrammableFilterConfig {
scripts_directory: Some(script_dir),
script: Some(script),
forwards: Vec::new(),
config_path: Some("filters.remove_keys".to_string()),
tags: Default::default(),
};
let mut cs = ProgrammableFilter::new(config);
let orig_log = metric::LogLine::new(
"identity",
"i am the very model of the modern major general",
)
.overlay_tag("foo", "bar")
.overlay_tag("bizz", "bazz");
let expected_log = metric::LogLine::new(
"identity",
"i am the very model of the modern major \
general",
)
.overlay_tag("foo", "bar");
let orig_event = metric::Event::new_log(orig_log);
let expected_event = metric::Event::new_log(expected_log);
let mut events = Vec::new();
let res = cs.process(orig_event.clone(), &mut events);
assert!(res.is_ok());
assert!(!events.is_empty());
assert_eq!(events.len(), 1);
assert_eq!(events[0], expected_event);
} | rust_cleaned_test_functions.jsonl/41364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 773
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
5224,
9372,
97066,
368,
341,
310,
1077,
5206,
5316,
284,
7933,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
4010,
310,
5316,
2552,
445,
12745,
62468,
39372,
797,
310,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_update_commission() {
let (vote_pubkey, _authorized_voter, authorized_withdrawer, vote_account) =
create_test_account_with_authorized();
let authorized_withdrawer_account = RefCell::new(Account::default());
let keyed_accounts = &[
KeyedAccount::new(&vote_pubkey, true, &vote_account),
KeyedAccount::new(
&authorized_withdrawer,
false,
&authorized_withdrawer_account,
),
];
let signers: HashSet<Pubkey> = get_signers(keyed_accounts);
let res = update_commission(&keyed_accounts[0], 42, &signers);
assert_eq!(res, Err(InstructionError::MissingRequiredSignature));
let keyed_accounts = &[
KeyedAccount::new(&vote_pubkey, true, &vote_account),
KeyedAccount::new(&authorized_withdrawer, true, &authorized_withdrawer_account),
];
let signers: HashSet<Pubkey> = get_signers(keyed_accounts);
let res = update_commission(&keyed_accounts[0], 42, &signers);
assert_eq!(res, Ok(()));
let vote_state: VoteState = StateMut::<VoteStateVersions>::state(&*vote_account.borrow())
.unwrap()
.convert_to_current();
assert_eq!(vote_state.commission, 42);
let keyed_accounts = &[
KeyedAccount::new(&vote_pubkey, true, &vote_account),
KeyedAccount::new(&authorized_withdrawer, true, &authorized_withdrawer_account),
];
let signers: HashSet<Pubkey> = get_signers(keyed_accounts);
let res = update_commission(&keyed_accounts[0], u8::MAX, &signers);
assert_eq!(res, Ok(()));
let vote_state: VoteState = StateMut::<VoteStateVersions>::state(&*vote_account.borrow())
.unwrap()
.convert_to_current();
assert_eq!(vote_state.commission, u8::MAX);
} | rust_cleaned_test_functions.jsonl/43729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 878
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
8882,
2965,
2728,
368,
341,
286,
1077,
320,
29358,
34014,
792,
11,
716,
19084,
2273,
25392,
11,
18630,
6615,
80127,
11,
6910,
13500,
8,
4035,
310,
1855,
4452,
13500,
6615,
62,
19084,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_channel_create_and_write() {
let _exec = fasync::Executor::new().unwrap();
let (recv, send) = Channel::create();
let mut vec = Vec::new();
let datagram_fut = recv.read_datagram(&mut vec);
let heart: &[u8] = &[0xF0, 0x9F, 0x92, 0x96];
send.as_ref().write(heart).expect("should write successfully");
assert_eq!(Some(Ok(4)), datagram_fut.now_or_never());
assert_eq!(heart, vec.as_slice());
} | rust_cleaned_test_functions.jsonl/76852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
8657,
8378,
9165,
368,
341,
286,
1077,
716,
11748,
284,
282,
7692,
486,
25255,
486,
931,
1005,
15454,
543,
286,
1077,
320,
33977,
11,
3624,
8,
284,
13434,
486,
3182,
1428,
286,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sponsored_contract_call_tx() {
let input_path = {
let mut r = PathBuf::new();
r.push(env!("CARGO_MANIFEST_DIR"));
r.push("tests");
r.push("sponsored_contract_call_testnet.json");
r.set_extension("json");
r
};
let str = std::fs::read_to_string(input_path).expect("Error opening json file");
let json: ContractCallTx = serde_json::from_str(&str).unwrap();
let bytes = hex::decode(&json.raw).unwrap();
let mut transaction = Transaction::from_bytes(&bytes).unwrap();
transaction.read(&bytes).unwrap();
assert!(!transaction.transaction_auth.is_standard_auth());
assert!(transaction.payload.is_contract_call_payload());
let contract_name =
core::str::from_utf8(transaction.payload.contract_name().unwrap()).unwrap();
assert_eq!(json.contract_name, contract_name);
let function_name =
core::str::from_utf8(transaction.payload.function_name().unwrap()).unwrap();
assert_eq!(json.function_name, function_name);
// Test number of cuntion args
let num_args = transaction.payload.num_args().unwrap();
assert_eq!(json.num_args, num_args);
let origin = transaction.transaction_auth.origin();
let sponsor = transaction.transaction_auth.sponsor().unwrap();
assert_eq!(json.nonce, origin.nonce());
assert_eq!(json.fee as u32, origin.fee() as u32);
// Test origin and sponsor addresses
let origin_addr = origin.signer_address(transaction.version).unwrap();
let origin_addr = core::str::from_utf8(&origin_addr[..origin_addr.len()]).unwrap();
assert_eq!(json.sender, origin_addr);
let sponsor_addrs = sponsor.signer_address(transaction.version).unwrap();
let sponsor_addrs = core::str::from_utf8(&sponsor_addrs[..sponsor_addrs.len()]).unwrap();
assert_eq!(json.sponsor_addrs.unwrap(), sponsor_addrs);
assert!(Transaction::validate(&mut transaction).is_ok());
} | rust_cleaned_test_functions.jsonl/134591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 897
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
34741,
51499,
13429,
17805,
368,
341,
286,
1077,
1946,
2638,
284,
341,
310,
1077,
5206,
435,
284,
7933,
15064,
486,
931,
543,
310,
435,
2552,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fee_spike_violation_fails_htlc() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 95000000, InitFeatures::known(), InitFeatures::known());
let (route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[1], 3460001);
let secp_ctx = Secp256k1::new();
let session_priv = SecretKey::from_slice(&[42; 32]).expect("RNG is bad!");
let cur_height = nodes[1].node.best_block.read().unwrap().height() + 1;
let onion_keys = onion_utils::construct_onion_keys(&secp_ctx, &route.paths[0], &session_priv).unwrap();
let (onion_payloads, htlc_msat, htlc_cltv) = onion_utils::build_onion_payloads(&route.paths[0], 3460001, &Some(payment_secret), cur_height, &None).unwrap();
let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &payment_hash);
let msg = msgs::UpdateAddHTLC {
channel_id: chan.2,
htlc_id: 0,
amount_msat: htlc_msat,
payment_hash: payment_hash,
cltv_expiry: htlc_cltv,
onion_routing_packet: onion_packet,
};
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &msg);
// Now manually create the commitment_signed message corresponding to the update_add
let feerate_per_kw = get_feerate!(nodes[0], chan.2);
const INITIAL_COMMITMENT_NUMBER: u64 = (1 << 48) - 1;
let (local_revocation_basepoint, local_htlc_basepoint, local_secret, next_local_point, local_funding) = {
let chan_lock = nodes[0].node.channel_state.lock().unwrap();
let local_chan = chan_lock.by_id.get(&chan.2).unwrap();
let chan_signer = local_chan.get_signer();
chan_signer.get_enforcement_state().last_holder_commitment -= 1;
let pubkeys = chan_signer.pubkeys();
(pubkeys.revocation_basepoint, pubkeys.htlc_basepoint,
chan_signer.release_commitment_secret(INITIAL_COMMITMENT_NUMBER),
chan_signer.get_per_commitment_point(INITIAL_COMMITMENT_NUMBER - 2, &secp_ctx),
chan_signer.pubkeys().funding_pubkey)
};
let (remote_delayed_payment_basepoint, remote_htlc_basepoint, remote_point, remote_funding) = {
let chan_lock = nodes[1].node.channel_state.lock().unwrap();
let remote_chan = chan_lock.by_id.get(&chan.2).unwrap();
let chan_signer = remote_chan.get_signer();
let pubkeys = chan_signer.pubkeys();
(pubkeys.delayed_payment_basepoint, pubkeys.htlc_basepoint,
chan_signer.get_per_commitment_point(INITIAL_COMMITMENT_NUMBER - 1, &secp_ctx),
chan_signer.pubkeys().funding_pubkey)
};
// Assemble the set of keys we can use for signatures for our commitment_signed message.
let commit_tx_keys = chan_utils::TxCreationKeys::derive_new(&secp_ctx, &remote_point, &remote_delayed_payment_basepoint,
&remote_htlc_basepoint, &local_revocation_basepoint, &local_htlc_basepoint).unwrap();
// signature for the commitment_signed message.
let local_chan_balance = 1313;
let accepted_htlc_info = chan_utils::HTLCOutputInCommitment {
offered: false,
amount_msat: 3460001,
cltv_expiry: htlc_cltv,
payment_hash,
transaction_output_index: Some(1),
};
let commitment_number = INITIAL_COMMITMENT_NUMBER - 1;
let res = {
let local_chan_lock = nodes[0].node.channel_state.lock().unwrap();
let local_chan = local_chan_lock.by_id.get(&chan.2).unwrap();
let local_chan_signer = local_chan.get_signer();
let commitment_tx = CommitmentTransaction::new_with_auxiliary_htlc_data(
commitment_number,
95000,
local_chan_balance,
false, local_funding, remote_funding,
commit_tx_keys.clone(),
feerate_per_kw,
&mut vec![(accepted_htlc_info, ())],
&local_chan.channel_transaction_parameters.as_counterparty_broadcastable()
);
local_chan_signer.sign_counterparty_commitment(&commitment_tx, &secp_ctx).unwrap()
};
let commit_signed_msg = msgs::CommitmentSigned {
channel_id: chan.2,
signature: res.0,
htlc_signatures: res.1
};
// Send the commitment_signed message to the nodes[1].
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &commit_signed_msg);
let _ = nodes[1].node.get_and_clear_pending_msg_events();
// Send the RAA to nodes[1].
let raa_msg = msgs::RevokeAndACK {
channel_id: chan.2,
per_commitment_secret: local_secret,
next_per_commitment_point: next_local_point
};
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &raa_msg);
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
// Make sure the HTLC failed in the way we expect.
match events[0] {
MessageSendEvent::UpdateHTLCs { updates: msgs::CommitmentUpdate { ref update_fail_htlcs, .. }, .. } => {
assert_eq!(update_fail_htlcs.len(), 1);
update_fail_htlcs[0].clone()
},
_ => panic!("Unexpected event"),
};
nodes[1].logger.assert_log("lightning::ln::channel".to_string(),
format!("Attempting to fail HTLC due to fee spike buffer violation in channel {}. Rebalancing is required.", ::hex::encode(raa_msg.channel_id)), 1);
check_added_monitors!(nodes[1], 2);
} | rust_cleaned_test_functions.jsonl/16870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2069
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34305,
44920,
440,
2273,
24903,
367,
761,
6209,
49086,
17257,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
18343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_verify_votes_empty() {
solana_logger::setup();
let votes = vec![];
let labels = vec![];
let (vote_txs, packets) = ClusterInfoVoteListener::verify_votes(votes, labels);
assert!(vote_txs.is_empty());
assert!(packets.is_empty());
} | rust_cleaned_test_functions.jsonl/32281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
65116,
15124,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
12684,
284,
7486,
0,
15078,
286,
1077,
9201,
284,
7486,
0,
15078,
286,
1077,
320,
29358,
17805,
82,
11,
27035,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_number() {
let (shared, chain1, chain2) = prepare();
let dummy_context = dummy_context(&shared);
let uncle = chain1[18].as_uncle();
let block = chain2[17]
.clone()
.as_advanced_builder()
.uncle(uncle)
.header(chain2[17].header())
.build();
let epoch = epoch(&shared, &chain2, 16);
let uncle_verifier_context = UncleVerifierContext::new(&dummy_context, &epoch);
let verifier = UnclesVerifier::new(uncle_verifier_context, &block);
assert_eq!(
verifier.verify(),
Err(Error::Uncles(UnclesError::InvalidNumber))
);
} | rust_cleaned_test_functions.jsonl/118903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
5500,
368,
341,
262,
1077,
320,
6100,
11,
8781,
16,
11,
8781,
17,
8,
284,
10549,
543,
262,
1077,
17292,
8467,
284,
17292,
8467,
2099,
6100,
626,
262,
1077,
37494,
284,
8781,
16,
58,
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_bank_block_height() {
let (genesis_config, _mint_keypair) = create_genesis_config(1);
let bank0 = Arc::new(Bank::new(&genesis_config));
assert_eq!(bank0.block_height(), 0);
let bank1 = Arc::new(new_from_parent(&bank0));
assert_eq!(bank1.block_height(), 1);
} | rust_cleaned_test_functions.jsonl/2524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
7113,
9561,
368,
341,
286,
1077,
320,
77894,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
317,
286,
1077,
6073,
15,
284,
19689,
486,
931,
5349,
1180,
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_shift_left_wrap() {
let compiled = compile("SET A 1\nSHIFT_LEFT_W A");
let out_cpu = test_program(compiled);
assert_eq!(out_cpu.a.value, 2);
assert_eq!(out_cpu.f.value, 0);
} | rust_cleaned_test_functions.jsonl/63186 | {
"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,
22230,
9579,
38550,
368,
341,
262,
1077,
19697,
284,
19192,
445,
5884,
362,
220,
16,
1699,
45743,
19013,
2763,
362,
797,
262,
1077,
700,
21795,
284,
1273,
25096,
30008,
2181,
626,
262,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_first_child_is_not_empty() {
assert!(!execute_selector_query(
SIMPLE_LIST,
"li:first-child",
false,
false,
Span::test_data()
)
.is_empty())
} | rust_cleaned_test_functions.jsonl/121393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
17268,
6892,
7913,
15124,
368,
341,
286,
2060,
0,
3471,
10257,
28890,
5738,
1006,
310,
91484,
11899,
345,
310,
330,
742,
53374,
23484,
756,
310,
895,
345,
310,
895,
345,
310,
11903,
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 |
#[test]
fn test_recip() {
let nan: f32 = f32::NAN;
let inf: f32 = f32::INFINITY;
let neg_inf: f32 = f32::NEG_INFINITY;
assert_eq!(1.0f32.recip(), 1.0);
assert_eq!(2.0f32.recip(), 0.5);
assert_eq!((-0.4f32).recip(), -2.5);
assert_eq!(0.0f32.recip(), inf);
assert!(nan.recip().is_nan());
assert_eq!(inf.recip(), 0.0);
assert_eq!(neg_inf.recip(), 0.0);
} | rust_cleaned_test_functions.jsonl/8115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7080,
573,
368,
341,
286,
1077,
20021,
25,
282,
18,
17,
284,
282,
18,
17,
486,
45,
1093,
280,
286,
1077,
4132,
25,
282,
18,
17,
284,
282,
18,
17,
486,
687,
55990,
280,
286,
1077,
4184,
260... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_row_formatter_with_fs_type() {
let options = Options {
columns: COLUMNS_WITH_FS_TYPE.to_vec(),
block_size: BlockSize::Bytes(1),
..Default::default()
};
let row = Row {
file: Some("/path/to/file".to_string()),
fs_device: "my_device".to_string(),
fs_type: "my_type".to_string(),
fs_mount: "my_mount".to_string(),
bytes: 100,
bytes_used: 25,
bytes_avail: 75,
bytes_usage: Some(0.25),
#[cfg(target_os = "macos")]
bytes_capacity: Some(0.5),
inodes: 10,
inodes_used: 2,
inodes_free: 8,
inodes_usage: Some(0.2),
};
let fmt = RowFormatter::new(&row, &options);
assert_eq!(
fmt.get_values(),
vec!("my_device", "my_type", "100", "25", "75", "25%", "my_mount")
);
} | rust_cleaned_test_functions.jsonl/110419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
73965,
6615,
34470,
1819,
368,
341,
286,
1077,
2606,
284,
14566,
341,
310,
8147,
25,
356,
48770,
23929,
40398,
4189,
2389,
13251,
3148,
310,
2504,
2368,
25,
8362,
1695,
486,
7078,
7,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul() {
let v1 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let v2 = Vec3::new(2.0f64, 4.0f64, 6.0f64);
let v3 = Vec3::new(2.0f64, 8.0f64, 18.0f64);
assert_eq!(v1 * v2, v3);
assert_eq!(v2 * v1, v3);
} | rust_cleaned_test_functions.jsonl/120481 | {
"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,
24944,
368,
972,
286,
1077,
348,
16,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
69,
21,
19,
11,
220,
17,
13,
15,
69,
21,
19,
11,
220,
18,
13,
15,
69,
21,
19,
736,
286,
1077,
348,
17,
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_thai_bug() {
let original = "ำน\u{e49}ำ3ลำ".to_string();
let normalized = "านา3ลา".to_string();
assert_ne!(original, normalized);
let mut n = NormalizedString::from(original);
NFKD.normalize(&mut n).unwrap();
StripAccents.normalize(&mut n).unwrap();
Lowercase.normalize(&mut n).unwrap();
assert_eq!(&n.get(), &normalized);
} | rust_cleaned_test_functions.jsonl/42846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5854,
2143,
73232,
368,
341,
286,
1077,
4024,
284,
330,
75069,
20184,
3770,
90,
68,
19,
24,
92,
75069,
18,
130727,
3263,
983,
3904,
543,
286,
1077,
29410,
284,
330,
123895,
20774,
18,
124391,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bench_tps_local_cluster_solana() {
let mut config = Config::default();
config.tx_count = 100;
config.duration = Duration::from_secs(10);
test_bench_tps_local_cluster(config);
} | rust_cleaned_test_functions.jsonl/3258 | {
"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,
880,
19762,
528,
1690,
13564,
28441,
53668,
3362,
368,
341,
286,
1077,
5206,
2193,
284,
5532,
486,
2258,
543,
286,
2193,
33807,
3180,
284,
220,
16,
15,
15,
280,
286,
2193,
26265,
284,
21045,
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 |
#[test]
fn test_update_location_wrong_agent_for_org() {
let mock_context = MockTransactionContext::new();
mock_context.create_gs1_schema();
let perm_checker = PermissionChecker::new(&mock_context);
let mut state = LocationState::new(&mock_context);
create_default_location(&mut state, &perm_checker);
let properties = vec![
PropertyValueBuilder::new()
.with_name("locationName".into())
.with_data_type(DataType::String)
.with_string_value("Taco Alley".into())
.build()
.unwrap(),
PropertyValueBuilder::new()
.with_name("description".into())
.with_data_type(DataType::String)
.with_string_value("An alley filled with tacos".into())
.build()
.unwrap(),
];
let payload = LocationUpdateActionBuilder::new()
.with_location_id("9012345000004".into())
.with_namespace(LocationNamespace::GS1)
.with_properties(properties)
.build()
.unwrap();
match update_location(
&payload,
&mut state,
"agent_with_perms_no_prefix",
&perm_checker,
) {
Ok(()) => panic!("Unexpected positive result"),
Err(ApplyError::InvalidTransaction(ref msg)) => {
assert_eq!(
"Agent with public key agent_with_perms_no_prefix is not registered to prefix_org",
msg);
}
Err(err) => panic!("Wrong error: {}", err),
}
} | rust_cleaned_test_functions.jsonl/20017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 848
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
13126,
75198,
25730,
5478,
35583,
368,
341,
286,
1077,
7860,
8467,
284,
14563,
8070,
1972,
486,
931,
543,
286,
7860,
8467,
2520,
96930,
16,
25371,
1428,
286,
1077,
13854,
62715,
284,
18135,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lazy_shift() {
let df = get_df();
let new = df
.lazy()
.select([col("sepal.width").alias("foo").shift(2)])
.collect()
.unwrap();
assert_eq!(new.column("foo").unwrap().f64().unwrap().get(0), None);
} | rust_cleaned_test_functions.jsonl/112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
22230,
368,
341,
262,
1077,
6764,
284,
633,
10894,
543,
262,
1077,
501,
284,
6764,
198,
286,
659,
49013,
741,
286,
659,
1742,
2561,
2074,
445,
325,
19308,
5441,
1827,
14956,
445,
7975,
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_and_or_not_complex_case_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let name2 = _random_string(10);
let value2 = _random_string(10);
let name3 = _random_string(10);
let value3 = _random_string(10);
let name4 = _random_string(10);
let value4 = _random_string(10);
let name5 = _random_string(10);
let value5 = _random_string(10);
let name6 = _random_string(10);
let value6 = _random_string(10);
let name7 = _random_string(10);
let value7 = _random_string(10);
let name8 = _random_string(10);
let value8 = _random_string(10);
let json = format!(r#"{{"$not":{{"$and":[{{"~{}":"{}"}},{{"$or":[{{"~{}":{{"$gt":"{}"}}}},{{"$not":{{"~{}":{{"$lte":"{}"}}}}}},{{"$and":[{{"~{}":{{"$lt":"{}"}}}},{{"$not":{{"~{}":{{"$gte":"{}"}}}}}}]}}]}},{{"$not":{{"~{}":{{"$like":"{}"}}}}}},{{"$and":[{{"~{}":"{}"}},{{"$not":{{"~{}":{{"$neq":"{}"}}}}}}]}}]}}}}"#,
name1, value1,
name2, value2,
name3, value3,
name4, value4,
name5, value5,
name6, value6,
name7, value7,
name8, value8,
);
let query = parse_from_json(&json).unwrap();
let expected = Operator::Not(
Box::new(
Operator::And(
vec![
Operator::Eq(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
),
Operator::Or(
vec![
Operator::Gt(
TagName::PlainTagName(name2.to_vec()),
TargetValue::Unencrypted(value2.clone())
),
Operator::Not(
Box::new(
Operator::Lte(
TagName::PlainTagName(name3.to_vec()),
TargetValue::Unencrypted(value3.clone())
)
)
),
Operator::And(
vec![
Operator::Lt(
TagName::PlainTagName(name4.to_vec()),
TargetValue::Unencrypted(value4.clone())
),
Operator::Not(
Box::new(
Operator::Gte(
TagName::PlainTagName(name5.to_vec()),
TargetValue::Unencrypted(value5.clone())
)
)
),
]
)
]
),
Operator::Not(
Box::new(
Operator::Like(
TagName::PlainTagName(name6.to_vec()),
TargetValue::Unencrypted(value6.clone())
)
)
),
Operator::And(
vec![
Operator::Eq(
TagName::PlainTagName(name7.to_vec()),
TargetValue::Unencrypted(value7.clone())
),
Operator::Not(
Box::new(
Operator::Neq(
TagName::PlainTagName(name8.to_vec()),
TargetValue::Unencrypted(value8.clone())
)
)
),
]
)
]
)
)
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
8734,
7913,
41522,
19096,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
829,
17,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_packed_attestation_statement() {
let certificate: cbor::values::KeyType = cbor_bytes![vec![0x5C, 0x5C, 0x5C, 0x5C]];
let cbor_packed_attestation_statement = cbor_map! {
"alg" => 1,
"sig" => vec![0x55, 0x55, 0x55, 0x55],
"x5c" => cbor_array_vec![vec![certificate]],
"ecdaaKeyId" => vec![0xEC, 0xDA, 0x1D],
};
let packed_attestation_statement = PackedAttestationStatement {
alg: 1,
sig: vec![0x55, 0x55, 0x55, 0x55],
x5c: Some(vec![vec![0x5C, 0x5C, 0x5C, 0x5C]]),
ecdaa_key_id: Some(vec![0xEC, 0xDA, 0x1D]),
};
let created_cbor: cbor::Value = packed_attestation_statement.into();
assert_eq!(created_cbor, cbor_packed_attestation_statement);
} | rust_cleaned_test_functions.jsonl/49012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
620,
11191,
13356,
63978,
37404,
368,
341,
286,
1077,
15748,
25,
272,
9368,
486,
3661,
486,
97964,
284,
272,
9368,
12524,
20703,
4083,
20703,
15,
87,
20,
34,
11,
220,
15,
87,
20,
34,
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_raw_string_one_emptyline() {
// one newline
// the value takes the value of the newline??
let mut reader = Reader::init("```\n\n```");
assert_eq!(
raw_string(&mut reader).unwrap(),
RawString {
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 4, 2, 1),
},
value: Template {
quotes: false,
elements: vec![TemplateElement::String {
value: "\n".to_string(),
encoded: "\n".to_string(),
}],
source_info: SourceInfo::init(2, 1, 3, 1),
},
}
);
// one cr
let mut reader = Reader::init("```\n\r\n````");
assert_eq!(
raw_string(&mut reader).unwrap(),
RawString {
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 4, 2, 1),
},
value: Template {
quotes: false,
elements: vec![TemplateElement::String {
value: "\r\n".to_string(),
encoded: "\r\n".to_string(),
}],
source_info: SourceInfo::init(2, 1, 3, 1),
},
}
);
} | rust_cleaned_test_functions.jsonl/119584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 912
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
3904,
11667,
15124,
1056,
368,
341,
286,
442,
825,
39027,
198,
286,
442,
279,
897,
4990,
279,
897,
315,
279,
39027,
30,
5267,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
13874,
610... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_docker_saved_manifest_from_str() {
let data = r#"[
{
"Config": "48e2eeb489cdea15786d3622270750508d7385f3b684306703d17ffd50ecd34a.json",
"RepoTags": [
"a:latest"
],
"Layers": [
"4dc05cb02b54b373232011f781f8a98905d3e10575f2a399094f704d14913a7d/layer.tar"
]
}
]"#;
let manifests: DockerSavedManifest = data.parse().unwrap();
assert_eq!(manifests.images_manifests.len(), 1);
assert_eq!(manifests.images_manifests[0].repo_tags.len(), 1,);
assert_eq!(manifests.images_manifests[0].layers.len(), 1,);
assert_eq!(
manifests.images_manifests[0].config,
"48e2eeb489cdea15786d3622270750508d7385f3b684306703d17ffd50ecd34a.json"
);
} | rust_cleaned_test_functions.jsonl/21472 | {
"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,
814,
13659,
53709,
74269,
5673,
2895,
368,
341,
286,
1077,
821,
284,
435,
55543,
9640,
220,
341,
262,
330,
2648,
788,
330,
19,
23,
68,
17,
2127,
65,
19,
23,
24,
66,
55088,
16,
20,
22,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_real_as_duration() {
test_none_with_ctx_and_extra(cast_real_as_duration);
let cs: Vec<f64> = vec![
101112.0,
101112.123456,
1112.0,
12.0,
-0.123,
12345.0,
-123.0,
-23.0,
];
test_as_duration_helper(
cs,
|x| x.to_string(),
|x| x.to_string(),
|ctx, extra, val| {
let val = val.map(|x| Real::new(x).unwrap());
cast_real_as_duration(ctx, extra, val.as_ref())
},
"cast_real_as_duration",
)
} | rust_cleaned_test_functions.jsonl/1991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
11898,
25454,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
15266,
11898,
25454,
626,
286,
1077,
10532,
25,
11312,
63895,
21,
19,
29,
284,
7486,
90515,
310,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.