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_pop() {
let mut stack = Stack::new();
let _ = stack.push(U256::MAX);
assert_eq!(stack.pop(), Ok(U256::MAX));
} | rust_cleaned_test_functions.jsonl/90840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
368,
341,
286,
1077,
5206,
5611,
284,
14284,
486,
931,
1428,
286,
1077,
716,
284,
5611,
2552,
12317,
17,
20,
21,
486,
10586,
317,
286,
2060,
10714,
10297,
7693,
8288,
1507,
7622,
12317,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_construct_subtree_zero_siblings() {
let node_hash = HashValue::new([1; HashValue::LENGTH]);
let node = SparseMerkleNode::new_subtree(node_hash);
let subtree_node =
SparseMerkleTree::construct_subtree(std::iter::empty(), std::iter::empty(), Arc::new(node));
let smt = SparseMerkleTree { root: subtree_node };
assert_eq!(smt.root_hash(), node_hash);
} | rust_cleaned_test_functions.jsonl/15410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
5228,
9344,
19359,
643,
24229,
368,
341,
262,
1077,
2436,
8950,
284,
6531,
1130,
486,
931,
2561,
16,
26,
6531,
1130,
486,
65981,
2558,
262,
1077,
2436,
284,
71794,
44,
16754,
273,
1955,
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_nulls_parser() {
// test it does not fail on the leading comma.
let csv = r#"id1,id2,id3,id4,id5,id6,v1,v2,v3
id047,id023,id0000084849,90,96,35790,2,9,93.348148
,id022,id0000031441,50,44,71525,3,11,81.013682
id090,id048,id0000067778,24,2,51862,4,9,
"#;
let file = Cursor::new(csv);
let df = CsvReader::new(file)
.has_header(true)
.with_n_threads(Some(1))
.finish()
.unwrap();
assert_eq!(df.shape(), (3, 9));
} | rust_cleaned_test_functions.jsonl/57568 | {
"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,
15162,
82,
18517,
368,
341,
286,
442,
1273,
432,
1558,
537,
3690,
389,
279,
6388,
31683,
624,
286,
1077,
13147,
284,
435,
55543,
307,
16,
32999,
17,
32999,
18,
32999,
19,
32999,
20,
32999,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup_sbix() {
let font_buffer = read_fixture("tests/fonts/sbix/sbix-dupe.ttf");
let opentype_file = ReadScope::new(&font_buffer)
.read::<OpenTypeFont<'_>>()
.unwrap();
let font_table_provider = opentype_file
.table_provider(0)
.expect("error reading font file");
let mut font = Font::new(Box::new(font_table_provider))
.expect("error reading font data")
.expect("missing required font tables");
// Successfully read bitmap
match font.lookup_glyph_image(1, 100, BitDepth::ThirtyTwo) {
Ok(Some(BitmapGlyph {
bitmap: Bitmap::Encapsulated(EncapsulatedBitmap { data, .. }),
..
})) => {
assert_eq!(data.len(), 224);
}
_ => panic!("Expected encapsulated bitmap, got something else."),
}
// Successfully read bitmap pointed at by `dupe` record. Should end up returning data for
// glyph 1.
match font.lookup_glyph_image(2, 100, BitDepth::ThirtyTwo) {
Ok(Some(BitmapGlyph {
bitmap: Bitmap::Encapsulated(EncapsulatedBitmap { data, .. }),
..
})) => {
assert_eq!(data.len(), 224);
}
_ => panic!("Expected encapsulated bitmap, got something else."),
}
// level.
match font.lookup_glyph_image(3, 100, BitDepth::ThirtyTwo) {
Ok(None) => {}
_ => panic!("Expected Ok(None) got something else"),
}
} | rust_cleaned_test_functions.jsonl/62856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 815
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
55540,
941,
368,
341,
286,
1077,
3301,
7776,
284,
1349,
74409,
445,
23841,
60667,
2687,
65,
941,
2687,
65,
941,
97205,
375,
45192,
797,
286,
1077,
1179,
306,
499,
2458,
284,
4457,
10803,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_std_resync_collect() {
use prelude::*;
use std::collections::BTreeSet;
::init().unwrap();
let bin = ::Bin::new(None);
let id1 = ::ElementFactory::make("identity", None).unwrap();
let id2 = ::ElementFactory::make("identity", None).unwrap();
bin.add(&id1).unwrap();
let mut it = bin.iterate_elements().into_iter();
assert_eq!(it.next().unwrap().unwrap(), id1);
bin.add(&id2).unwrap();
let res = it.by_ref().collect::<Result<Vec<_>, _>>().unwrap_err();
assert_eq!(res, IteratorError::Resync);
let mut elems = BTreeSet::new();
elems.insert(id1);
elems.insert(id2);
let res = it.by_ref().collect::<Result<BTreeSet<_>, _>>().unwrap();
assert_eq!(res, elems);
let res = it.collect::<Result<Vec<_>, _>>().unwrap();
assert!(res.is_empty());
} | rust_cleaned_test_functions.jsonl/50300 | {
"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,
15656,
4918,
1721,
68140,
368,
341,
286,
990,
855,
52538,
56162,
286,
990,
1460,
486,
51137,
486,
33,
6533,
1649,
401,
286,
3504,
2327,
1005,
15454,
1428,
286,
1077,
9544,
284,
3504,
28794,
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_fake_playlist() {
let spotify = Spotify::default()
.client_credentials_manager(CLIENT_CREDENTIAL.lock().unwrap().clone())
.build();
let playlist = spotify.playlist("fake_id", None, None);
assert!(!playlist.is_ok());
} | rust_cleaned_test_functions.jsonl/96526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56881,
69267,
368,
341,
14808,
262,
1077,
87790,
284,
40537,
486,
2258,
741,
286,
659,
2972,
47396,
12144,
52991,
10757,
920,
81509,
21003,
1005,
15454,
1005,
19982,
2398,
286,
659,
5834,
1428,
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 |
#[test]
fn test_validate_signature_invalid_2() {
let channel_secret: &str = "channel_secret";
let signature: &str = "xxxxxxxxxxxxx";
let request_body: &str = r#"
{
"destination": "xxxxxxxxxx",
"events": [
{
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"type": "message",
"mode": "active",
"timestamp": 1462629479859,
"source": {
"type": "user",
"userId": "U4af4980629..."
},
"message": {
"id": "325708",
"type": "text",
"text": "@example Hello, world! (love)",
"emojis": [
{
"index": 14,
"length": 6,
"productId": "5ac1bfd5040ab15980c9b435",
"emojiId": "001"
}
],
"mention": {
"mentionees": [
{
"index": 0,
"length": 8,
"userId": "U850014438e..."
}
]
}
}
}
]
}
"#;
assert_eq!(
false,
webhook::validate_signature(channel_secret, signature, request_body)
);
} | rust_cleaned_test_functions.jsonl/78228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1030
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
39859,
31433,
62,
17,
368,
341,
286,
1077,
5496,
21962,
25,
609,
495,
284,
330,
10119,
21962,
876,
286,
1077,
11957,
25,
609,
495,
284,
330,
44102,
18516,
87,
876,
286,
1077,
1681,
14114,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_l2_ph() {
// tested w/ numpy
let r = 2.0;
let c = 1.0;
assert_eq!(0.609548422215397, l2_ph(r, c) as f32);
} | rust_cleaned_test_functions.jsonl/118131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
17,
9782,
368,
341,
286,
442,
12510,
289,
14,
8591,
198,
286,
1077,
435,
284,
220,
17,
13,
15,
280,
286,
1077,
272,
284,
220,
16,
13,
15,
280,
286,
2060,
10714,
10297,
15,
13,
21,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_length() {
let mut xof = baokeshed::Hasher::new().update(b"foo").finalize_xof();
let mut expected = String::new();
expected.push_str(&hex::encode(&xof.read()[..]));
expected.push_str(&hex::encode(&xof.read()[..36]));
let output = cmd!(baokeshed_exe(), "--length=100")
.stdin_bytes("foo")
.read()
.unwrap();
assert_eq!(&*expected, &*output);
} | rust_cleaned_test_functions.jsonl/40679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
5118,
368,
341,
262,
1077,
5206,
856,
1055,
284,
12789,
562,
4288,
291,
486,
6370,
261,
486,
931,
1005,
2386,
1883,
1,
7975,
1827,
94405,
3212,
1055,
543,
262,
1077,
5206,
3601,
284,
923,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_xyz_f32_rgba_u8_le() {
let points = points_from_file("src/test_data/xyz_f32_rgba_u8_le.ply");
assert_eq!(8, points.len());
assert_eq!(points[0].position.x, 1.);
assert_eq!(points[7].position.x, 22.);
assert_eq!(points[0].r, 255);
assert_eq!(points[7].r, 227);
} | rust_cleaned_test_functions.jsonl/120528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64974,
761,
18,
17,
95229,
7300,
23,
11751,
368,
341,
286,
1077,
3501,
284,
3501,
5673,
2458,
445,
3548,
12697,
1769,
14,
28854,
761,
18,
17,
95229,
7300,
23,
11751,
556,
398,
797,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_mut_handle() {
let hw = RefCell::new(CpuHardware::new());
unsafe {
let mut buf = Buffer::raw(&hw, 1);
assert!(ptr::eq(buf.as_mut_handle(), buf.handle));
}
} | rust_cleaned_test_functions.jsonl/78623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
29523,
10630,
368,
341,
286,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
286,
19860,
341,
310,
1077,
5206,
6607,
284,
10312,
486,
1041,
2099,
27827,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_tombstone_regions() {
let debugger = new_debugger();
debugger.set_store_id(11);
let engine = debugger.engines.kv.as_ref();
let region_1 = init_region_state(engine, 1, &[11, 12, 13]);
let mut target_region_1 = region_1.clone();
target_region_1.mut_peers().remove(0);
target_region_1.mut_region_epoch().set_conf_ver(100);
let region_2 = init_region_state(engine, 2, &[11, 12, 13]);
let mut target_region_2 = region_2.clone();
target_region_2.mut_peers()[0].set_id(100);
target_region_2.mut_region_epoch().set_conf_ver(100);
let region_3 = init_region_state(engine, 3, &[21, 22, 23]);
// Got the target region from pd but the peers are not changed.
let mut target_region_3 = region_3;
target_region_3.mut_region_epoch().set_conf_ver(100);
let target_regions = vec![
target_region_1.clone(),
target_region_2.clone(),
target_region_3,
];
let errors = debugger.set_region_tombstone(target_regions).unwrap();
assert_eq!(errors.len(), 1);
assert_eq!(errors[0].0, 3);
assert_eq!(get_region_state(engine, 1).take_region(), region_1);
assert_eq!(get_region_state(engine, 2).take_region(), region_2);
let target_regions = vec![target_region_1, target_region_2];
let errors = debugger.set_region_tombstone(target_regions).unwrap();
assert!(errors.is_empty());
for ®ion_id in &[1, 2] {
let state = get_region_state(engine, region_id).get_state();
assert_eq!(state, PeerState::Tombstone);
}
} | rust_cleaned_test_functions.jsonl/60236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 842
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
2855,
10812,
58035,
368,
341,
286,
1077,
44473,
284,
501,
15446,
1389,
543,
286,
44473,
980,
14809,
842,
7,
16,
16,
317,
286,
1077,
4712,
284,
44473,
90413,
1543,
5202,
85,
5357,
7793,
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... | 2 |
#[test]
fn test_sync() {
let m = Arc::new({
let mut r = TestSync::new();
r.set_int32_field(23);
r
});
let threads: Vec<_> = (0..4)
.map(|_| {
let m_copy = m.clone();
thread::spawn(move || {
let bytes = m_copy.write_to_bytes().unwrap();
let mut is = CodedInputStream::from_bytes(&bytes);
let mut read = TestSync::new();
// API is not very convenient here
read.merge_from(&mut is).unwrap();
read.check_initialized().unwrap();
read.get_int32_field()
})
}).collect();
let results = threads
.into_iter()
.map(|t| t.join().unwrap())
.collect::<Vec<_>>();
assert_eq!(&[23, 23, 23, 23], &results[..]);
} | rust_cleaned_test_functions.jsonl/7171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23008,
368,
341,
262,
1077,
296,
284,
19689,
486,
931,
2262,
286,
1077,
5206,
435,
284,
3393,
12154,
486,
931,
543,
286,
435,
980,
4042,
18,
17,
5013,
7,
17,
18,
317,
286,
435,
198,
262,
301... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cmd_cov_increment() {
#[cfg(target_os = "linux")]
const MAIN_EXE: &str = "/main.exe";
#[cfg(target_os = "linux")]
const SOME_DLL: &str = "/lib/some.dll";
#[cfg(target_os = "windows")]
const MAIN_EXE: &str = r"c:\main.exe";
#[cfg(target_os = "windows")]
const SOME_DLL: &str = r"c:\lib\some.dll";
let main_exe = module_path(MAIN_EXE);
let some_dll = module_path(SOME_DLL);
let mut coverage = CommandBlockCov::default();
coverage.insert(&main_exe, vec![1, 20, 300].into_iter());
coverage.increment(&main_exe, 20);
coverage.increment(&some_dll, 123);
coverage.increment(&some_dll, 456);
coverage.increment(&some_dll, 789);
let expected = cmd_cov_from_vec(vec![
(MAIN_EXE, vec![(1, 0), (20, 1), (300, 0)]),
(SOME_DLL, vec![(123, 1), (456, 1), (789, 1)]),
]);
assert_eq!(coverage, expected);
} | rust_cleaned_test_functions.jsonl/19541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 525
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11684,
50028,
51482,
368,
341,
286,
11506,
14072,
8637,
29387,
284,
330,
14210,
5422,
286,
733,
34339,
4966,
36,
25,
609,
495,
284,
3521,
3817,
19399,
3302,
286,
11506,
14072,
8637,
29387,
284,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type_lines() {
let db = Db::download(false).expect("failed to download test card db");
test_type_line(&db, "Dark Depths", "Legendary Snow Land");
test_type_line(&db, "Hammer of Purphoros", "Legendary Enchantment Artifact");
test_type_line(&db, "My Laughter Echoes", "Ongoing Scheme");
test_type_line(&db, "Plains", "Basic Land — Plains");
test_type_line(&db, "Pools of Becoming", "Plane — Bolas's Meditation Realm");
test_type_line(&db, "Reaper King", "Legendary Artifact Creature — Scarecrow");
test_type_line(&db, "Sliver Queen Avatar", "Vanguard");
test_type_line(&db, "Snow-Covered Mountain", "Basic Snow Land — Mountain");
test_type_line(&db, "Taiga", "Land — Mountain Forest");
test_type_line(&db, "Urza's Power Plant", "Land — Urza's Power-Plant");
} | rust_cleaned_test_functions.jsonl/35053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
18323,
368,
341,
286,
1077,
2927,
284,
11988,
486,
12885,
3576,
568,
17119,
445,
16091,
311,
4139,
1273,
3701,
2927,
797,
286,
1273,
1819,
6528,
2099,
1999,
11,
330,
25830,
95918,
497,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init() {
let m = METRICS.deref();
let res = m.write();
assert!(res.is_ok() && !res.unwrap());
let f = TempFile::new().expect("Failed to create temporary metrics file");
assert!(m.init(Box::new(f.into_file()),).is_ok());
assert!(m.write().is_ok());
let f = TempFile::new().expect("Failed to create temporary metrics file");
assert!(m.init(Box::new(f.into_file()),).is_err());
} | rust_cleaned_test_functions.jsonl/34302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
368,
341,
286,
1077,
296,
284,
36822,
84172,
950,
43970,
1428,
1789,
286,
1077,
592,
284,
296,
3836,
543,
286,
2060,
10297,
416,
2079,
19817,
368,
1009,
753,
416,
55395,
5231,
286,
1077,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_account_serialization() {
let example_key = AccountKey(
TendermintKey::from_raw_secp256k1(&hex::decode_upper(EXAMPLE_ACCOUNT_KEY).unwrap())
.unwrap(),
);
assert_eq!(
example_key.to_string(),
"icp1addwnpepq2skx090esq7h7md0r3e76r6ruyet330e904r6k3pgpwuzl92x6acs03va4"
);
} | rust_cleaned_test_functions.jsonl/62137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
25602,
2022,
368,
341,
286,
1077,
3110,
3097,
284,
8615,
1592,
1006,
310,
93867,
67791,
1592,
486,
1499,
16067,
3453,
4672,
17,
20,
21,
74,
16,
2099,
17308,
486,
18196,
34445,
25409,
18918,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_instance() -> Result<()> {
let mut url = TremorUrl::parse("tremor://127.0.0.1:1234/pipeline/main")?;
assert_eq!(Scope::Artefact, url.scope());
assert_eq!(Some(ResourceType::Pipeline), url.resource_type());
assert_eq!(Some("main"), url.artefact());
assert_eq!(None, url.instance());
url.set_instance("inst");
assert_eq!(Scope::Servant, url.scope());
assert_eq!(Some("inst"), url.instance());
Ok(())
} | rust_cleaned_test_functions.jsonl/103508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
11904,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
2515,
284,
75163,
269,
2864,
486,
6400,
445,
83,
1826,
269,
1110,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
16,
17,
18,
19,
4322,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_for_dir() {
let project_dir = fixture_path("hooks/project");
let hooks = HookConfig::for_dir(&project_dir)
.expect("Could not read project hooks.json")
.expect("Could not find project hooks.json");
let node = hooks.node.unwrap();
assert_eq!(
node.distro,
Some(tool::DistroHook::Bin(
"/some/bin/for/node/distro".to_string()
))
);
assert_eq!(
node.latest,
Some(tool::MetadataHook::Bin(
"/some/bin/for/node/latest".to_string()
))
);
assert_eq!(
node.index,
Some(tool::MetadataHook::Bin(
"/some/bin/for/node/index".to_string()
))
);
assert_eq!(
hooks.events.unwrap().publish,
Some(Publish::Bin("/events/bin".to_string()))
);
} | rust_cleaned_test_functions.jsonl/57371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
4334,
368,
341,
286,
1077,
2390,
4334,
284,
12507,
2638,
445,
38560,
40118,
797,
286,
1077,
29677,
284,
28171,
2648,
486,
1958,
4334,
2099,
4987,
4334,
340,
310,
659,
17119,
445,
12895,
537,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_add_full() {
let mut assr = Assembler::new(16);
assert_eq!(assr.add(0, 16), Ok(()));
assert_eq!(assr, contigs![(0, 16)]);
} | rust_cleaned_test_functions.jsonl/52001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
2891,
16372,
368,
341,
286,
1077,
5206,
1071,
81,
284,
1634,
35401,
486,
931,
7,
16,
21,
317,
286,
2060,
10714,
10297,
395,
81,
1364,
7,
15,
11,
220,
16,
21,
701,
7622,
5065,
1106,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_nat_type_default() -> Result<(), Error> {
let nat = NetworkAddressTranslator::new(NatConfig {
mapped_ips: vec![IpAddr::from_str(DEMO_IP)?],
..Default::default()
})?;
assert_eq!(
EndpointDependencyType::EndpointIndependent,
nat.nat_type.mapping_behavior,
"should match"
);
assert_eq!(
EndpointDependencyType::EndpointIndependent,
nat.nat_type.filtering_behavior,
"should match"
);
assert!(!nat.nat_type.hair_pining, "should be false");
assert!(!nat.nat_type.port_preservation, "should be false");
assert_eq!(
DEFAULT_NAT_MAPPING_LIFE_TIME, nat.nat_type.mapping_life_time,
"should be false"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/104261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38169,
1819,
9993,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
17588,
284,
8141,
4286,
51653,
486,
931,
8204,
266,
2648,
341,
286,
23844,
71074,
25,
7486,
20703,
23378,
13986,
486,
1499,
289... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_should_halt() {
let keypair = Keypair::new();
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0);
let cluster_info = new_test_cluster_info(contact_info);
let cluster_info = Arc::new(cluster_info);
let mut trusted_validators = HashSet::new();
let mut slot_to_hash = HashMap::new();
assert!(!AccountsHashVerifier::should_halt(
&cluster_info,
Some(&trusted_validators),
&mut slot_to_hash,
));
let validator1 = Keypair::new();
let hash1 = hash(&[1]);
let hash2 = hash(&[2]);
{
let message = make_accounts_hashes_message(&validator1, vec![(0, hash1)]).unwrap();
cluster_info.push_message(message);
cluster_info.flush_push_queue();
}
slot_to_hash.insert(0, hash2);
trusted_validators.insert(validator1.pubkey());
assert!(AccountsHashVerifier::should_halt(
&cluster_info,
Some(&trusted_validators),
&mut slot_to_hash,
));
} | rust_cleaned_test_functions.jsonl/69339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
1523,
3145,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
1428,
286,
1077,
3645,
3109,
284,
9180,
1731,
486,
931,
62,
8301,
2099,
792,
12670,
47773,
792,
1507,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vex_wig_lig() {
#[rustfmt::skip]
let tests = [
("C5CA 10 CD", "C5CA 10 CD", Code::VEX_Vmovss_xmm_xmm_xmm, 0, 0),
("C5CA 10 CD", "C5CE 10 CD", Code::VEX_Vmovss_xmm_xmm_xmm, 0, 1),
("C5CA 10 CD", "C5CA 10 CD", Code::VEX_Vmovss_xmm_xmm_xmm, 1, 0),
("C5CA 10 CD", "C5CE 10 CD", Code::VEX_Vmovss_xmm_xmm_xmm, 1, 1),
("C4414A 10 CD", "C4414A 10 CD", Code::VEX_Vmovss_xmm_xmm_xmm, 0, 0),
("C4414A 10 CD", "C4414E 10 CD", Code::VEX_Vmovss_xmm_xmm_xmm, 0, 1),
("C4414A 10 CD", "C441CA 10 CD", Code::VEX_Vmovss_xmm_xmm_xmm, 1, 0),
("C4414A 10 CD", "C441CE 10 CD", Code::VEX_Vmovss_xmm_xmm_xmm, 1, 1),
("C5F9 50 D3", "C5F9 50 D3", Code::VEX_Vmovmskpd_r32_xmm, 0, 0),
("C5F9 50 D3", "C5F9 50 D3", Code::VEX_Vmovmskpd_r32_xmm, 0, 1),
("C5F9 50 D3", "C5F9 50 D3", Code::VEX_Vmovmskpd_r32_xmm, 1, 0),
("C5F9 50 D3", "C5F9 50 D3", Code::VEX_Vmovmskpd_r32_xmm, 1, 1),
("C4C179 50 D3", "C4C179 50 D3", Code::VEX_Vmovmskpd_r32_xmm, 0, 0),
("C4C179 50 D3", "C4C179 50 D3", Code::VEX_Vmovmskpd_r32_xmm, 0, 1),
("C4C179 50 D3", "C4C179 50 D3", Code::VEX_Vmovmskpd_r32_xmm, 1, 0),
("C4C179 50 D3", "C4C179 50 D3", Code::VEX_Vmovmskpd_r32_xmm, 1, 1),
];
for tc in &tests {
let (hex_bytes, expected_bytes, code, wig, lig) = *tc;
let hex_bytes = to_vec_u8(hex_bytes).unwrap();
let mut decoder = create_decoder(64, &hex_bytes, 0).0;
let instr = decoder.decode();
assert_eq!(code, instr.code());
let mut encoder = Encoder::new(decoder.bitness());
encoder.set_vex_wig(wig);
encoder.set_vex_lig(lig);
let _ = encoder.encode(&instr, instr.ip()).unwrap();
let encoded_bytes = encoder.take_buffer();
let expected_bytes = to_vec_u8(expected_bytes).unwrap();
assert_eq!(expected_bytes, encoded_bytes);
}
} | rust_cleaned_test_functions.jsonl/46965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 944
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
327,
1670,
343,
907,
343,
368,
341,
197,
13353,
35788,
12501,
486,
20599,
921,
10217,
7032,
284,
2278,
197,
197,
445,
34,
20,
5049,
220,
16,
15,
11078,
497,
330,
34,
20,
5049,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_repeating_key_xor() {
// Set 1 Challenge 5
let input = "Burning 'em, if you ain't quick and nimble\nI go crazy when I hear a cymbal";
let output = xor_repeating(input.as_bytes(), "ICE".as_bytes()).to_hex();
let expected = "0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f";
assert_eq!(output, expected);
} | rust_cleaned_test_functions.jsonl/74993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
64877,
3097,
76462,
368,
341,
286,
442,
2573,
220,
16,
25257,
220,
20,
198,
286,
1077,
1946,
284,
330,
33,
53344,
364,
336,
11,
421,
498,
36102,
944,
3974,
323,
45692,
891,
1699,
40,
728... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_axis() {
let a = arr2(&[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]);
let b = a.map_axis(Axis(0), |view| view.sum());
let answer1 = arr1(&[22, 26, 30]);
assert_eq!(b, answer1);
let c = a.map_axis(Axis(1), |view| view.sum());
let answer2 = arr1(&[6, 15, 24, 33]);
assert_eq!(c, answer2);
// Test zero-length axis case
let arr = Array3::<f32>::zeros((3, 0, 4));
let mut counter = 0;
let result = arr.map_axis(Axis(1), |x| {
assert_eq!(x.shape(), &[0]);
counter += 1;
counter
});
assert_eq!(result.shape(), &[3, 4]);
itertools::assert_equal(result.iter().cloned().sorted(), 1..=3 * 4);
let mut arr = Array3::<f32>::zeros((3, 0, 4));
let mut counter = 0;
let result = arr.map_axis_mut(Axis(1), |x| {
assert_eq!(x.shape(), &[0]);
counter += 1;
counter
});
assert_eq!(result.shape(), &[3, 4]);
itertools::assert_equal(result.iter().cloned().sorted(), 1..=3 * 4);
} | rust_cleaned_test_functions.jsonl/92634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
23567,
368,
341,
262,
1077,
264,
284,
2890,
17,
2099,
15505,
16,
11,
220,
17,
11,
220,
18,
1125,
508,
19,
11,
220,
20,
11,
220,
21,
1125,
508,
22,
11,
220,
23,
11,
220,
24,
1125,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_332() {
assert_eq!(Solution::find_itinerary(vec![vec_string!["MUC","LHR"],vec_string!["JFK","MUC"],vec_string!["SFO","SJC"],vec_string!["LHR","SFO"]]), vec_string!["JFK","MUC","LHR","SFO","SJC"]);
assert_eq!(Solution::find_itinerary(vec![vec_string!["JFK","SFO"],vec_string!["JFK","ATL"],vec_string!["SFO","ATL"],vec_string!["ATL","JFK"],vec_string!["ATL","SFO"]]), vec_string!["JFK","ATL","JFK","SFO","ATL","SFO"]);
assert_eq!(Solution::find_itinerary(vec![vec_string!["EZE","AXA"],vec_string!["TIA","ANU"],vec_string!["ANU","JFK"],vec_string!["JFK","ANU"],vec_string!["ANU","EZE"],vec_string!["TIA","ANU"],vec_string!["AXA","TIA"],vec_string!["TIA","JFK"],vec_string!["ANU","TIA"],vec_string!["JFK","TIA"]]), vec_string!["JFK","ANU","EZE","AXA","TIA","ANU","JFK","TIA","ANU","TIA","JFK"]);
} | rust_cleaned_test_functions.jsonl/33853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
18,
18,
17,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
3903,
14631,
51553,
25592,
20703,
4083,
3904,
0,
1183,
44,
5459,
2198,
43,
17088,
7914,
4083,
3904,
0,
1183,
41,
26998,
2198,
44,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_visitor_works() {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(super::language())
.expect("Error loading dummy language");
let src = "1 + 2";
let parsed = parser.parse(src, None).expect("Could not parse");
let root_node = parsed.root_node();
let mut visitor = Calculator { src };
let result = visitor.visit(&root_node);
assert_eq!(result, 3.0);
} | rust_cleaned_test_functions.jsonl/36981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81364,
11498,
82,
368,
341,
286,
1077,
5206,
6729,
284,
4916,
643,
3248,
486,
6570,
486,
931,
543,
286,
6729,
198,
310,
659,
746,
29021,
56040,
486,
11528,
2398,
310,
659,
17119,
445,
1454,
8277... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normal() {
let dummy_information = BallotInfo {
date: "today".to_owned(),
device_info: "this device".to_owned(),
time: "right now".to_owned(),
tracker: "123456".to_owned(),
};
let e = Election {
parameters: Parameters {
location: "right here".to_owned(),
date: "right now".to_owned(),
num_trustees: BigUint::from(5_u32),
threshold: BigUint::from(3_u32),
prime: prime().clone(),
generator: generator().clone(),
},
cast_ballots: vec![
Ballot {
information: dummy_information.clone(),
contests: vec![
Contest { selections: vec![true, false, false] },
Contest { selections: vec![false, true, false] },
Contest { selections: vec![false, false, true] },
],
},
Ballot {
information: dummy_information.clone(),
contests: vec![
Contest { selections: vec![false, true, false] },
Contest { selections: vec![false, false, true] },
Contest { selections: vec![false, false, true] },
],
},
],
spoiled_ballots: vec![
Ballot {
information: dummy_information.clone(),
contests: vec![
Contest { selections: vec![false, false, true] },
Contest { selections: vec![false, true, false] },
Contest { selections: vec![true, false, false] },
],
},
],
trustees_present: vec![true, true, true, true, true],
};
let record = generate::generate(&mut rand::thread_rng(), e);
match check::check(&record) {
Ok(()) => {},
Err(errs) => {
for err in &errs {
eprintln!("{}", err);
}
panic!("check failed with {} errors", errs.len());
},
}
} | rust_cleaned_test_functions.jsonl/63824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1089
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13973,
368,
341,
262,
1077,
17292,
35212,
284,
12836,
354,
1731,
341,
286,
2400,
25,
330,
30113,
3263,
983,
51973,
3148,
286,
3671,
3109,
25,
330,
574,
3671,
3263,
983,
51973,
3148,
286,
882,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_empty_formdata() {
let writer = FormDataWriter::new();
let item = writer.into_item();
let payload = item.payload();
let iter = FormDataIter::new(&payload);
let entries: Vec<_> = iter.collect();
assert_eq!(entries, vec![]);
} | rust_cleaned_test_functions.jsonl/93691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
7915,
691,
368,
341,
286,
1077,
6916,
284,
46593,
6492,
486,
931,
543,
286,
1077,
1509,
284,
6916,
39860,
5634,
1428,
286,
1077,
7729,
284,
1509,
17492,
543,
286,
1077,
5367,
284,
46593,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assert_panics_expect_at_most_with_too_many_requests() {
let mock = mock("GET", "/hello").expect_at_most(3).create();
request("GET /hello", "");
request("GET /hello", "");
request("GET /hello", "");
request("GET /hello", "");
mock.assert();
} | rust_cleaned_test_functions.jsonl/82436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
71099,
1211,
68918,
3752,
81416,
6615,
2346,
78,
22101,
37216,
368,
341,
262,
1077,
7860,
284,
7860,
445,
3806,
497,
3521,
14990,
1827,
17119,
3752,
81416,
7,
18,
568,
3182,
1428,
262,
1681... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rekha() {
run_test(
&TEST_DATA,
"harfbuzz/good-rekha.gu",
"gujarati/Rekha.ttf",
&[JOINER_GLYPH_INDEX],
554,
);
} | rust_cleaned_test_functions.jsonl/91159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
74,
4223,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
12982,
10798,
8889,
4846,
1386,
5504,
74,
4223,
1302,
84,
756,
503,
330,
8717,
19033,
9307,
14,
693,
74,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_highest_block_and_quorum_cert() {
let mut inserter = TreeInserter::default();
let block_store = inserter.block_store();
assert_eq!(
block_store.highest_certified_block().block(),
&Block::make_genesis_block()
);
assert_eq!(
block_store.highest_quorum_cert().as_ref(),
&certificate_for_genesis()
);
let genesis = block_store.root();
// Genesis block and quorum certificate is still the highest
let block_round_1 = inserter.insert_block_with_qc(certificate_for_genesis(), &genesis, 1);
assert_eq!(
block_store.highest_certified_block().block(),
&Block::make_genesis_block()
);
assert_eq!(
block_store.highest_quorum_cert().as_ref(),
&certificate_for_genesis()
);
// block_round_1 block and quorum certificate is now the highest
let block_round_3 = inserter.insert_block(&block_round_1, 3, None);
assert_eq!(block_store.highest_certified_block(), block_round_1);
assert_eq!(
block_store.highest_quorum_cert().as_ref(),
block_store
.get_block(block_round_3.id())
.expect("block_round_1 should exist")
.quorum_cert()
);
// also builds on block_round_1
let block_round_4 = inserter.insert_block(&block_round_1, 4, None);
assert_eq!(block_store.highest_certified_block(), block_round_1);
assert_eq!(
block_store.highest_quorum_cert().as_ref(),
block_store
.get_block(block_round_4.id())
.expect("block_round_1 should exist")
.quorum_cert()
);
} | rust_cleaned_test_functions.jsonl/50982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 719
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
7504,
7113,
8378,
11280,
33006,
37097,
368,
341,
262,
1077,
5206,
47325,
465,
284,
8942,
641,
90727,
486,
2258,
543,
262,
1077,
2504,
14809,
284,
47325,
465,
15697,
14809,
543,
262,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_generate_c_macho() {
let dwarf: &[u8] = include_bytes!("./test_resources/dwarf_parse_test_macho");
let expected: &[u8] = include_bytes!("./test_resources/dwarf_parse_test_macho_expected.c");
let module = Module::parse("user".to_owned(), "User module description".to_owned(), dwarf);
assert!(module.is_ok());
let module = module.unwrap();
let mut binding: Cursor<Vec<u8>> = Cursor::new(Vec::new());
let _ = generate_module(module, &mut binding);
assert_eq!(&*binding.into_inner(), expected);
} | rust_cleaned_test_functions.jsonl/89880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
48851,
666,
717,
63429,
368,
341,
286,
1077,
49461,
25,
44590,
84,
23,
60,
284,
2924,
12524,
0,
13988,
1944,
35569,
3446,
32634,
21039,
4452,
717,
63429,
797,
286,
1077,
3601,
25,
44590,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_long_entry() {
let long_string = "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to heaven, we were all going direct the other way - in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.".to_string();
assert_eq!(bill_hash(long_string), 0x7391BAE2DB358FF4);
} | rust_cleaned_test_functions.jsonl/54044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
17799,
9078,
368,
341,
286,
1077,
1293,
3904,
284,
330,
2132,
572,
279,
1850,
315,
3039,
11,
432,
572,
279,
11785,
315,
3039,
11,
432,
572,
279,
4231,
315,
23389,
11,
432,
572,
279,
4231... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mark_as_committed_twice() {
let mut block_tree = create_block_tree();
block_tree.mark_as_committed(id(9), ()).unwrap();
let res = block_tree.mark_as_committed(id(9), ());
assert_eq!(
res.err().unwrap(),
CommitBlockError::BlockAlreadyMarkedAsCommitted { id: id(9) }
);
} | rust_cleaned_test_functions.jsonl/87718 | {
"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,
18924,
11898,
2965,
5483,
54178,
558,
368,
341,
262,
1077,
5206,
2504,
11663,
284,
1855,
7113,
11663,
543,
262,
2504,
11663,
18406,
11898,
2965,
5483,
3724,
7,
24,
701,
1719,
568,
15454,
543,
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_a_or_b() {
// let mut first: u64 = 0;
// let total: u32 = 100_000;
let a: u64 = thread_rng().gen();
let b: u64 = thread_rng().gen();
let result = a_or_b(a, b);
assert!(result == a || result == b);
// if result == a {
// first += 1;
// let percentage = first as f64 / total as f64;
} | rust_cleaned_test_functions.jsonl/101299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
8734,
880,
368,
341,
262,
442,
1077,
5206,
1156,
25,
575,
21,
19,
284,
220,
15,
280,
262,
442,
1077,
2790,
25,
575,
18,
17,
284,
220,
16,
15,
15,
62,
15,
15,
15,
280,
1066,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rename_for_mut_param() {
test_rename(
r#"
fn foo(mut i<|> : u32) -> u32 {
i
}"#,
"new_name",
r#"
fn foo(mut new_name : u32) -> u32 {
new_name
}"#,
);
} | rust_cleaned_test_functions.jsonl/16215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79399,
5478,
29523,
4090,
368,
341,
286,
1273,
79399,
1006,
310,
435,
2,
698,
262,
5168,
15229,
70305,
600,
27,
91,
29,
549,
575,
18,
17,
8,
1464,
575,
18,
17,
341,
286,
600,
198,
262,
335,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_getter_setter_only() {
let mut fb = FooBar(0);
fb.setter_only(0x7);
assert_eq!(0x1C, fb.0);
assert_eq!(0x6, fb.getter_only());
} | rust_cleaned_test_functions.jsonl/2264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
465,
2602,
465,
18410,
368,
341,
262,
1077,
5206,
25469,
284,
33428,
3428,
7,
15,
317,
262,
25469,
46594,
18410,
7,
15,
87,
22,
317,
262,
2060,
10714,
10297,
15,
87,
16,
34,
11,
25469,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bool() {
let yason = Scalar::bool(true).unwrap();
assert_eq!(yason.data_type().unwrap(), DataType::Bool);
let value = yason.bool().unwrap();
assert!(value);
// test from vec
let mut bytes: Vec<u8> = Vec::with_capacity(128);
let yason = Scalar::bool_with_vec(true, &mut bytes).unwrap();
assert_eq!(yason.data_type().unwrap(), DataType::Bool);
let value = yason.bool().unwrap();
assert!(value);
// test from used vec
let mut bytes: Vec<u8> = Vec::with_capacity(128);
let yason = Scalar::bool_with_vec(true, &mut bytes).unwrap();
assert_eq!(yason.data_type().unwrap(), DataType::Bool);
let value = yason.bool().unwrap();
assert!(value);
} | rust_cleaned_test_functions.jsonl/61287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
368,
341,
262,
1077,
379,
1497,
284,
35176,
486,
2641,
3715,
568,
15454,
543,
262,
2060,
10714,
10297,
88,
1497,
2196,
1819,
1005,
15454,
1507,
33172,
486,
11233,
317,
262,
1077,
897,
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_more_stakes_gets_more_maturity() {
assert_eq!(compute_maturities(vec![3, 1], vec!["Py"]), vec![75, 25]);
assert_eq!(compute_maturities(vec![3, 1], vec!["yP"]), vec![75, 25]);
} | rust_cleaned_test_functions.jsonl/1137 | {
"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,
36664,
1261,
2050,
3062,
82,
36664,
717,
37854,
368,
341,
262,
2060,
10714,
10297,
27706,
717,
2628,
1361,
25592,
20703,
18,
11,
220,
16,
1125,
7486,
0,
1183,
13828,
63624,
7486,
20703,
22,
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_request_snapshot_none_replicate() {
let (mut nt, _) = prepare_request_snapshot();
nt.peers
.get_mut(&1)
.unwrap()
.mut_prs()
.get_mut(2)
.unwrap()
.state = ProgressState::Probe;
// Request the latest snapshot.
let request_idx = nt.peers[&2].raft_log.committed;
nt.peers
.get_mut(&2)
.unwrap()
.request_snapshot(request_idx)
.unwrap();
let req_snap = nt.peers.get_mut(&2).unwrap().msgs.pop().unwrap();
nt.peers.get_mut(&1).unwrap().step(req_snap).unwrap();
assert!(nt.peers[&1].prs().get(2).unwrap().pending_request_snapshot != 0);
} | rust_cleaned_test_functions.jsonl/19196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
53265,
31488,
25533,
48795,
368,
341,
262,
1077,
320,
6984,
31412,
11,
27439,
284,
10549,
7893,
53265,
543,
262,
31412,
52724,
388,
198,
286,
659,
455,
29523,
2099,
16,
340,
286,
659,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skip_common_prefix() {
{
let nibble_path1 = NibblePath::new(vec![0x12, 0x34, 0x56]);
let nibble_path2 = NibblePath::new(vec![0x12, 0x34, 0x56]);
let mut iter1 = nibble_path1.nibbles();
let mut iter2 = nibble_path2.nibbles();
assert_eq!(skip_common_prefix(&mut iter1, &mut iter2), 6);
assert!(iter1.is_finished());
assert!(iter2.is_finished());
}
{
let nibble_path1 = NibblePath::new(vec![0x12, 0x35]);
let nibble_path2 = NibblePath::new(vec![0x12, 0x34, 0x56]);
let mut iter1 = nibble_path1.nibbles();
let mut iter2 = nibble_path2.nibbles();
assert_eq!(skip_common_prefix(&mut iter1, &mut iter2), 3);
assert_eq!(
iter1.visited_nibbles().get_nibble_path(),
iter2.visited_nibbles().get_nibble_path()
);
assert_eq!(
iter1.remaining_nibbles().get_nibble_path(),
NibblePath::new_odd(vec![0x50])
);
assert_eq!(
iter2.remaining_nibbles().get_nibble_path(),
NibblePath::new_odd(vec![0x45, 0x60])
);
}
{
let nibble_path1 = NibblePath::new(vec![0x12, 0x34, 0x56]);
let nibble_path2 = NibblePath::new_odd(vec![0x12, 0x30]);
let mut iter1 = nibble_path1.nibbles();
let mut iter2 = nibble_path2.nibbles();
assert_eq!(skip_common_prefix(&mut iter1, &mut iter2), 3);
assert_eq!(
iter1.visited_nibbles().get_nibble_path(),
iter2.visited_nibbles().get_nibble_path()
);
assert_eq!(
iter1.remaining_nibbles().get_nibble_path(),
NibblePath::new_odd(vec![0x45, 0x60])
);
assert!(iter2.is_finished());
}
} | rust_cleaned_test_functions.jsonl/97692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 947
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
21107,
13974,
368,
341,
262,
341,
286,
1077,
30285,
891,
2638,
16,
284,
451,
82418,
1820,
486,
931,
25592,
20703,
15,
87,
16,
17,
11,
220,
15,
87,
18,
19,
11,
220,
15,
87,
20,
21,
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_ppudata_port() {
let mut fb: Vec<u16> = vec![0; 256*240];
let mut ppu = Rp2c02::from_power_on();
let mut cpu_pinout = Pinout::new();
} | rust_cleaned_test_functions.jsonl/57105 | {
"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,
31600,
661,
459,
8716,
368,
341,
286,
1077,
5206,
25469,
25,
11312,
34837,
16,
21,
29,
284,
7486,
20703,
15,
26,
220,
17,
20,
21,
9,
17,
19,
15,
935,
286,
1077,
5206,
281,
5584,
284,
68108,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prewrite_1pc() {
use crate::storage::mvcc::tests::{must_get, must_get_commit_ts, must_unlocked};
let engine = TestEngineBuilder::new().build().unwrap();
let cm = concurrency_manager::ConcurrencyManager::new(1.into());
let key = b"k";
let value = b"v";
let mutations = vec![Mutation::make_put(Key::from_raw(key), value.to_vec())];
let mut statistics = Statistics::default();
prewrite_with_cm(
&engine,
cm.clone(),
&mut statistics,
mutations,
key.to_vec(),
10,
Some(15),
)
.unwrap();
must_unlocked(&engine, key);
must_get(&engine, key, 12, value);
must_get_commit_ts(&engine, key, 10, 11);
cm.update_max_ts(50.into());
let mutations = vec![Mutation::make_put(Key::from_raw(key), value.to_vec())];
let mut statistics = Statistics::default();
// Test the idempotency of prewrite when falling back to 2PC.
for _ in 0..2 {
let res = prewrite_with_cm(
&engine,
cm.clone(),
&mut statistics,
mutations.clone(),
key.to_vec(),
20,
Some(30),
)
.unwrap();
assert!(res.min_commit_ts.is_zero());
assert!(res.one_pc_commit_ts.is_zero());
must_locked(&engine, key, 20);
}
must_rollback(&engine, key, 20, false);
let mutations = vec![
Mutation::make_put(Key::from_raw(key), value.to_vec()),
Mutation::make_check_not_exists(Key::from_raw(b"non_exist")),
];
let mut statistics = Statistics::default();
prewrite_with_cm(
&engine,
cm.clone(),
&mut statistics,
mutations,
key.to_vec(),
40,
Some(60),
)
.unwrap();
// Test a 1PC request should not be partially written when encounters error on the halfway.
// broken.
let (k1, v1) = (b"k1", b"v1");
let (k2, v2) = (b"k2", b"v2");
// Lock k2.
let mut statistics = Statistics::default();
prewrite_with_cm(
&engine,
cm.clone(),
&mut statistics,
vec![Mutation::make_put(Key::from_raw(k2), v2.to_vec())],
k2.to_vec(),
50,
None,
)
.unwrap();
// Try 1PC on the two keys and it will fail on the second one.
let mutations = vec![
Mutation::make_put(Key::from_raw(k1), v1.to_vec()),
Mutation::make_put(Key::from_raw(k2), v2.to_vec()),
];
prewrite_with_cm(
&engine,
cm,
&mut statistics,
mutations,
k1.to_vec(),
60,
Some(70),
)
.unwrap_err();
must_unlocked(&engine, k1);
must_locked(&engine, k2, 50);
must_get_commit_ts_none(&engine, k1, 60);
must_get_commit_ts_none(&engine, k2, 60);
} | rust_cleaned_test_functions.jsonl/31423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
52473,
62,
16,
3992,
368,
341,
286,
990,
17717,
486,
16172,
486,
26002,
638,
486,
23841,
22964,
24812,
3062,
11,
1969,
3062,
36346,
25023,
11,
1969,
19465,
291,
2315,
286,
1077,
4712,
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_parsing_cancelled_by_another_thread() {
let cancellation_flag = Box::new(AtomicUsize::new(0));
let mut parser = Parser::new();
parser.set_language(get_language("javascript")).unwrap();
unsafe { parser.set_cancellation_flag(Some(&cancellation_flag)) };
// Long input - parsing succeeds
let tree = parser.parse_with(
&mut |offset, _| {
if offset == 0 {
" [".as_bytes()
} else if offset >= 20000 {
"".as_bytes()
} else {
"0,".as_bytes()
}
},
None,
);
assert!(tree.is_some());
let cancel_thread = thread::spawn(move || {
thread::sleep(time::Duration::from_millis(100));
cancellation_flag.store(1, Ordering::SeqCst);
});
// Infinite input
let tree = parser.parse_with(
&mut |offset, _| {
thread::yield_now();
thread::sleep(time::Duration::from_millis(10));
if offset == 0 {
b" ["
} else {
b"0,"
}
},
None,
);
// Parsing returns None because it was cancelled.
cancel_thread.join().unwrap();
assert!(tree.is_none());
} | rust_cleaned_test_functions.jsonl/15869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
28895,
832,
3710,
12008,
1575,
10814,
368,
341,
262,
1077,
35835,
10933,
284,
8261,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
3237,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_chunk_string() {
let chunk = testing_chunk();
let chunk_string = chunk.data_as_string().unwrap();
let expected_chunk_string = String::from("This is where your secret message will be!");
assert_eq!(chunk_string, expected_chunk_string);
} | rust_cleaned_test_functions.jsonl/95802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30539,
3904,
368,
341,
286,
1077,
11879,
284,
7497,
30539,
543,
286,
1077,
11879,
3904,
284,
11879,
2196,
11898,
3904,
1005,
15454,
543,
286,
1077,
3601,
30539,
3904,
284,
923,
486,
1499,
445,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_accountsdb_de_dup_accounts_empty() {
solana_logger::setup();
let (hashes, lamports) = AccountsHash::de_dup_and_eliminate_zeros(
vec![vec![], vec![]],
&mut HashStats::default(),
);
assert_eq!(
vec![vec![Hash::default(); 0], vec![]],
hashes.into_iter().flatten().collect::<Vec<_>>()
);
assert_eq!(lamports, 0);
let (hashes, lamports) =
AccountsHash::de_dup_and_eliminate_zeros(vec![], &mut HashStats::default());
let empty: Vec<Vec<Vec<Hash>>> = Vec::default();
assert_eq!(empty, hashes);
assert_eq!(lamports, 0);
let (hashes, lamports) = AccountsHash::de_dup_accounts_in_parallel(&[], 1);
assert_eq!(
vec![Hash::default(); 0],
hashes.into_iter().flatten().collect::<Vec<_>>()
);
assert_eq!(lamports, 0);
let (hashes, lamports) = AccountsHash::de_dup_accounts_in_parallel(&[], 2);
assert_eq!(
vec![Hash::default(); 0],
hashes.into_iter().flatten().collect::<Vec<_>>()
);
assert_eq!(lamports, 0);
} | rust_cleaned_test_functions.jsonl/17801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 607
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
2259,
51932,
55665,
15124,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
320,
8296,
288,
11,
31603,
3394,
8,
284,
40655,
6370,
486,
450,
51932,
8378,
84655,
3277,
837... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ready_second_wave() {
let time = test_time();
let mut update = test_update();
add_test_waves(&mut update);
// Now we should be in the second wave
let seed = 60;
for duration in (0..200).step_by(10) {
assert!(
!update.update_ready(seed, time + Duration::milliseconds(duration)),
"seed should not part of first wave",
);
}
let seed_time_position = (1024 - 200) / (100 - 50) * seed;
for duration in (200..seed_time_position).step_by(2) {
assert!(
!update.update_ready(
seed, time + Duration::milliseconds(duration as i64)
),
"update should not be ready, it's the second wave but not at position within wave yet: {}", duration,
);
}
for duration in (seed_time_position..1024).step_by(4) {
assert!(
update.update_ready(
seed,
time + Duration::milliseconds(200)
+ Duration::milliseconds(duration as i64)
),
"update should be ready now that we're passed the allocated time position within the second wave: {}", duration,
);
}
for duration in (1024..4096).step_by(8) {
assert!(
update.update_ready(seed, time + Duration::milliseconds(duration as i64)),
"update should be ready after the third wave starts and onwards",
);
}
} | rust_cleaned_test_functions.jsonl/49367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 791
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
35456,
29644,
60063,
368,
341,
286,
1077,
882,
284,
1273,
3009,
543,
286,
1077,
5206,
2647,
284,
1273,
8882,
543,
286,
912,
4452,
1670,
4693,
2099,
6984,
2647,
317,
286,
442,
4695,
582,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simple() {
let mut optimizer = GurobiOptimizer::new("mip1");
let x = optimizer.add_var('I', false);
let y = optimizer.add_var('I', false);
let obj = optimizer.add_var('I', true);
optimizer.add_constraint(&vec![x, y], &vec![1.0, -1.0], '=', 0.0);
optimizer.add_constraint(&vec![x, y], &vec![1.0, 1.0], '=', 4.0);
optimizer.add_constraint(&vec![x, y, obj], &vec![1.0, 1.0, -1.0], '=', 0.0);
optimizer.optimize("max");
assert!(*optimizer.solutions.get(&x).unwrap() == 2.0);
assert!(*optimizer.solutions.get(&y).unwrap() == 2.0);
} | rust_cleaned_test_functions.jsonl/125771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
262,
1077,
5206,
25632,
284,
479,
2798,
8221,
80637,
486,
931,
445,
76,
573,
16,
797,
262,
1077,
856,
284,
25632,
1364,
4612,
492,
40,
516,
895,
317,
262,
1077,
379,
284,
2563... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_account_index() {
let (genesis_block, mint_keypair) = GenesisBlock::new(1);
let keypair = Keypair::new();
let bank = Bank::new(&genesis_block);
let tx = system_transaction::transfer(
&mint_keypair,
&keypair.pubkey(),
1,
genesis_block.hash(),
0,
);
let mut tx_invalid_program_index = tx.clone();
tx_invalid_program_index.message.instructions[0].program_ids_index = 42;
assert_eq!(
bank.process_transaction(&tx_invalid_program_index),
Err(TransactionError::InvalidAccountIndex)
);
let mut tx_invalid_account_index = tx.clone();
tx_invalid_account_index.message.instructions[0].accounts[0] = 42;
assert_eq!(
bank.process_transaction(&tx_invalid_account_index),
Err(TransactionError::InvalidAccountIndex)
);
} | rust_cleaned_test_functions.jsonl/41895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 458
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
31433,
13500,
3560,
368,
341,
286,
1077,
320,
77894,
7113,
11,
28337,
3097,
12670,
8,
284,
40788,
4713,
486,
931,
7,
16,
317,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_pallet() {
TestExternalities::new_empty().execute_with(|| {
OldStorageValue::put(3);
OldStorageMap::insert(1, 2);
OldStorageMap::insert(3, 4);
move_pallet(b"my_old_pallet", b"my_new_pallet");
assert_eq!(OldStorageValue::get(), None);
assert_eq!(OldStorageMap::iter().collect::<Vec<_>>(), vec![]);
assert_eq!(NewStorageValue::get(), Some(3));
assert_eq!(NewStorageMap::iter().collect::<Vec<_>>(), vec![(1, 2), (3, 4)]);
})
} | rust_cleaned_test_functions.jsonl/68269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
620,
7464,
368,
341,
197,
73866,
25913,
1361,
486,
931,
15124,
1005,
10257,
6615,
79453,
341,
298,
197,
18284,
5793,
1130,
486,
628,
7,
18,
317,
298,
197,
18284,
5793,
2227,
486,
4208,
7,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_arch_ppc_detail() {
use arch::ppc::PpcOperand::*;
use arch::ppc::PpcReg::*;
use arch::ppc::*;
use capstone_sys::ppc_op_mem;
test_arch_mode_endian_insns_detail(
&mut Capstone::new()
.ppc()
.mode(ppc::ArchMode::Mode64)
.endian(Endian::Big)
.build()
.unwrap(),
Arch::PPC,
Mode::Mode64,
Some(Endian::Big),
&[],
&[
DII::new(
"lwz",
b"\x80\x20\x00\x00",
&[
Reg(RegId(PPC_REG_R1 as RegIdInt)),
Mem(PpcOpMem(ppc_op_mem { base: 44, disp: 0 })),
],
),
DII::new(
"lwz",
b"\x80\x3f\x00\x00",
&[
Reg(RegId(PPC_REG_R1 as RegIdInt)),
Mem(PpcOpMem(ppc_op_mem {
base: PPC_REG_R31,
disp: 0,
})),
],
),
DII::new(
"vpkpx",
b"\x10\x43\x23\x0e",
&[
Reg(RegId(PPC_REG_V2 as RegIdInt)),
Reg(RegId(PPC_REG_V3 as RegIdInt)),
Reg(RegId(PPC_REG_V4 as RegIdInt)),
],
),
DII::new(
"stfs",
b"\xd0\x44\x00\x80",
&[
Reg(RegId(PPC_REG_F2 as RegIdInt)),
Mem(PpcOpMem(ppc_op_mem {
base: PPC_REG_R4,
disp: 0x80,
})),
],
),
DII::new(
"crand",
b"\x4c\x43\x22\x02",
&[
Reg(RegId(PPC_REG_R2 as RegIdInt)),
Reg(RegId(PPC_REG_R3 as RegIdInt)),
Reg(RegId(PPC_REG_R4 as RegIdInt)),
],
),
DII::new(
"cmpwi",
b"\x2d\x03\x00\x80",
&[
Reg(RegId(PPC_REG_CR2 as RegIdInt)),
Reg(RegId(PPC_REG_R3 as RegIdInt)),
Imm(0x80),
],
),
DII::new(
"addc",
b"\x7c\x43\x20\x14",
&[
Reg(RegId(PPC_REG_R2 as RegIdInt)),
Reg(RegId(PPC_REG_R3 as RegIdInt)),
Reg(RegId(PPC_REG_R4 as RegIdInt)),
],
),
DII::new(
"mulhd.",
b"\x7c\x43\x20\x93",
&[
Reg(RegId(PPC_REG_R2 as RegIdInt)),
Reg(RegId(PPC_REG_R3 as RegIdInt)),
Reg(RegId(PPC_REG_R4 as RegIdInt)),
],
),
// bdnzlrl+
DII::new("bdnzlrl+", b"\x4f\x20\x00\x21", &[]),
// bgelrl- cr2
DII::new(
"bgelrl-",
b"\x4c\xc8\x00\x21",
&[Reg(RegId(PPC_REG_CR2 as RegIdInt))],
),
],
);
} | rust_cleaned_test_functions.jsonl/127437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34330,
31600,
66,
14480,
368,
341,
262,
990,
5325,
486,
602,
66,
486,
47,
3992,
29940,
56162,
262,
990,
5325,
486,
602,
66,
486,
47,
3992,
3477,
56162,
262,
990,
5325,
486,
602,
66,
56162,
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_packet_update_ipv4_udp() {
// Ether / IPv4 / UDP / Raw
let test_data = hex!("000c4182b25300d0596c404e08004500 AAAA 0a4100008011 AAAA c0a83232c0a80001ff02ff35 AAAA AAAA 002b0100000100000000000002757304706f6f6c036e7470036f72670000010001");
let mut pkt = Packet::from_bytes(test_data.as_ref()).unwrap();
assert_eq!(4, pkt.layers.len());
assert_eq!(0xAAAA, pkt.ipv4().unwrap().length);
assert_eq!(0xAAAA, pkt.ipv4().unwrap().checksum);
assert_eq!(0xAAAA, pkt.udp().unwrap().length);
assert_eq!(0xAAAA, pkt.udp().unwrap().checksum);
pkt.update().unwrap();
assert_eq!(0x003d, pkt.ipv4().unwrap().length);
assert_eq!(0x7ceb, pkt.ipv4().unwrap().checksum);
assert_eq!(0x0029, pkt.udp().unwrap().length);
assert_eq!(0x07a9, pkt.udp().unwrap().checksum);
} | rust_cleaned_test_functions.jsonl/78718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21078,
8882,
49378,
19,
69432,
368,
341,
286,
442,
34878,
608,
31560,
19,
608,
42394,
608,
23022,
198,
286,
1077,
1273,
1769,
284,
12371,
17223,
15,
15,
15,
66,
19,
16,
23,
17,
65,
17,
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... | 1 |
#[test]
fn test_exclude_grep_filepath() {
let query = "rules";
let line = "crates/maple_cli/src/lib.rs:2:1:macro_rules! println_json {";
let (_, origin_indices) = fuzzy_indices_fzy(line, query).unwrap();
let (_, indices) = apply_fzy_on_grep_line(line, query).unwrap();
assert_eq!(origin_indices, indices);
} | rust_cleaned_test_functions.jsonl/115949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88668,
1889,
9995,
53490,
368,
341,
286,
1077,
3239,
284,
330,
21977,
876,
286,
1077,
1555,
284,
330,
5082,
973,
41081,
273,
47147,
13437,
8194,
25638,
25,
17,
25,
16,
25,
32606,
21407,
0,
13751... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_for_each() {
check_output_lists(
"fun f(arg) { print arg; } \n\
forEach([1,2,3,4], f);",
"1\n2\n3\n4",
)
} | rust_cleaned_test_functions.jsonl/111867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
32046,
368,
341,
286,
1779,
7645,
37288,
1006,
310,
330,
11894,
282,
9404,
8,
314,
1173,
1392,
26,
335,
1124,
77,
5661,
1797,
82532,
2561,
16,
11,
17,
11,
18,
11,
19,
1125,
282,
1215,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_index() -> ::std::io::Result<()> {
let shared_cat = create_test_catalog("test_index".into());
let schema = r#"[
{ "name": "test_text", "type": "text", "options": { "indexing": { "record": "position", "tokenizer": "default" }, "stored": true } },
{ "name": "test_unindex", "type": "text", "options": { "indexing": { "record": "position", "tokenizer": "default" }, "stored": true } },
{ "name": "test_i64", "type": "i64", "options": { "indexed": true, "stored": true } },
{ "name": "test_u64", "type": "u64", "options": { "indexed": true, "stored": true } }
]"#;
let handler = IndexHandler::new(Arc::clone(&shared_cat));
let body: SchemaBody = serde_json::from_str(schema).unwrap();
let req = handler.create(body, "new_index".into());
assert_eq!(req.is_ok(), true);
let search = SearchHandler::new(Arc::clone(&shared_cat));
let docs = search.get_all_docs("new_index".into()).wait().unwrap();
assert_eq!(docs.hits, 0);
remove_dir_all::remove_dir_all("new_index")
} | rust_cleaned_test_functions.jsonl/96418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
3560,
368,
1464,
3504,
1834,
486,
815,
486,
2077,
71698,
341,
286,
1077,
6094,
20825,
284,
1855,
4452,
47310,
445,
1944,
3560,
3263,
18122,
1423,
286,
1077,
10802,
284,
435,
55543,
9640,
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 |
#[test]
fn test_foreign_ns_func_ret_pod() {
let hdr = indoc! {"
#include <cstdint>
#include <memory>
namespace A {
struct Bob {
uint32_t a;
};
}
namespace B {
inline A::Bob daft() { A::Bob bob; bob.a = 12; return bob; }
}
"};
let rs = quote! {
assert_eq!(ffi::B::daft().a, 12);
};
run_test("", hdr, rs, &["B::daft"], &["A::Bob"]);
} | rust_cleaned_test_functions.jsonl/9829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78983,
34728,
9596,
21695,
85337,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
671,
997,
366,
17269,
397,
286,
4473,
362,
341,
310,
2036,
14261,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_parameters() {
let program_id = solana_sdk::pubkey::new_rand();
let dup_key = solana_sdk::pubkey::new_rand();
let dup_key2 = solana_sdk::pubkey::new_rand();
let keys = vec![
dup_key,
dup_key,
solana_sdk::pubkey::new_rand(),
solana_sdk::pubkey::new_rand(),
dup_key2,
dup_key2,
solana_sdk::pubkey::new_rand(),
solana_sdk::pubkey::new_rand(),
];
let accounts = [
RefCell::new(AccountSharedData::from(Account {
lamports: 1,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
})),
// dup
RefCell::new(AccountSharedData::from(Account {
lamports: 1,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
})),
RefCell::new(AccountSharedData::from(Account {
lamports: 2,
data: vec![11u8, 12, 13, 14, 15, 16, 17, 18, 19],
owner: bpf_loader::id(),
executable: true,
rent_epoch: 200,
})),
RefCell::new(AccountSharedData::from(Account {
lamports: 3,
data: vec![],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 3100,
})),
RefCell::new(AccountSharedData::from(Account {
lamports: 4,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
})),
// dup
RefCell::new(AccountSharedData::from(Account {
lamports: 4,
data: vec![1u8, 2, 3, 4, 5],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 100,
})),
RefCell::new(AccountSharedData::from(Account {
lamports: 5,
data: vec![11u8, 12, 13, 14, 15, 16, 17, 18, 19],
owner: bpf_loader::id(),
executable: true,
rent_epoch: 200,
})),
RefCell::new(AccountSharedData::from(Account {
lamports: 6,
data: vec![],
owner: bpf_loader::id(),
executable: false,
rent_epoch: 3100,
})),
];
let keyed_accounts: Vec<_> = keys
.iter()
.zip(&accounts)
.enumerate()
.map(|(i, (key, account))| {
if i <= accounts.len() / 2 {
KeyedAccount::new_readonly(&key, false, &account)
} else {
KeyedAccount::new(&key, false, &account)
}
})
.collect();
let instruction_data = vec![1u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
// check serialize_parameters_aligned
let mut serialized = serialize_parameters(
&bpf_loader::id(),
&program_id,
&keyed_accounts,
&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 ((account, account_info), key) in accounts.iter().zip(de_accounts).zip(keys.clone()) {
assert_eq!(key, *account_info.key);
let account = account.borrow();
assert_eq!(account.lamports(), account_info.lamports());
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.lamports.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_accounts = accounts.clone();
let de_keyed_accounts: Vec<_> = keys
.iter()
.zip(&de_accounts)
.enumerate()
.map(|(i, (key, account))| {
if i <= accounts.len() / 2 {
KeyedAccount::new_readonly(&key, false, &account)
} else {
KeyedAccount::new(&key, false, &account)
}
})
.collect();
deserialize_parameters(
&bpf_loader::id(),
&de_keyed_accounts,
serialized.as_slice(),
true,
)
.unwrap();
for ((account, de_keyed_account), key) in
accounts.iter().zip(de_keyed_accounts).zip(keys.clone())
{
assert_eq!(key, *de_keyed_account.unsigned_key());
let account = account.borrow();
assert_eq!(account.lamports(), de_keyed_account.lamports().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());
}
// check serialize_parameters_unaligned
let mut serialized = serialize_parameters(
&bpf_loader_deprecated::id(),
&program_id,
&keyed_accounts,
&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 ((account, account_info), key) in accounts.iter().zip(de_accounts).zip(keys.clone()) {
assert_eq!(key, *account_info.key);
let account = account.borrow();
assert_eq!(account.lamports(), account_info.lamports());
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_accounts = accounts.clone();
let de_keyed_accounts: Vec<_> = keys
.iter()
.zip(&de_accounts)
.enumerate()
.map(|(i, (key, account))| {
if i < accounts.len() / 2 {
KeyedAccount::new_readonly(&key, false, &account)
} else {
KeyedAccount::new(&key, false, &account)
}
})
.collect();
deserialize_parameters(
&bpf_loader_deprecated::id(),
&de_keyed_accounts,
serialized.as_slice(),
true,
)
.unwrap();
for ((account, de_keyed_account), key) in
accounts.iter().zip(de_keyed_accounts).zip(keys.clone())
{
assert_eq!(key, *de_keyed_account.unsigned_key());
let account = account.borrow();
assert_eq!(account.lamports(), de_keyed_account.lamports().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/10770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4743
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
18263,
368,
341,
286,
1077,
2025,
842,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
22737,
3097,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_excessive_encoding_len() {
use crate::error::ProtoErrorKind;
let mut buf = Vec::with_capacity(u16::max_value() as usize);
let mut encoder = BinEncoder::new(&mut buf);
let mut result = Ok(());
for i in 0..10000 {
let name = Name::from_ascii(format!("name{}.example.com.", i)).unwrap();
result = name.emit(&mut encoder);
if let Err(..) = result {
break;
}
}
assert!(result.is_err());
match *result.unwrap_err().kind() {
ProtoErrorKind::MaxBufferSizeExceeded(_) => (),
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/38224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
86628,
37613,
6043,
368,
341,
286,
990,
17717,
486,
841,
486,
31549,
1454,
10629,
401,
1789,
286,
1077,
5206,
6607,
284,
11312,
486,
4197,
35603,
8154,
16,
21,
486,
2810,
3142,
368,
438,
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... | 4 |
#[test]
fn test_xor_reg_reg() {
assert_emit!(0x44, 0x31, 0xf8; emit_xor_reg_reg(0, R15, RAX));
assert_emit!(0x31, 0xc8; emit_xor_reg_reg(0, RCX, RAX));
assert_emit!(0x41, 0x31, 0xc7; emit_xor_reg_reg(0, RAX, R15));
} | rust_cleaned_test_functions.jsonl/85454 | {
"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,
76462,
4920,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
87,
19,
19,
11,
220,
15,
87,
18,
16,
11,
220,
15,
5848,
23,
26,
16691,
76462,
4920,
4920,
7,
15,
11,
431,
16,
20,
11,
431,
2954,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder() {
let runtime = Runtime::builder()
.with_connector(HttpConnector::new())
.with_endpoint(http::Uri::from_static("http://nomatter.com"))
.build();
runtime.unwrap();
} | rust_cleaned_test_functions.jsonl/95220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
368,
341,
262,
1077,
15592,
284,
10954,
486,
17850,
741,
286,
659,
4197,
76393,
12286,
35954,
486,
931,
2398,
286,
659,
4197,
36699,
19886,
486,
13899,
486,
1499,
25360,
445,
1254,
1110,
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 |
#[test]
fn test_handle_parts() {
let h = TypedHandle::<()>::from_raw_parts(0, 0, 0);
assert_eq!(h.index(), 0);
assert_eq!(h.generation(), 0);
assert_eq!(h.meta(), 0);
assert_eq!(h.meta(), h.map_id());
let h = TypedHandle::<()>::from_raw_parts(!0, 0, 0);
assert_eq!(h.index(), (!0u32) as usize);
assert_eq!(h.generation(), 0);
assert_eq!(h.meta(), 0);
assert_eq!(h.meta(), h.map_id());
assert_eq!(TypedHandle::<()>::from_raw(h.into_raw()), h);
let h = TypedHandle::<()>::from_raw_parts(0, !0, 0);
assert_eq!(h.index(), 0);
assert_eq!(h.generation(), !0);
assert_eq!(h.meta(), 0);
assert_eq!(h.meta(), h.map_id());
let h = TypedHandle::<()>::from_raw_parts(0, 0, !0);
assert_eq!(h.index(), 0);
assert_eq!(h.generation(), 0);
assert_eq!(h.meta(), !0);
assert_eq!(h.meta(), h.map_id());
let h = TypedHandle::<()>::from_raw_parts(!0, !0, !0);
assert_eq!(h.index(), (!0u32) as usize);
assert_eq!(h.generation(), !0);
assert_eq!(h.meta(), !0);
assert_eq!(h.meta(), h.map_id());
} | rust_cleaned_test_functions.jsonl/15918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 637
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
33217,
368,
341,
286,
1077,
305,
284,
50554,
6999,
27638,
368,
6831,
1499,
16067,
33217,
7,
15,
11,
220,
15,
11,
220,
15,
317,
286,
2060,
10714,
10297,
71,
5154,
1507,
220,
15,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decoding_quote() {
let isv_enclave_quote = "AgAAANoKAAAHAAYAAAAAABYB+Vw5ueowf+qruQGtw+5gbJslhOX9eWDNazWpHhBVBAT/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAHAAAAAAAAABIhP23bLUNSZ1yvFIrZa0pu/zt6/n3X8qNjMVbWgOGDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACD1xnnferKFHD2uvYqTXdDA8iZ22kCD5xw7h38CMfOngAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAweDRlNmRkMjg0NzdkM2NkY2QzMTA3NTA3YjYxNzM3YWFhMTU5MTYwNzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
let quote = Quote::from_base64(&isv_enclave_quote).unwrap();
let data = quote.report_body.report_data;
let data_str = from_utf8(&data).unwrap();
assert_eq!(data_str.trim_end_matches("\x00"), "0x4e6dd28477d3cdcd3107507b61737aaa15916070");
} | rust_cleaned_test_functions.jsonl/124222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
3700,
45236,
368,
341,
286,
1077,
374,
85,
6205,
40533,
45236,
284,
330,
9042,
6029,
1093,
78,
42,
50107,
17020,
3022,
25699,
32,
1867,
56,
33,
10,
53,
86,
20,
361,
363,
69,
10,
80,
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_private_constructor_make_unique() {
let hdr = indoc! {"
#include <stdint.h>
struct A {
private:
A() {};
public:
uint32_t a;
};
"};
let rs = quote! {};
run_test("", hdr, rs, &["A"], &[]);
} | rust_cleaned_test_functions.jsonl/9874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26249,
66210,
28230,
21218,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
31435,
860,
397,
262,
2036,
362,
341,
262,
869,
510,
286,
362,
368,
9321,
262,
584,
510... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_successful_env_var_parse() {
parse_env_var("FOO=bar").expect("Normal env var pair should parse");
parse_env_var("FOO=").expect("No value should parse");
let (_, value) = parse_env_var("FOO=\"bar -s\"").expect("Double quoted value should parse");
assert!(
!value.contains('"'),
"Double quoted value should have quotes removed"
);
let (_, value) = parse_env_var("FOO='bar -s'").expect("Single quoted value should parse");
assert!(
!value.contains('\''),
"Single quoted value should have quotes removed"
);
let (_, value) =
parse_env_var("FOO=\"bar \" -s\"").expect("Non-matching double quote should parse");
assert!(
value.match_indices('"').count() == 1,
"Value with double quote should not have quote removed"
);
let (_, value) =
parse_env_var("FOO=bar\"").expect("Non-matching double quote should parse (case 2)");
assert!(
value.match_indices('"').count() == 1,
"Value with double quote should not have quote removed (case 2)"
);
let (_, value) =
parse_env_var("FOO='bar ' -s'").expect("Non-matching single quote should parse");
assert!(
value.match_indices('\'').count() == 1,
"Value with double quote should not have quote removed"
);
let (_, value) = parse_env_var("FOO=\"\"").expect("Empty double quoted value should parse");
assert!(
value.is_empty(),
"Empty double quoted value should be empty"
);
let (_, value) = parse_env_var("FOO=''").expect("Empty single quoted value should parse");
assert!(
value.is_empty(),
"Empty single quoted value should be empty"
);
} | rust_cleaned_test_functions.jsonl/75744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 839
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92951,
15879,
4612,
21039,
368,
341,
286,
4715,
15879,
4612,
445,
3788,
46,
28,
2257,
1827,
17119,
445,
12206,
6105,
762,
6716,
1265,
4715,
3071,
286,
4715,
15879,
4612,
445,
3788,
46,
75244,
1711... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_csp_coerce_blocked_uri_if_missing() {
let json = r#"{
"csp-report": {
"document-uri": "http://example.com",
"effective-directive": "script-src"
}
}"#;
let mut event = Event::default();
Csp::apply_to_event(json.as_bytes(), &mut event).unwrap();
assert_annotated_snapshot!(Annotated::new(event), @r###"
{
"culprit": "",
"logentry": {
"formatted": "Blocked unsafe (eval() or inline) 'script'"
},
"request": {
"url": "http://example.com"
},
"tags": [
[
"effective-directive",
"script-src"
],
[
"blocked-uri",
"self"
]
],
"csp": {
"effective_directive": "script-src",
"blocked_uri": "self",
"document_uri": "http://example.com",
"violated_directive": ""
}
}
"###);
} | rust_cleaned_test_functions.jsonl/4017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 640
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2154,
11393,
25641,
89223,
15572,
11119,
40447,
368,
341,
286,
1077,
2951,
284,
435,
55543,
515,
310,
330,
66,
2154,
47411,
788,
341,
394,
330,
6062,
87232,
788,
330,
1254,
1110,
8687,
905,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_draw_one() {
let mut rng = SmallRng::seed_from_u64(0_u64);
let card = draw_one(&mut rng);
assert_eq!(BJCard::Seven, card);
} | rust_cleaned_test_functions.jsonl/74256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23021,
11667,
368,
341,
286,
1077,
5206,
28422,
284,
14994,
49,
968,
486,
22602,
5673,
7300,
21,
19,
7,
15,
7300,
21,
19,
317,
286,
1077,
3701,
284,
4038,
11667,
2099,
6984,
28422,
626,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_validate_dynamic_offers_missing_stuff() {
assert_eq!(
validate_dynamic_offers(&vec![
fdecl::Offer::Protocol(fdecl::OfferProtocol::EMPTY),
fdecl::Offer::Service(fdecl::OfferService::EMPTY),
fdecl::Offer::Directory(fdecl::OfferDirectory::EMPTY),
fdecl::Offer::Storage(fdecl::OfferStorage::EMPTY),
fdecl::Offer::Runner(fdecl::OfferRunner::EMPTY),
fdecl::Offer::Resolver(fdecl::OfferResolver::EMPTY),
fdecl::Offer::Event(fdecl::OfferEvent::EMPTY),
]),
Err(ErrorList::new(vec![
Error::missing_field("OfferProtocol", "source"),
Error::missing_field("OfferProtocol", "source_name"),
Error::missing_field("OfferProtocol", "target_name"),
Error::missing_field("OfferProtocol", "dependency_type"),
Error::missing_field("OfferService", "source"),
Error::missing_field("OfferService", "source_name"),
Error::missing_field("OfferService", "target_name"),
Error::missing_field("OfferDirectory", "source"),
Error::missing_field("OfferDirectory", "source_name"),
Error::missing_field("OfferDirectory", "target_name"),
Error::missing_field("OfferDirectory", "dependency_type"),
Error::missing_field("OfferStorage", "source_name"),
Error::missing_field("OfferStorage", "source"),
Error::missing_field("OfferRunner", "source"),
Error::missing_field("OfferRunner", "source_name"),
Error::missing_field("OfferRunner", "target_name"),
Error::missing_field("OfferResolver", "source"),
Error::missing_field("OfferResolver", "source_name"),
Error::missing_field("OfferResolver", "target_name"),
Error::missing_field("OfferEvent", "source_name"),
Error::missing_field("OfferEvent", "source"),
Error::missing_field("OfferEvent", "target_name"),
Error::missing_field("OfferEvent", "mode"),
]))
);
} | rust_cleaned_test_functions.jsonl/82028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1076
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
45992,
13651,
388,
40447,
95396,
368,
341,
286,
2060,
10714,
33673,
310,
9593,
45992,
13651,
388,
2099,
4083,
90515,
394,
282,
10005,
486,
39462,
486,
20689,
955,
10005,
486,
39462,
20689,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_value_option() {
let src = "
// Package foo does a thing.
package foo
// one is the number one.
option one = 1
";
let loc = Locator::new(&src[..]);
assert_docs_full(
src,
PackageDoc {
path: "path".to_string(),
name: "foo".to_string(),
headline: "Package foo does a thing.".to_string(),
description: None,
members: map![
"one" => Doc::Value(Box::new(ValueDoc{
name: "one".to_string(),
headline: "one is the number one.".to_string(),
description: None,
flux_type: "int".to_string(),
is_option: true,
source_location: loc.get(6, 9, 6, 23),
examples: vec![],
metadata: None,
})),
],
examples: Vec::new(),
metadata: None,
},
vec![],
);
} | rust_cleaned_test_functions.jsonl/10001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 698
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
9672,
368,
341,
286,
1077,
2286,
284,
6228,
286,
442,
16906,
15229,
1558,
264,
3166,
624,
286,
6328,
15229,
271,
286,
442,
825,
374,
279,
1372,
825,
624,
286,
2999,
825,
284,
220,
16,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_to_single() {
assert_less(Variant::from(1_i64), Variant::from(2.0_f32));
assert_equal(Variant::from(3_i64), Variant::from(3.0_f32));
assert_greater(Variant::from(5_i64), Variant::from(4.0_f32));
} | rust_cleaned_test_functions.jsonl/84524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
2346,
19487,
368,
341,
310,
2060,
50747,
12410,
15341,
486,
1499,
7,
16,
5318,
21,
19,
701,
39292,
486,
1499,
7,
17,
13,
15,
761,
18,
17,
1106,
310,
2060,
11478,
12410,
15341,
486,
1499... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sync_list_v2() -> anyhow::Result<()> {
env_logger::builder().is_test(true).try_init().ok();
#[derive(Debug, Default)]
struct FakeHttpCaller {
counter: AtomicUsize,
}
impl HttpCaller for FakeHttpCaller {
fn call(&self, request: &mut SyncRequest<'_>) -> SyncResponseResult {
let n = self.counter.fetch_add(1, Ordering::SeqCst);
let body = match n {
0 => {
assert!(request.url().to_string().ends_with("/v2/list?bucket=fakebucketname"));
SyncResponseBody::from_bytes(
[
json_to_string(&json!({
"item": {
"key": "fakeobj1",
"put_time": generate_put_time(),
"hash": "fakeobj1hash",
"fsize": 1usize,
"mime_type": "text/plain",
},
"marker": "fakemarkerobj1",
}))
.unwrap(),
json_to_string(&json!({
"item": {
"key": "fakeobj2",
"put_time": generate_put_time(),
"hash": "fakeobj2hash",
"fsize": 2usize,
"mime_type": "text/plain",
},
"marker": "fakemarkerobj2",
}))
.unwrap(),
]
.join("\n")
.as_bytes()
.to_owned(),
)
}
1 => {
assert!(request
.url()
.to_string()
.ends_with("/list?bucket=fakebucketname&marker=fakemarkerobj2"));
SyncResponseBody::from_bytes(
[
json_to_string(&json!({
"item": {
"key": "fakeobj3",
"put_time": generate_put_time(),
"hash": "fakeobj3hash",
"fsize": 3usize,
"mime_type": "text/plain",
},
"marker": "fakemarkerobj3",
}))
.unwrap(),
json_to_string(&json!({
"item": {
"key": "fakeobj4",
"put_time": generate_put_time(),
"hash": "fakeobj4hash",
"fsize": 4usize,
"mime_type": "text/plain",
},
"marker": "",
}))
.unwrap(),
]
.join("\n")
.as_bytes()
.to_owned(),
)
}
_ => unreachable!(),
};
Ok(SyncResponse::builder()
.status_code(StatusCode::OK)
.header("x-reqid", HeaderValue::from_static("FakeReqid"))
.body(body)
.build())
}
#[cfg(feature = "async")]
fn async_call(&self, _request: &mut AsyncRequest<'_>) -> BoxFuture<AsyncResponseResult> {
unreachable!()
}
}
let mut counter = 0usize;
for (i, entry) in get_bucket(FakeHttpCaller::default())
.list()
.version(ListVersion::V2)
.iter()
.enumerate()
{
counter += 1;
let entry = entry?;
assert_eq!(entry.get_key_as_str(), &format!("fakeobj{}", i + 1));
assert_eq!(entry.get_hash_as_str(), &format!("fakeobj{}hash", i + 1));
assert_eq!(entry.get_size_as_u64(), i as u64 + 1);
}
assert_eq!(counter, 4usize);
Ok(())
} | rust_cleaned_test_functions.jsonl/61342 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23008,
2019,
2273,
17,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
6105,
27413,
486,
17850,
1005,
285,
4452,
3715,
568,
1539,
6137,
1005,
562,
1428,
286,
11506,
27098,
42618,
11,
7899,
5563,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_bridge_pyo3_abi3() {
let pyo3_pure = MetadataCommand::new()
.manifest_path(&Path::new("test-crates/pyo3-pure").join("Cargo.toml"))
.exec()
.unwrap();
assert!(matches!(
find_bridge(&pyo3_pure, None),
Ok(BridgeModel::BindingsAbi3(3, 6))
));
assert!(matches!(
find_bridge(&pyo3_pure, Some("pyo3")),
Ok(BridgeModel::BindingsAbi3(3, 6))
));
assert!(find_bridge(&pyo3_pure, Some("rust-cpython")).is_err());
} | rust_cleaned_test_functions.jsonl/11937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
54944,
620,
16032,
18,
22885,
72,
18,
368,
341,
286,
1077,
4510,
78,
18,
620,
552,
284,
33589,
4062,
486,
931,
741,
310,
659,
42315,
2638,
2099,
1820,
486,
931,
445,
1944,
47589,
973,
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_check_transfer_success_with_source_and_target() {
let genesis_account = GenesisAccount::account(
DEFAULT_ACCOUNT_PUBLIC_KEY.clone(),
Motes::new(U512::from(DEFAULT_ACCOUNT_INITIAL_BALANCE)),
None,
);
let mut genesis_config = DEFAULT_GENESIS_CONFIG.clone();
genesis_config.ee_config_mut().push_account(genesis_account);
let run_genesis_request = RunGenesisRequest::new(
*DEFAULT_GENESIS_CONFIG_HASH,
genesis_config.protocol_version(),
genesis_config.take_ee_config(),
);
let transfer_amount = U512::try_from(SECOND_TRANSFER_AMOUNT).expect("U512 from u64");
// Doing a transfer from main purse to create new purse and store URef under NEW_PURSE_NAME.
let path = PathBuf::from(TRANSFER_WASM);
let session_args = runtime_args! {
ARG_DESTINATION => NEW_PURSE_NAME,
ARG_AMOUNT => transfer_amount
};
let deploy_item = DeployItemBuilder::new()
.with_empty_payment_bytes(runtime_args! {ARG_AMOUNT => *DEFAULT_PAYMENT})
.with_session_code(path, session_args)
.with_address(*DEFAULT_ACCOUNT_ADDR)
.with_authorization_keys(&[*DEFAULT_ACCOUNT_ADDR])
.build();
let exec_request = ExecuteRequestBuilder::from_deploy_item(deploy_item).build();
let mut builder = InMemoryWasmTestBuilder::default();
builder.run_genesis(&run_genesis_request).commit();
// we need this to figure out what the transfer fee is.
let proposer_starting_balance = builder.get_proposer_purse_balance();
// Getting main purse URef to verify transfer
let source_purse = builder
.get_expected_account(*DEFAULT_ACCOUNT_ADDR)
.main_purse();
builder.exec(exec_request).commit().expect_success();
let transaction_fee = builder.get_proposer_purse_balance() - proposer_starting_balance;
let expected_source_ending_balance = Motes::new(U512::from(DEFAULT_ACCOUNT_INITIAL_BALANCE))
- Motes::new(transfer_amount)
- Motes::new(transaction_fee);
let actual_source_ending_balance = Motes::new(builder.get_purse_balance(source_purse));
assert_eq!(expected_source_ending_balance, actual_source_ending_balance);
// retrieve newly created purse URef
builder
.query(
None,
Key::Account(*DEFAULT_ACCOUNT_ADDR),
&[NEW_PURSE_NAME.to_string()],
)
.expect("new purse should exist");
// let target_purse = builder
let default_account = builder.get_expected_account(*DEFAULT_ACCOUNT_ADDR);
let target_purse = default_account
.named_keys()
.get(NEW_PURSE_NAME)
.expect("value")
.into_uref()
.expect("uref");
let expected_balance = U512::from(SECOND_TRANSFER_AMOUNT);
let target_balance = builder.get_purse_balance(target_purse);
assert_eq!(expected_balance, target_balance);
} | rust_cleaned_test_functions.jsonl/123012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
35403,
18632,
6615,
10347,
8378,
11123,
368,
341,
262,
1077,
59366,
13500,
284,
40788,
7365,
486,
4608,
1006,
286,
11955,
38831,
36209,
6600,
15997,
3148,
286,
386,
6295,
486,
931,
12317,
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_no_collisions() {
assert!(!rankless_route_collisions(&["/a/b", "/a/b/c"]));
assert!(!rankless_route_collisions(&["/a/b/c/d", "/a/b/c/<d>/e"]));
assert!(!rankless_route_collisions(&["/a/d/<b..>", "/a/b/c"]));
assert!(!rankless_route_collisions(&["/<_>", "/"]));
assert!(!rankless_route_collisions(&["/a/<_>", "/a"]));
assert!(!rankless_route_collisions(&["/a/<_>", "/<_>"]));
} | rust_cleaned_test_functions.jsonl/25741 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
43597,
6805,
368,
341,
286,
2060,
0,
3471,
13129,
1717,
28109,
43597,
6805,
2099,
1183,
14,
64,
3470,
497,
3521,
64,
3470,
2899,
74446,
286,
2060,
0,
3471,
13129,
1717,
28109,
43597,
6805,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_integer() {
let file = SimpleFile::new(
String::from("main.lt"),
String::from(unindent::unindent("")),
);
let mut lexer = Lexer::from_text("25", file);
lexer.tokenize();
let tokens = lexer.tokens;
assert_tokens!(tokens, [token!(integer), token!(EOF),])
} | rust_cleaned_test_functions.jsonl/118774 | {
"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,
31725,
368,
341,
262,
1077,
1034,
284,
8993,
1703,
486,
931,
1006,
286,
923,
486,
1499,
445,
3817,
82092,
4461,
286,
923,
486,
1499,
18364,
32840,
486,
359,
32840,
445,
30154,
262,
1439,
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_chars_rev_decoding() {
for c in (0..0x110000).filter_map(::std::char::from_u32) {
let bytes = c.encode_utf8();
let s = ::std::str::from_utf8(bytes.as_slice()).unwrap();
if Some(c) != s.chars().rev().next() {
panic!("character {:x}={} does not decode correctly", c as u32, c);
}
}
} | rust_cleaned_test_functions.jsonl/68532 | {
"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,
37418,
38082,
13783,
3700,
368,
341,
262,
369,
272,
304,
320,
15,
496,
15,
87,
16,
16,
15,
15,
15,
15,
568,
5315,
5376,
38732,
1834,
486,
1762,
486,
1499,
7300,
18,
17,
8,
341,
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... | 3 |
#[test]
fn test_get_source_code_3() {
let (_temp_dir, deno_dir) = test_setup();
// Test basic follow and headers recording
tokio_util::init(|| {
let redirect_module_name =
"http://localhost:4546/tests/subdir/redirects/redirect1.js";
let redirect_source_filename = deno_fs::normalize_path(
deno_dir
.deps_http
.join("localhost_PORT4546/tests/subdir/redirects/redirect1.js")
.as_ref(),
);
let target_module_name =
"http://localhost:4545/tests/subdir/redirects/redirect1.js";
let redirect_target_filename = deno_fs::normalize_path(
deno_dir
.deps_http
.join("localhost_PORT4545/tests/subdir/redirects/redirect1.js")
.as_ref(),
);
let mod_meta = get_source_code(
&deno_dir,
redirect_module_name,
&redirect_source_filename,
true,
).unwrap();
// File that requires redirection is not downloaded.
assert!(fs::read_to_string(&redirect_source_filename).is_err());
let redirect_source_headers =
get_source_code_headers(&redirect_source_filename);
assert_eq!(
redirect_source_headers.redirect_to.unwrap(),
"http://localhost:4545/tests/subdir/redirects/redirect1.js"
);
// The target of redirection is downloaded instead.
assert_eq!(
fs::read_to_string(&redirect_target_filename).unwrap(),
"export const redirect = 1;\n"
);
let redirect_target_headers =
get_source_code_headers(&redirect_target_filename);
assert!(redirect_target_headers.redirect_to.is_none());
// Examine the meta result.
assert_eq!(&mod_meta.module_name, target_module_name);
assert_eq!(
&mod_meta.module_redirect_source_name.clone().unwrap(),
redirect_module_name
);
});
} | rust_cleaned_test_functions.jsonl/83869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 850
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
10347,
4136,
62,
18,
368,
341,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
543,
262,
442,
3393,
6770,
1795,
323,
7102,
14633,
198,
262,
9628,
815,
18974,
486,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_detect_compiler_kind_process_fail() {
let creator = new_creator();
let pool = CpuPool::new(1);
next_command(&creator, Ok(MockChild::new(exit_status(1), "", "")));
assert!(detect_compiler(&creator, "/foo/bar".as_ref(), &[], &pool)
.wait()
.is_err());
} | rust_cleaned_test_functions.jsonl/32355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56457,
80910,
33162,
11305,
22121,
368,
341,
286,
1077,
19919,
284,
501,
68532,
543,
286,
1077,
7314,
284,
356,
5584,
10551,
486,
931,
7,
16,
317,
286,
1790,
10811,
2099,
32398,
11,
7622,
66436,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decimal_file() {
use arrow::array::DecimalArray;
let testdata = arrow::util::test_util::parquet_test_data();
let file_variants = vec![("fixed_length", 25), ("int32", 4), ("int64", 10)];
for (prefix, target_precision) in file_variants {
let path = format!("{}/{}_decimal.parquet", testdata, prefix);
let file = File::open(&path).unwrap();
let mut arrow_reader = ParquetFileArrowReader::try_new(file).unwrap();
let mut record_reader = arrow_reader.get_record_reader(32).unwrap();
let batch = record_reader.next().unwrap().unwrap();
assert_eq!(batch.num_rows(), 24);
let col = batch
.column(0)
.as_any()
.downcast_ref::<DecimalArray>()
.unwrap();
let expected = 1..25;
assert_eq!(col.precision(), target_precision);
assert_eq!(col.scale(), 2);
for (i, v) in expected.enumerate() {
assert_eq!(col.value(i), v * 100_i128);
}
}
} | rust_cleaned_test_functions.jsonl/83377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 566
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
74429,
2458,
368,
341,
286,
990,
17921,
486,
1653,
486,
11269,
1857,
280,
286,
1077,
1273,
691,
284,
17921,
486,
1314,
486,
1944,
18974,
486,
1732,
23300,
4452,
1769,
543,
286,
1077,
1034,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_encoded_size() {
assert_eq!(encoded_size(0).unwrap(), 0);
assert_eq!(encoded_size(54).unwrap(), 72);
assert_eq!(encoded_size(58).unwrap(), 81);
assert!(encoded_size(usize::max_value()).is_none());
} | rust_cleaned_test_functions.jsonl/9112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73069,
2368,
368,
341,
286,
2060,
10714,
10297,
19329,
2368,
7,
15,
568,
15454,
1507,
220,
15,
317,
286,
2060,
10714,
10297,
19329,
2368,
7,
20,
19,
568,
15454,
1507,
220,
22,
17,
317,
286,
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_execute_cost_table_upsert_exceeds_capacity() {
solana_logger::setup();
let capacity: usize = 2;
let mut testee = ExecuteCostTable::new(capacity);
let key1 = Pubkey::new_unique();
let key2 = Pubkey::new_unique();
let key3 = Pubkey::new_unique();
let key4 = Pubkey::new_unique();
let cost1: u64 = 100;
let cost2: u64 = 110;
let cost3: u64 = 120;
let cost4: u64 = 130;
// insert one record
testee.upsert(&key1, &cost1);
assert_eq!(1, testee.get_count());
assert_eq!(&cost1, testee.get_cost(&key1).unwrap());
// insert 2nd record
testee.upsert(&key2, &cost2);
assert_eq!(2, testee.get_count());
assert_eq!(&cost1, testee.get_cost(&key1).unwrap());
assert_eq!(&cost2, testee.get_cost(&key2).unwrap());
testee.upsert(&key3, &cost3);
assert_eq!(2, testee.get_count());
assert_eq!((cost2 + cost3) / 2_u64, testee.get_average());
assert_eq!(cost3, testee.get_mode());
assert!(testee.get_cost(&key1).is_none());
assert_eq!(&cost2, testee.get_cost(&key2).unwrap());
assert_eq!(&cost3, testee.get_cost(&key3).unwrap());
testee.upsert(&key2, &cost1);
testee.upsert(&key4, &cost4);
assert_eq!(((cost1 + cost2) / 2 + cost4) / 2_u64, testee.get_average());
assert_eq!((cost1 + cost2) / 2, testee.get_mode());
assert_eq!(2, testee.get_count());
assert!(testee.get_cost(&key1).is_none());
assert_eq!(&((cost1 + cost2) / 2), testee.get_cost(&key2).unwrap());
assert!(testee.get_cost(&key3).is_none());
assert_eq!(&cost4, testee.get_cost(&key4).unwrap());
} | rust_cleaned_test_functions.jsonl/71276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 886
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
15890,
5237,
8237,
6047,
2702,
4635,
82,
35603,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
8654,
25,
22301,
284,
220,
17,
280,
286,
1077,
5206,
1273,
2127,
284,
20848,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_assign() {
let mut v1 = Vec3::new(2.0f64, 4.0f64, 6.0f64);
let v2 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
v1 /= 2f64;
assert_eq!(v1, v2);
} | rust_cleaned_test_functions.jsonl/120485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
20688,
368,
972,
286,
1077,
5206,
348,
16,
284,
11312,
18,
486,
931,
7,
17,
13,
15,
69,
21,
19,
11,
220,
19,
13,
15,
69,
21,
19,
11,
220,
21,
13,
15,
69,
21,
19,
736,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utf8_single_column_reader_test() {
let message_type = "
message test_schema {
REQUIRED BINARY leaf (UTF8);
}
";
let converter = Utf8ArrayConverter {};
run_single_column_reader_tests::<
ByteArrayType,
StringArray,
Utf8ArrayConverter,
RandUtf8Gen,
>(2, message_type, &converter);
} | rust_cleaned_test_functions.jsonl/115775 | {
"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,
39453,
23,
19487,
8744,
22306,
4452,
368,
341,
286,
1077,
1943,
1819,
284,
6228,
286,
1943,
1273,
25371,
341,
688,
66577,
425,
32593,
15933,
320,
8561,
23,
317,
286,
456,
286,
41620,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int_type() {
let input = "u16 i16 i108 u104.5";
let expected = vec![
Token::IntType(IntType::Unsigned(16)),
Token::IntType(IntType::Signed(16)),
Token::IntType(IntType::Signed(108)),
Token::IntType(IntType::Unsigned(104)),
Token::Dot,
Token::Int(5.into()),
];
let mut lexer = Lexer::new(input);
for token in expected.into_iter() {
let got = lexer.next_token().unwrap();
assert_eq!(got, token);
}
} | rust_cleaned_test_functions.jsonl/72659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
1819,
368,
341,
262,
1077,
1946,
284,
330,
84,
16,
21,
600,
16,
21,
600,
16,
15,
23,
575,
16,
15,
19,
13,
20,
3302,
262,
1077,
3601,
284,
7486,
90515,
286,
9660,
486,
1072,
929,
2412... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_noto_sans() {
run_test(
&TEST_DATA,
"directwrite/good-noto-sans.kn",
"noto/NotoSansKannada-Regular.ttf",
&[JOINER_GLYPH_INDEX],
0,
);
} | rust_cleaned_test_functions.jsonl/91219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2072,
643,
596,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
19798,
4934,
4846,
1386,
29169,
78,
1331,
596,
5202,
77,
756,
503,
330,
1921,
78,
20290,
2072,
46882,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_did_exchange_handle_other_messages_from_responded_state() {
let _setup = SetupIndyMocks::init();
let mut did_exchange_sm = inviter_sm().to_inviter_responded_state();
let routing_keys: Vec<String> = vec!("verkey123".into());
let service_endpoint = String::from("https://example.org/agent");
did_exchange_sm = did_exchange_sm.handle_connect(routing_keys, service_endpoint).unwrap();
assert_match!(InviterFullState::Responded(_), did_exchange_sm.state);
} | rust_cleaned_test_functions.jsonl/29143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
307,
59212,
10630,
30456,
23428,
5673,
4918,
3511,
291,
4387,
368,
341,
394,
1077,
716,
15188,
284,
18626,
1425,
88,
72577,
486,
2327,
1428,
394,
1077,
5206,
1521,
59212,
15874,
284,
1529,
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_rc4_md5_cipher() {
let msg = b"abcd1234";
let key = b"key";
let t = CipherType::Rc4Md5;
let iv = t.gen_init_vec();
let mut enc = Rc4Md5Cipher::new(key, &iv[..], CryptoMode::Encrypt);
let mut encrypted_msg = Vec::new();
enc.update(msg, &mut encrypted_msg)
.and_then(|_| enc.finalize(&mut encrypted_msg))
.unwrap();
let mut dec = Rc4Md5Cipher::new(key, &iv[..], CryptoMode::Decrypt);
let mut decrypted_msg = Vec::new();
dec.update(&encrypted_msg[..], &mut decrypted_msg)
.and_then(|_| dec.finalize(&mut decrypted_msg))
.unwrap();
assert_eq!(msg, &decrypted_msg[..]);
} | rust_cleaned_test_functions.jsonl/56456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30299,
19,
32994,
20,
76692,
368,
341,
286,
1077,
3750,
284,
293,
1,
68644,
16,
17,
18,
19,
876,
286,
1077,
1376,
284,
293,
1,
792,
3302,
286,
1077,
259,
284,
63288,
929,
486,
49,
66,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reader_rng_fill_bytes() {
let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
let mut w = [0u8, .. 8];
let mut rng = ReaderRng::new(MemReader::new(v.to_owned()));
rng.fill_bytes(w);
assert_eq!(v, w);
} | rust_cleaned_test_functions.jsonl/62933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
66849,
30728,
12524,
368,
341,
286,
1077,
348,
284,
508,
16,
84,
23,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
935,
286,
1077,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ascii_into_str() {
assert_eq!(vec2ascii![40, 32, 59].into_str(), "( ;".to_string());
assert_eq!(vec2ascii!(40, 32, 59).into_str(), "( ;".to_string());
} | rust_cleaned_test_functions.jsonl/123477 | {
"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,
50238,
45514,
2895,
368,
341,
286,
2060,
10714,
10297,
4083,
17,
23324,
20703,
19,
15,
11,
220,
18,
17,
11,
220,
20,
24,
936,
18122,
2895,
1507,
11993,
2587,
3263,
983,
3904,
1423,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_custom_cache() {
let loader =
Loader::<i32, (usize, i32), (), _>::new(Batcher::new(2)).with_cache(MyCache::new());
let v1 = loader.load(1);
let v2 = loader.load(2);
assert_eq!(
((1, 10), (1, 20)),
executor::block_on(future::try_join(v1, v2)).unwrap(),
);
loader.clear();
let v3 = loader.load(1);
let v4 = loader.load(2);
assert_eq!(
((2, 10), (2, 20)),
executor::block_on(future::try_join(v3, v4)).unwrap(),
);
} | rust_cleaned_test_functions.jsonl/18913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15875,
11529,
368,
341,
1066,
262,
1077,
16047,
4035,
286,
27811,
27638,
72,
18,
17,
11,
320,
51878,
11,
600,
18,
17,
701,
38104,
716,
6831,
931,
5349,
28058,
486,
931,
7,
17,
4579,
4197,
1152... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rng_fill_bytes() {
let mut v = Vec::from_elem(fill_bytes_v_len, 0u8);
::test::rng().fill_bytes(v.as_mut_slice());
// recursed.
assert_eq!(v.len(), fill_bytes_v_len);
// average of `v` is not 0.
let mut sum = 0.0;
for &x in v.iter() {
sum += x as f64;
}
assert!(sum / v.len() as f64 != 0.0);
} | rust_cleaned_test_functions.jsonl/132552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66849,
30728,
12524,
368,
341,
286,
1077,
5206,
348,
284,
11312,
486,
1499,
28179,
81654,
12524,
2273,
6043,
11,
220,
15,
84,
23,
317,
286,
3504,
1944,
486,
69890,
1005,
7559,
12524,
3747,
5357,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_complex() {
let keypad = Matrix::from_array(5,5,
&['-','-','1','-','-',
'-','2','3','4','-',
'5','6', '7','8','9',
'-','A','B','C','-',
'-','-','D','-','-']);
let initial_state = State{x:0, y:2}; // Key 5
let code = process_sequence_on_grid(&initial_state,
"ULL\nRRDDD\nLURDL\nUUUUD",
&keypad);
println!("{}", code);
assert!(code == "5DB3");
} | rust_cleaned_test_functions.jsonl/100913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41522,
368,
1476,
262,
1077,
60205,
284,
11631,
486,
1499,
3858,
7,
20,
11,
20,
345,
286,
609,
677,
12,
67268,
1844,
16,
67268,
67268,
751,
688,
7788,
1844,
17,
1844,
18,
1844,
19,
67268,
751,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq() {
let mut a = TreeMap::new();
let mut b = TreeMap::new();
assert!(a == b);
assert!(a.insert(0i, 5i));
assert!(a != b);
assert!(b.insert(0, 4));
assert!(a != b);
assert!(a.insert(5, 19));
assert!(a != b);
assert!(!b.insert(0, 5));
assert!(a != b);
assert!(b.insert(5, 19));
assert!(a == b);
} | rust_cleaned_test_functions.jsonl/66370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
341,
286,
1077,
5206,
264,
284,
76883,
486,
931,
543,
286,
1077,
5206,
293,
284,
76883,
486,
931,
1428,
286,
2060,
10297,
64,
621,
293,
317,
286,
2060,
10297,
64,
7030,
7,
15,
72,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syscall_get_sysvar() {
let config = Config::default();
let src_clock = Clock {
slot: 1,
epoch_start_timestamp: 2,
epoch: 3,
leader_schedule_epoch: 4,
unix_timestamp: 5,
};
let src_epochschedule = EpochSchedule {
slots_per_epoch: 1,
leader_schedule_slot_offset: 2,
warmup: false,
first_normal_epoch: 3,
first_normal_slot: 4,
};
let src_fees = Fees {
fee_calculator: FeeCalculator {
lamports_per_signature: 1,
},
};
let src_rent = Rent {
lamports_per_byte_year: 1,
exemption_threshold: 2.0,
burn_percent: 3,
};
let mut sysvar_cache = SysvarCache::default();
sysvar_cache.set_clock(src_clock.clone());
sysvar_cache.set_epoch_schedule(src_epochschedule);
sysvar_cache.set_fees(src_fees.clone());
sysvar_cache.set_rent(src_rent);
prepare_mockup!(
invoke_context,
transaction_context,
program_id,
bpf_loader::id(),
);
invoke_context.sysvar_cache = Cow::Owned(sysvar_cache);
// Test clock sysvar
{
let got_clock = Clock::default();
let got_clock_va = 0x100000000;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![
MemoryRegion::default(),
MemoryRegion {
host_addr: &got_clock as *const _ as u64,
vm_addr: got_clock_va,
len: size_of::<Clock>() as u64,
vm_gap_shift: 63,
is_writable: true,
},
],
&config,
)
.unwrap();
let mut syscall = SyscallGetClockSysvar {
invoke_context: Rc::new(RefCell::new(&mut invoke_context)),
};
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
syscall.call(got_clock_va, 0, 0, 0, 0, &memory_mapping, &mut result);
result.unwrap();
assert_eq!(got_clock, src_clock);
}
// Test epoch_schedule sysvar
{
let got_epochschedule = EpochSchedule::default();
let got_epochschedule_va = 0x100000000;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![
MemoryRegion::default(),
MemoryRegion {
host_addr: &got_epochschedule as *const _ as u64,
vm_addr: got_epochschedule_va,
len: size_of::<EpochSchedule>() as u64,
vm_gap_shift: 63,
is_writable: true,
},
],
&config,
)
.unwrap();
let mut syscall = SyscallGetEpochScheduleSysvar {
invoke_context: Rc::new(RefCell::new(&mut invoke_context)),
};
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
syscall.call(
got_epochschedule_va,
0,
0,
0,
0,
&memory_mapping,
&mut result,
);
result.unwrap();
assert_eq!(got_epochschedule, src_epochschedule);
}
// Test fees sysvar
{
let got_fees = Fees::default();
let got_fees_va = 0x100000000;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![
MemoryRegion::default(),
MemoryRegion {
host_addr: &got_fees as *const _ as u64,
vm_addr: got_fees_va,
len: size_of::<Fees>() as u64,
vm_gap_shift: 63,
is_writable: true,
},
],
&config,
)
.unwrap();
let mut syscall = SyscallGetFeesSysvar {
invoke_context: Rc::new(RefCell::new(&mut invoke_context)),
};
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
syscall.call(got_fees_va, 0, 0, 0, 0, &memory_mapping, &mut result);
result.unwrap();
assert_eq!(got_fees, src_fees);
}
// Test rent sysvar
{
let got_rent = Rent::default();
let got_rent_va = 0x100000000;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![
MemoryRegion::default(),
MemoryRegion {
host_addr: &got_rent as *const _ as u64,
vm_addr: got_rent_va,
len: size_of::<Rent>() as u64,
vm_gap_shift: 63,
is_writable: true,
},
],
&config,
)
.unwrap();
let mut syscall = SyscallGetRentSysvar {
invoke_context: Rc::new(RefCell::new(&mut invoke_context)),
};
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
syscall.call(got_rent_va, 0, 0, 0, 0, &memory_mapping, &mut result);
result.unwrap();
assert_eq!(got_rent, src_rent);
}
} | rust_cleaned_test_functions.jsonl/69892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20344,
6659,
3062,
20344,
947,
368,
341,
286,
1077,
2193,
284,
5532,
486,
2258,
543,
286,
1077,
2286,
23062,
284,
26142,
341,
310,
9446,
25,
220,
16,
345,
310,
16342,
4906,
23073,
25,
220,
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_not_with_one_eq_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let json = format!(r#"{{"$not":{{"~{}":"{}"}}}}"#, name1, value1);
let query = parse_from_json(&json).unwrap();
let expected = Operator::Not(
Box::new(
Operator::Eq(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
)
)
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
6615,
11667,
10714,
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,
626,
286,
1077,
2951,
284,
3561,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wapo_cert() {
Context::new(
"wapo",
"www.washingtonpost.com",
&[
include_bytes!("testdata/cert-wapo.0.der"),
include_bytes!("testdata/cert-wapo.1.der"),
],
)
.bench(100)
} | rust_cleaned_test_functions.jsonl/811 | {
"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,
1670,
65552,
37097,
368,
341,
262,
9608,
486,
931,
1006,
286,
330,
21726,
78,
756,
286,
330,
2136,
1418,
31699,
2203,
905,
756,
286,
609,
9640,
310,
2924,
12524,
17223,
92425,
2899,
529,
2630,
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_ecdsa_purge_validated_dealing_support() {
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
with_test_replica_logger(|logger| {
let (mut ecdsa_pool, pre_signer) =
create_pre_signer_dependencies(pool_config, logger);
let (id_1, id_2, id_3) = (
create_transcript_id(1),
create_transcript_id(2),
create_transcript_id(3),
);
let mut support_1 = create_support(id_1, NODE_2, NODE_3);
support_1.content.requested_height = Height::from(20);
let mut support_2 = create_support(id_2, NODE_2, NODE_3);
support_2.content.requested_height = Height::from(20);
let msg_id_2 = support_2.message_hash();
let mut support_3 = create_support(id_3, NODE_2, NODE_3);
support_3.content.requested_height = Height::from(200);
let change_set = vec![
EcdsaChangeAction::AddToValidated(EcdsaMessage::EcdsaDealingSupport(support_1)),
EcdsaChangeAction::AddToValidated(EcdsaMessage::EcdsaDealingSupport(support_2)),
EcdsaChangeAction::AddToValidated(EcdsaMessage::EcdsaDealingSupport(support_3)),
];
ecdsa_pool.apply_changes(change_set);
let t = create_transcript_param(id_1, &[NODE_2], &[NODE_4]);
let block_reader =
TestEcdsaBlockReader::for_pre_signer_test(Height::from(100), vec![t]);
let change_set = pre_signer.purge_artifacts(&ecdsa_pool, &block_reader);
assert_eq!(change_set.len(), 1);
assert!(is_removed_from_validated(&change_set, &msg_id_2));
})
})
} | rust_cleaned_test_functions.jsonl/86727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1059
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
620,
39823,
8337,
657,
2259,
6132,
25827,
368,
341,
286,
17902,
4452,
94044,
486,
63722,
15709,
5332,
486,
4197,
4452,
15709,
5332,
22428,
10285,
5332,
91,
341,
310,
448,
4452,
25533,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inverse_transform_vector() {
let axis = Unit::from_value(Vector3::unit_z());
let angle = Degrees(72_f64);
let cos_neg_angle = (-angle).cos();
let sin_neg_angle = (-angle).sin();
let distance = Vector3::new(-567_f64, 23_f64, 201_f64);
let isometry = Isometry3::from_axis_angle_translation(&axis, angle, &distance);
let vector = Vector3::new(1_f64, 2_f64, 3_f64);
let expected = Vector3::new(
cos_neg_angle * vector.x - sin_neg_angle * vector.y,
sin_neg_angle * vector.x + cos_neg_angle * vector.y,
vector.z
);
let result = isometry.inverse_transform_vector(&vector);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/77231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63333,
18449,
12247,
368,
341,
286,
1077,
8024,
284,
7954,
486,
1499,
3142,
20258,
18,
486,
3843,
6415,
1423,
286,
1077,
9210,
284,
92901,
7,
22,
17,
761,
21,
19,
317,
286,
1077,
7960,
28209,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_withdraw_from_nonce_account() {
let (mut genesis_config, _mint_keypair) = create_genesis_config(100_000);
genesis_config.rent.lamports_per_byte_year = 42;
let bank = Bank::new(&genesis_config);
let min_balance = bank.get_minimum_balance_for_rent_exemption(nonce::State::size());
let nonce = Keypair::new();
let nonce_account = AccountSharedData::new_data(
min_balance + 42,
&nonce::state::Versions::new_current(nonce::State::Initialized(
nonce::state::Data::default(),
)),
&system_program::id(),
)
.unwrap();
bank.store_account(&nonce.pubkey(), &nonce_account);
assert_eq!(bank.get_balance(&nonce.pubkey()), min_balance + 42);
assert_eq!(
bank.withdraw(&nonce.pubkey(), min_balance / 2),
Err(TransactionError::InsufficientFundsForFee)
);
assert_eq!(bank.get_balance(&nonce.pubkey()), min_balance + 42);
// Resulting in exactly rent-exempt balance succeeds
bank.withdraw(&nonce.pubkey(), 42).unwrap();
assert_eq!(bank.get_balance(&nonce.pubkey()), min_balance);
// Account closure fails
assert_eq!(
bank.withdraw(&nonce.pubkey(), min_balance),
Err(TransactionError::InsufficientFundsForFee),
);
} | rust_cleaned_test_functions.jsonl/2566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 646
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
6615,
7633,
5673,
48508,
13500,
368,
341,
286,
1077,
320,
6984,
59366,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
15,
62,
15,
15,
15,
317,
286,
5936... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone_from() {
let m = vec![1; 8];
let n = vec![2; 12];
let limit = if cfg!(miri) { 4 } else { 8 }; // Miri is too slow
for pfv in 0..limit {
for pfu in 0..limit {
for longer in 0..2 {
let (vr, ur) = if longer == 0 { (&m, &n) } else { (&n, &m) };
let mut v = VecDeque::from(vr.clone());
for _ in 0..pfv {
v.push_front(1);
}
let mut u = VecDeque::from(ur.clone());
for _ in 0..pfu {
u.push_front(2);
}
v.clone_from(&u);
assert_eq!(&v, &u);
}
}
}
} | rust_cleaned_test_functions.jsonl/80663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
5673,
368,
341,
262,
1077,
296,
284,
7486,
20703,
16,
26,
220,
23,
935,
262,
1077,
308,
284,
7486,
20703,
17,
26,
220,
16,
17,
935,
262,
1077,
3930,
284,
421,
13286,
10297,
19936,
72,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.