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_gpio_setup_ok() {
for mode in &["in", "IN"] {
do_mock_test(format!(r#"GPIO_SETUP 5, "{}""#, mode), &[501]);
}
for mode in &["in-pull-down", "IN-PULL-DOWN"] {
do_mock_test(format!(r#"GPIO_SETUP 6, "{}""#, mode), &[602]);
}
for mode in &["in-pull-up", "IN-PULL-UP"] {
do_mock_test(format!(r#"GPIO_SETUP 7, "{}""#, mode), &[703]);
}
for mode in &["out", "OUT"] {
do_mock_test(format!(r#"GPIO_SETUP 8, "{}""#, mode), &[804]);
}
} | rust_cleaned_test_functions.jsonl/82623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32001,
21363,
19817,
368,
341,
286,
369,
3856,
304,
609,
1183,
258,
497,
330,
687,
1341,
341,
310,
653,
34134,
4452,
20698,
10297,
81,
55543,
26337,
61178,
220,
20,
11,
35503,
3014,
60778,
3856,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_insert_file() {
let f = TestFixture::new();
let p1 = f.create_file("file1", 10);
let p2 = f.create_file("file2", 10);
let p3 = f.create_file("file3", 10);
let mut c = LruDiskCache::new(f.tmp().join("cache"), 25).unwrap();
c.insert_file("file1", &p1).unwrap();
assert_eq!(c.len(), 1);
c.insert_file("file2", &p2).unwrap();
assert_eq!(c.len(), 2);
// Get the file to bump its LRU status.
assert_eq!(
read_all(&mut c.get("file1").unwrap()).unwrap(),
vec![0u8; 10]
);
// Adding this third file should put the cache above the limit.
c.insert_file("file3", &p3).unwrap();
assert_eq!(c.len(), 2);
assert_eq!(c.size(), 20);
// The least-recently-used file should have been removed.
assert!(!c.contains_key("file2"));
assert!(!p1.exists());
assert!(!p2.exists());
assert!(!p3.exists());
} | rust_cleaned_test_functions.jsonl/6723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
2458,
368,
341,
286,
1077,
282,
284,
3393,
18930,
486,
931,
543,
286,
1077,
281,
16,
284,
282,
2520,
2458,
445,
1192,
16,
497,
220,
16,
15,
317,
286,
1077,
281,
17,
284,
282,
2520,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mach_files() -> Result<(), Error> {
let view = ByteView::open(fixture("macos/crash.dSYM/Contents/Resources/DWARF/crash"))?;
let object = Object::parse(&view)?;
let session = object.debug_session()?;
let files = session.files().collect::<Result<Vec<_>, _>>()?;
assert_eq!(files.len(), 554);
insta::assert_debug_snapshot!("mach_files", FilesDebug(&files[..10]));
Ok(())
} | rust_cleaned_test_functions.jsonl/82880 | {
"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,
717,
610,
10931,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
1651,
284,
10906,
851,
486,
2508,
94886,
445,
11948,
436,
2899,
81,
988,
950,
79234,
14,
14803,
76099,
14953,
45458,
37,
2899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_recv_window() {
let stream_start = Wrapping(u32::MAX - 29);
let recv_data = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
];
let mut read_data = [0; 32];
let mut recv_window = RecvWindow::new(8, stream_start);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(8));
assert_eq!(
recv_window.recv(stream_start + Wrapping(0), &recv_data[0..4]),
Some(stream_start + Wrapping(4))
);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(8));
assert_eq!(
recv_window.recv(stream_start + Wrapping(2), &recv_data[2..6]),
Some(stream_start + Wrapping(6))
);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(8));
assert_eq!(recv_window.read(&mut read_data[0..3]), 3);
assert_eq!(recv_window.read(&mut read_data[3..5]), 2);
for i in 0..5 {
assert_eq!(read_data[i], i as u8);
}
assert_eq!(recv_window.window_end(), stream_start + Wrapping(13));
assert_eq!(
recv_window.recv(stream_start + Wrapping(4), &recv_data[4..10]),
Some(stream_start + Wrapping(10))
);
assert_eq!(
recv_window.recv(stream_start + Wrapping(9), &recv_data[9..15]),
Some(stream_start + Wrapping(13))
);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(13));
assert_eq!(recv_window.read(&mut read_data[5..10]), 5);
for i in 5..10 {
assert_eq!(read_data[i], i as u8);
}
assert_eq!(recv_window.window_end(), stream_start + Wrapping(18));
assert_eq!(
recv_window.recv(stream_start + Wrapping(25), &recv_data[25..30]),
None
);
assert_eq!(
recv_window.recv(stream_start + Wrapping(15), &recv_data[15..25]),
Some(stream_start + Wrapping(18)),
);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(18));
assert_eq!(recv_window.read(&mut read_data[10..20]), 3);
for i in 10..13 {
assert_eq!(read_data[i], i as u8);
}
assert_eq!(recv_window.window_end(), stream_start + Wrapping(21));
assert_eq!(
recv_window.recv(stream_start + Wrapping(10), &recv_data[10..25]),
Some(stream_start + Wrapping(21))
);
// Redundant receives
assert_eq!(
recv_window.recv(stream_start + Wrapping(2), &recv_data[2..10]),
Some(stream_start + Wrapping(10)),
);
assert_eq!(
recv_window.recv(stream_start + Wrapping(14), &recv_data[14..21]),
Some(stream_start + Wrapping(21)),
);
assert_eq!(
recv_window.recv(stream_start + Wrapping(20), &recv_data[20..21]),
Some(stream_start + Wrapping(21)),
);
// receives off of end
assert_eq!(
recv_window.recv(stream_start + Wrapping(21), &recv_data[21..25]),
None,
);
assert_eq!(
recv_window.recv(stream_start + Wrapping(22), &recv_data[22..25]),
None,
);
assert_eq!(
recv_window.recv(stream_start + Wrapping(21), &recv_data[21..21]),
None,
);
assert_eq!(recv_window.read(&mut read_data[13..25]), 8);
for i in 13..21 {
assert_eq!(read_data[i], i as u8);
}
assert_eq!(recv_window.window_end(), stream_start + Wrapping(29));
assert_eq!(
recv_window.recv(stream_start + Wrapping(25), &recv_data[25..27]),
Some(stream_start + Wrapping(27))
);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(29));
assert_eq!(
recv_window.recv(stream_start + Wrapping(21), &recv_data[21..26]),
Some(stream_start + Wrapping(26))
);
assert_eq!(recv_window.read(&mut read_data[21..27]), 6);
for i in 21..27 {
assert_eq!(read_data[i], i as u8);
}
assert_eq!(recv_window.window_end(), stream_start + Wrapping(35));
assert_eq!(
recv_window.recv(stream_start + Wrapping(31), &recv_data[31..32]),
Some(stream_start + Wrapping(32))
);
assert_eq!(recv_window.read(&mut read_data[27..32]), 0);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(35));
assert_eq!(
recv_window.recv(stream_start + Wrapping(28), &recv_data[28..29]),
Some(stream_start + Wrapping(29))
);
assert_eq!(recv_window.read(&mut read_data[27..32]), 0);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(35));
assert_eq!(
recv_window.recv(stream_start + Wrapping(30), &recv_data[30..31]),
Some(stream_start + Wrapping(31))
);
assert_eq!(recv_window.read(&mut read_data[27..32]), 0);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(35));
assert_eq!(
recv_window.recv(stream_start + Wrapping(29), &recv_data[29..30]),
Some(stream_start + Wrapping(30))
);
assert_eq!(recv_window.read(&mut read_data[27..32]), 0);
assert_eq!(recv_window.window_end(), stream_start + Wrapping(35));
assert_eq!(
recv_window.recv(stream_start + Wrapping(27), &recv_data[27..28]),
Some(stream_start + Wrapping(28))
);
assert_eq!(recv_window.read(&mut read_data[27..32]), 5);
for i in 27..32 {
assert_eq!(read_data[i], i as u8);
}
assert_eq!(recv_window.window_end(), stream_start + Wrapping(40));
} | rust_cleaned_test_functions.jsonl/36076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3024
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36118,
12571,
368,
341,
286,
1077,
4269,
4906,
284,
31630,
3629,
8154,
18,
17,
486,
10586,
481,
220,
17,
24,
317,
286,
1077,
27006,
1769,
284,
2278,
310,
220,
15,
11,
220,
16,
11,
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... | 7 |
#[test]
fn test_tuple_access_faulty_type() {
let spec = "input in: (Int8, Bool)\noutput out: Bool := in[0].0";
assert_eq!(1, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
12759,
70097,
88,
1819,
368,
341,
286,
1077,
1398,
284,
330,
1355,
304,
25,
320,
1072,
23,
11,
12608,
10699,
77,
3006,
700,
25,
12608,
1669,
304,
58,
15,
936,
15,
876,
286,
2060,
10714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_overrides() {
let user_config = table_from_toml_str(r#"tab_size = 42"#).unwrap();
let rust_config = table_from_toml_str(r#"tab_size = 31"#).unwrap();
let mut manager = ConfigManager::default();
manager.set_user_config(ConfigDomain::Syntax(SyntaxDefinition::Rust),
rust_config, None).unwrap();
manager.set_user_config(ConfigDomain::General, user_config, None)
.unwrap();
let view_id = "view-id-1".into();
// system override
let changes = json!({"tab_size": 67}).as_object().unwrap().to_owned();
manager.update_user_config(ConfigDomain::SysOverride(view_id), changes).unwrap();
let config = manager.default_buffer_config();
assert_eq!(config.source.0.len(), 1);
assert_eq!(config.items.tab_size, 42);
// yaml defaults set this to 2
let config = manager.get_buffer_config(SyntaxDefinition::Yaml, None);
assert_eq!(config.source.0.len(), 2);
assert_eq!(config.items.tab_size, 2);
let config = manager.get_buffer_config(SyntaxDefinition::Yaml, view_id);
assert_eq!(config.source.0.len(), 3);
assert_eq!(config.items.tab_size, 67);
let config = manager.get_buffer_config(SyntaxDefinition::Rust, None);
assert_eq!(config.items.tab_size, 31);
let config = manager.get_buffer_config(SyntaxDefinition::Rust, view_id);
assert_eq!(config.items.tab_size, 67);
// user override trumps everything
let changes = json!({"tab_size": 85}).as_object().unwrap().to_owned();
manager.update_user_config(ConfigDomain::UserOverride(view_id), changes).unwrap();
let config = manager.get_buffer_config(SyntaxDefinition::Rust, view_id);
assert_eq!(config.items.tab_size, 85);
} | rust_cleaned_test_functions.jsonl/40015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 785
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15431,
18245,
368,
341,
286,
1077,
1196,
5332,
284,
1965,
5673,
528,
316,
75,
2895,
2601,
55543,
6192,
2368,
284,
220,
19,
17,
57676,
568,
15454,
543,
286,
1077,
23071,
5332,
284,
1965,
5673,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_roundtrip_stream_dict_of_list_of_dict() {
// list
let list_data_type = DataType::List(Box::new(Field::new_dict(
"item",
DataType::Dictionary(Box::new(DataType::Int8), Box::new(DataType::Utf8)),
true,
1,
false,
)));
let offsets: &[i32; 5] = &[0, 2, 4, 4, 6];
test_roundtrip_stream_dict_of_list_of_dict_impl::<i32, i32>(
list_data_type,
offsets,
);
// large list
let list_data_type = DataType::LargeList(Box::new(Field::new_dict(
"item",
DataType::Dictionary(Box::new(DataType::Int8), Box::new(DataType::Utf8)),
true,
1,
false,
)));
let offsets: &[i64; 5] = &[0, 2, 4, 4, 7];
test_roundtrip_stream_dict_of_list_of_dict_impl::<i64, i64>(
list_data_type,
offsets,
);
} | rust_cleaned_test_functions.jsonl/48764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
32981,
12673,
5243,
3575,
2019,
3575,
5243,
368,
341,
286,
442,
1140,
198,
286,
1077,
1140,
1769,
1819,
284,
33172,
486,
852,
67758,
486,
931,
57788,
486,
931,
5243,
1006,
310,
330,
1203,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ipv6_to_int() {
let a = Ipv6Addr::new(0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff11);
assert_eq!(u128::from(a), 0x112233445566778899aabbccddeeff11u128);
} | rust_cleaned_test_functions.jsonl/8037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49378,
21,
2346,
4042,
368,
341,
262,
1077,
264,
284,
358,
30168,
21,
13986,
486,
931,
7,
15,
87,
16,
16,
17,
17,
11,
220,
15,
87,
18,
18,
19,
19,
11,
220,
15,
87,
20,
20,
21,
21,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cached_timed_sized_refresh_prime() {
assert!(cached_timed_sized_refresh_prime("true"));
{
let cache = CACHED_TIMED_SIZED_REFRESH_PRIME.lock().unwrap();
assert_eq!(cache.cache_hits(), Some(0));
assert_eq!(cache.cache_misses(), Some(1));
}
assert!(cached_timed_sized_refresh_prime("true"));
{
let cache = CACHED_TIMED_SIZED_REFRESH_PRIME.lock().unwrap();
assert_eq!(cache.cache_hits(), Some(1));
assert_eq!(cache.cache_misses(), Some(1));
}
std::thread::sleep(std::time::Duration::from_millis(500));
assert!(cached_timed_sized_refresh_prime_prime_cache("true"));
std::thread::sleep(std::time::Duration::from_millis(500));
assert!(cached_timed_sized_refresh_prime_prime_cache("true"));
std::thread::sleep(std::time::Duration::from_millis(500));
assert!(cached_timed_sized_refresh_prime_prime_cache("true"));
assert!(cached_timed_sized_refresh_prime("true"));
{
let cache = CACHED_TIMED_SIZED_REFRESH_PRIME.lock().unwrap();
assert_eq!(cache.cache_hits(), Some(2));
assert_eq!(cache.cache_misses(), Some(1));
}
} | rust_cleaned_test_functions.jsonl/13148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
29087,
291,
643,
1506,
42076,
38217,
368,
341,
262,
2060,
10297,
32918,
29087,
291,
643,
1506,
42076,
38217,
445,
1866,
4010,
262,
341,
286,
1077,
6500,
284,
356,
52645,
16746,
1479,
1098,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poh_recorder_tick_sent_after_min() {
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger");
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2);
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
let prev_hash = bank0.last_blockhash();
let (mut poh_recorder, entry_receiver, _record_receiver) = PohRecorder::new(
0,
prev_hash,
bank0.clone(),
Some((4, 4)),
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
bank0.fill_bank_with_ticks();
let bank1 = Arc::new(Bank::new_from_parent(&bank0, &Pubkey::default(), 1));
// Set a working bank
poh_recorder.set_bank(&bank1);
// Tick until poh_recorder.tick_height == working bank's min_tick_height
let num_new_ticks = bank1.tick_height() - poh_recorder.tick_height();
println!("{} {}", bank1.tick_height(), poh_recorder.tick_height());
assert!(num_new_ticks > 0);
for _ in 0..num_new_ticks {
poh_recorder.tick();
}
// Check that poh_recorder.tick_height == working bank's min_tick_height
let min_tick_height = poh_recorder.working_bank.as_ref().unwrap().min_tick_height;
assert_eq!(min_tick_height, bank1.tick_height());
assert_eq!(poh_recorder.tick_height(), min_tick_height);
// so no ticks should have been flushed yet
assert_eq!(poh_recorder.tick_cache.last().unwrap().1, num_new_ticks);
assert!(entry_receiver.try_recv().is_err());
// all ticks are sent after height > min
let tick_height_before = poh_recorder.tick_height();
poh_recorder.tick();
assert_eq!(poh_recorder.tick_height, tick_height_before + 1);
assert_eq!(poh_recorder.tick_cache.len(), 0);
let mut num_entries = 0;
while let Ok((wbank, (_entry, _tick_height))) = entry_receiver.try_recv() {
assert_eq!(wbank.slot(), bank1.slot());
num_entries += 1;
}
assert_eq!(num_entries, num_new_ticks + 1);
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/106262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
2267,
7080,
1358,
43612,
24115,
19844,
7260,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_into_from_raw_unsized() {
use std::fmt::Display;
use std::string::ToString;
let arc: Arc<str> = Arc::from("foo");
let ptr = Arc::into_raw(arc.clone());
let arc2 = unsafe { Arc::from_raw(ptr) };
assert_eq!(unsafe { &*ptr }, "foo");
assert_eq!(arc, arc2);
let arc: Arc<dyn Display> = Arc::new(123);
let ptr = Arc::into_raw(arc.clone());
let arc2 = unsafe { Arc::from_raw(ptr) };
assert_eq!(unsafe { &*ptr }.to_string(), "123");
assert_eq!(arc2.to_string(), "123");
} | rust_cleaned_test_functions.jsonl/42712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
5673,
16067,
4907,
82,
1506,
368,
341,
262,
990,
1460,
486,
12501,
486,
7020,
280,
262,
990,
1460,
486,
917,
486,
5870,
401,
262,
1077,
15580,
25,
19689,
27,
495,
29,
284,
19689,
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... | 1 |
#[test]
fn test_decrypt_oaep_invalid_hash() {
let mut rng = thread_rng();
let priv_key = get_private_key();
let pub_key: RSAPublicKey = priv_key.clone().into();
let mut digest = Sha1::default();
let ciphertext = encrypt(
&mut rng,
&pub_key,
"a_plain_text".as_bytes(),
&mut digest,
None,
)
.unwrap();
assert!(
decrypt(
Some(&mut rng),
&priv_key,
&ciphertext,
&mut digest,
Some("label".to_owned())
)
.is_err(),
"decrypt should have failed on hash verification"
);
} | rust_cleaned_test_functions.jsonl/80041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80764,
14179,
64,
747,
31433,
8950,
368,
341,
286,
1077,
5206,
28422,
284,
4516,
66849,
543,
286,
1077,
6095,
3097,
284,
633,
26249,
3097,
543,
286,
1077,
6675,
3097,
25,
23229,
2537,
475,
1592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_node_not_found() {
let pool = create_connection_pool_and_migrate();
let registry = DieselRegistry::new(pool);
registry
.add_node(get_node_1())
.expect("Unable to insert node");
registry
.add_node(get_node_2())
.expect("Unable to insert node");
assert_eq!(
registry
.get_node("DoesNotExist")
.expect("Failed to fetch node"),
None
)
} | rust_cleaned_test_functions.jsonl/106762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5084,
7913,
21480,
368,
341,
286,
1077,
7314,
284,
1855,
15866,
15709,
8378,
717,
34479,
543,
286,
1077,
19424,
284,
53794,
15603,
486,
931,
41838,
626,
286,
19424,
198,
310,
659,
718,
5084,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_or_init_default_initializer() {
lazy_static::lazy_static!(
static ref ONCE: Once<bool> = Once::default();
);
static COUNTER: AtomicUsize = AtomicUsize::new(0);
let val = block_on(ONCE.get_or_init(async {
COUNTER.fetch_add(1, Ordering::SeqCst);
true
}));
assert_eq!(*val, true);
assert_eq!(COUNTER.load(Ordering::SeqCst), 1);
let val = block_on(ONCE.get_or_init(async {
COUNTER.fetch_add(1, Ordering::SeqCst);
false
}));
assert_eq!(*val, true);
assert_eq!(COUNTER.load(Ordering::SeqCst), 1);
} | rust_cleaned_test_functions.jsonl/1293 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8734,
6137,
9993,
36462,
368,
341,
286,
15678,
25360,
486,
49013,
25360,
33673,
310,
1099,
2053,
6197,
2104,
25,
9646,
17028,
29,
284,
9646,
486,
2258,
543,
286,
3475,
286,
1099,
356,
35019,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cbrt_real() {
for n in (0..100).map(f64::from) {
let n3 = n * n * n;
assert!(close(
Complex64::new(n3, 0.0).cbrt(),
Complex64::new(n, 0.0)
));
// assert!(close(
Complex64::new(-n3, 0.0).cbrt(),
Complex64::from_polar(n, f64::consts::FRAC_PI_3)
));
// ∛(-n assert!(close(
Complex64::new(-n3, -0.0).cbrt(),
Complex64::from_polar(n, -f64::consts::FRAC_PI_3)
));
}
} | rust_cleaned_test_functions.jsonl/105689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
1323,
83,
15266,
368,
341,
310,
369,
308,
304,
320,
15,
496,
16,
15,
15,
568,
2186,
955,
21,
19,
486,
1499,
8,
341,
4597,
1077,
308,
18,
284,
308,
353,
308,
353,
308,
280,
394,
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... | 2 |
#[test]
fn test_elementsd_with_validatepegin() {
let bitcoind_exe = bitcoind::exe_path().unwrap();
let bitcoind_conf = bitcoind::Conf::default();
let bitcoind = BitcoinD::with_conf(&bitcoind_exe, &bitcoind_conf).unwrap();
let conf = Conf::new(Some(&bitcoind));
let exe = init();
let elementsd = ElementsD::with_conf(exe, &conf).unwrap();
let info = elementsd
.client()
.call::<Value>("getblockchaininfo", &[])
.unwrap();
assert_eq!(info.get("chain").unwrap(), "liquidregtest");
} | rust_cleaned_test_functions.jsonl/107291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7894,
13446,
6615,
42681,
375,
8163,
368,
341,
286,
1077,
2699,
1015,
484,
76074,
284,
2699,
1015,
484,
486,
46184,
2638,
1005,
15454,
543,
286,
1077,
2699,
1015,
484,
16059,
284,
2699,
1015,
484,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser_on_all_inputs() {
use crate::parser::ast_from_file;
use std::path::Path;
let mut rv32i_str = String::new();
use std::io::prelude::*;
std::fs::File::open("./cfg/rv32i.toml")
.unwrap()
.read_to_string(&mut rv32i_str)
.unwrap();
let mut rv = crate::arch::RiscVSpec::new();
rv.load_single_cfg_string(&rv32i_str).expect("Parse error");
let dir = Path::new("./test/")
.read_dir()
.expect("Can't open ./test folder of sample inputs");
for entry in dir {
if entry.is_err() {
continue;
}
let entry = entry.unwrap();
if !entry.file_type().unwrap().is_file() {
continue;
}
let epath = entry.path();
let path = epath.to_str().unwrap();
if path.ends_with(".s") {
eprint!(" * parsing {} ...", path);
ast_from_file(path, &rv).expect("Testcase parsing failed");
eprintln!("ok");
}
}
} | rust_cleaned_test_functions.jsonl/22543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
4470,
5705,
28557,
368,
341,
262,
990,
17717,
486,
9657,
486,
559,
5673,
2458,
280,
262,
990,
1460,
486,
2343,
486,
1820,
401,
262,
1077,
5206,
17570,
18,
17,
72,
2895,
284,
923,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_encode_hashmap_with_numeric_key() {
use std::str::from_utf8;
use std::io::Writer;
use std::io::MemWriter;
use collections::HashMap;
let mut hm: HashMap<uint, bool> = HashMap::new();
hm.insert(1, true);
let mut mem_buf = MemWriter::new();
{
let mut encoder = Encoder::new(&mut mem_buf as &mut io::Writer);
hm.encode(&mut encoder).unwrap();
}
let bytes = mem_buf.unwrap();
let json_str = from_utf8(bytes.as_slice()).unwrap();
match from_str(json_str) {
Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
_ => {} // it parsed and we are good to go
}
} | rust_cleaned_test_functions.jsonl/111054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
8950,
2186,
6615,
29418,
3097,
368,
341,
286,
990,
1460,
486,
495,
486,
1499,
39453,
23,
280,
286,
990,
1460,
486,
815,
486,
6492,
280,
286,
990,
1460,
486,
815,
486,
18816,
6492,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_http_cache_location() {
let (file_fetcher, temp_dir) = setup(CacheSetting::Use, None);
let expected = temp_dir.path().join("deps");
let actual = file_fetcher.get_http_cache_location();
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/32458 | {
"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,
3062,
25888,
11529,
13126,
368,
341,
262,
1077,
320,
1192,
11803,
261,
11,
2730,
4334,
8,
284,
6505,
3025,
1777,
15400,
486,
10253,
11,
2240,
317,
262,
1077,
3601,
284,
2730,
4334,
3875,
1005,
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_slow_score() {
let mut slow_score = SlowScore::new(Duration::from_millis(500));
slow_score.timeout_requests = 5;
slow_score.total_requests = 100;
assert_eq!(
OrderedFloat(1.5),
slow_score.update_impl(Duration::from_secs(10))
);
slow_score.timeout_requests = 10;
slow_score.total_requests = 100;
assert_eq!(
OrderedFloat(3.0),
slow_score.update_impl(Duration::from_secs(10))
);
slow_score.timeout_requests = 20;
slow_score.total_requests = 100;
assert_eq!(
OrderedFloat(6.0),
slow_score.update_impl(Duration::from_secs(10))
);
slow_score.timeout_requests = 100;
slow_score.total_requests = 100;
assert_eq!(
OrderedFloat(12.0),
slow_score.update_impl(Duration::from_secs(10))
);
slow_score.timeout_requests = 11;
slow_score.total_requests = 100;
assert_eq!(
OrderedFloat(24.0),
slow_score.update_impl(Duration::from_secs(10))
);
slow_score.timeout_requests = 0;
slow_score.total_requests = 100;
assert_eq!(
OrderedFloat(19.0),
slow_score.update_impl(Duration::from_secs(15))
);
} | rust_cleaned_test_functions.jsonl/3880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 706
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82447,
10405,
368,
341,
286,
1077,
5206,
6301,
10405,
284,
38147,
10570,
486,
931,
64114,
486,
1499,
717,
56212,
7,
20,
15,
15,
1106,
286,
6301,
10405,
36110,
37216,
284,
220,
20,
280,
286,
6301... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concat_grapheme_clusters_no_boundary() {
let s = Sentence::from_tokenized("\u{200d}").unwrap();
let filter = ConcatGraphemeClustersFilter::new();
let s = filter.filter(s);
assert_eq!("\u{200d}", s.to_tokenized_string().unwrap());
} | rust_cleaned_test_functions.jsonl/115429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
14738,
3894,
46243,
6536,
54004,
368,
341,
286,
1077,
274,
284,
79542,
486,
1499,
6458,
1506,
4921,
84,
90,
17,
15,
15,
67,
92,
1827,
15454,
543,
286,
1077,
4051,
284,
78195,
11212,
3894,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pull_request_reopened() {
let mut test = new_test();
test.handler.event = "pull_request".into();
test.handler.action = "reopened".into();
test.handler.data.pull_request = some_pr();
test.handler.data.sender = User::new("the-pr-closer");
test.github.mock_get_pull_request_commits(
"some-user",
"some-repo",
32,
Ok(some_commits()),
);
let attach = vec![
SlackAttachmentBuilder::new("")
.title("Pull Request #32: \"The PR\"")
.title_link("http://the-pr")
.build(),
];
let msg = "Pull Request reopened";
test.slack.expect(vec![
slack::req(
"the-reviews-channel",
&format!("{} {}", msg, REPO_MSG),
attach.clone()
),
]);
let resp = test.handler.handle_event().unwrap();
assert_eq!((StatusCode::OK, "pr".into()), resp);
} | rust_cleaned_test_functions.jsonl/89640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65693,
7893,
1288,
56128,
368,
341,
262,
1077,
5206,
1273,
284,
501,
4452,
543,
262,
1273,
31171,
5773,
284,
330,
23441,
7893,
3263,
18122,
543,
262,
1273,
31171,
12395,
284,
330,
265,
56128,
3263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_top() {
let runc_id = format!("{}", Uuid::new_v4());
let runc_path = env::temp_dir().join(&runc_id).join("runc.amd64");
let runc_root =
PathBuf::from(env::var_os("XDG_RUNTIME_DIR").expect("expected temporary path"))
.join("rust-runc")
.join(&runc_id);
fs::create_dir_all(&runc_root).expect("unable to create runc root");
extract_tarball(
&PathBuf::from("test_fixture/runc_v1.0.0-rc10.tar.gz"),
&env::temp_dir().join(&runc_id),
)
.expect("unable to extract runc");
let mut config: RuncConfiguration = Default::default();
config.command = Some(runc_path.clone());
config.root = Some(runc_root.clone());
let runc = Runc::new(config).expect("Unable to create runc instance");
let task = async move {
let container = ManagedContainer::new(
&runc_path,
&runc_root,
&PathBuf::from("test_fixture/busybox.tar.gz"),
)
.await
.unwrap();
// Time for shell to spawn
delay_for(Duration::from_millis(100)).await;
let processes = runc
.top(&container.id, None)
.await
.map_err(|err| io::Error::new(io::ErrorKind::Other, format!("{}", err)))?;
if processes.len() != 1 {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
"expected a single shell process",
));
}
if let Some(process) = processes.get(0) {
if process["CMD"] != "sh" {
return Err(io::Error::new(io::ErrorKind::InvalidData, "expected shell"));
}
}
Ok::<_, io::Error>(())
};
let mut runtime = Runtime::new().expect("unable to create runtime");
runtime.block_on(task).expect("test failed");
} | rust_cleaned_test_functions.jsonl/24476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1066
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
368,
341,
286,
1077,
435,
1347,
842,
284,
3561,
79878,
547,
2423,
486,
931,
2273,
19,
1423,
286,
1077,
435,
1347,
2638,
284,
6105,
486,
3888,
4334,
1005,
5987,
2099,
81,
1347,
842,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fetch_db_name_with_postgres_scheme() {
let url: url::Url = "postgres://postgres:prisma@127.0.0.1:5432/pgres?schema=test_schema"
.parse()
.unwrap();
let db_name = super::fetch_db_name(&url, "postgres");
assert_eq!(db_name, "pgres");
} | rust_cleaned_test_functions.jsonl/6667 | {
"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,
11803,
8685,
1269,
6615,
6333,
17818,
53293,
368,
341,
286,
1077,
2515,
25,
2515,
486,
2864,
284,
330,
43070,
1110,
43070,
25,
649,
38152,
31,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
20,
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_write_char() {
let tests = &[
('n', "\"n\""),
('"', "\"\\\"\""),
('\\', "\"\\\\\""),
('/', "\"/\""),
('\x08', "\"\\b\""),
('\x0C', "\"\\f\""),
('\n', "\"\\n\""),
('\r', "\"\\r\""),
('\t', "\"\\t\""),
('\x0B', "\"\\u000b\""),
('\u{3A3}', "\"\u{3A3}\""),
];
test_encode_ok(tests);
test_pretty_encode_ok(tests);
} | rust_cleaned_test_functions.jsonl/29819 | {
"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,
9165,
9232,
368,
341,
262,
1077,
7032,
284,
609,
9640,
286,
4319,
77,
516,
15898,
77,
2105,
4461,
286,
4319,
48199,
15898,
3422,
2105,
2105,
4461,
286,
4319,
3422,
516,
15898,
51007,
2105,
4461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_used_in_return_expr() {
check_assist(
inline_local_variable,
"
fn foo() {
let a<|> = 1 > 0;
return a;
}",
"
fn foo() {
<|>return 1 > 0;
}",
);
} | rust_cleaned_test_functions.jsonl/60333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27803,
1243,
12511,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
264,
27,
91,
29,
284,
220,
16,
861,
220,
15,
280,
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_bank_capitalization() {
let bank0 = Arc::new(Bank::new(&GenesisConfig {
accounts: (0..42)
.map(|_| {
(
solana_sdk::pubkey::new_rand(),
Account::new(42, 0, &Pubkey::default()),
)
})
.collect(),
cluster_type: ClusterType::MainnetBeta,
..GenesisConfig::default()
}));
let sysvar_and_native_proram_delta0 = 11;
assert_eq!(
bank0.capitalization(),
42 * 42 + sysvar_and_native_proram_delta0
);
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
let sysvar_and_native_proram_delta1 = 2;
assert_eq!(
bank1.capitalization(),
42 * 42 + sysvar_and_native_proram_delta0 + sysvar_and_native_proram_delta1,
);
} | rust_cleaned_test_functions.jsonl/2526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
16388,
2174,
2022,
368,
341,
286,
1077,
6073,
15,
284,
19689,
486,
931,
5349,
1180,
486,
931,
2099,
84652,
2648,
341,
310,
9618,
25,
320,
15,
496,
19,
17,
340,
394,
659,
2186,
22428,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_nonce_account() {
let from_pubkey = Pubkey::new_unique();
let nonce_pubkey = Pubkey::new_unique();
let authorized = nonce_pubkey;
let ixs = create_nonce_account(&from_pubkey, &nonce_pubkey, &authorized, 42);
assert_eq!(ixs.len(), 2);
let ix = &ixs[0];
assert_eq!(ix.program_id, system_program::id());
let pubkeys: Vec<_> = ix.accounts.iter().map(|am| am.pubkey).collect();
assert!(pubkeys.contains(&from_pubkey));
assert!(pubkeys.contains(&nonce_pubkey));
} | rust_cleaned_test_functions.jsonl/35039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
48508,
13500,
368,
341,
286,
1077,
504,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
39676,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
18630,
284,
39676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_component_deserialize() {
let data = Component::from_str(
r#"{
"workloadType": "core.oam.dev/v1.Singleton",
"osType": "linux",
"arch": "amd64",
"parameters": [],
"containers": [],
"workloadSettings": []
}"#,
);
assert!(data.is_ok());
let component = data.unwrap();
assert_eq!(Some("linux".to_string()), component.os_type);
assert_eq!(Some("amd64".to_string()), component.arch);
assert_eq!("core.oam.dev/v1.Singleton", component.workload_type);
let gvk = GroupVersionKind::from_str(component.workload_type.as_str());
assert!(gvk.is_ok());
} | rust_cleaned_test_functions.jsonl/98679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23406,
15768,
9050,
368,
341,
262,
1077,
821,
284,
5578,
486,
1499,
2895,
1006,
286,
435,
55543,
515,
310,
330,
1778,
1078,
929,
788,
330,
2153,
14439,
309,
21523,
5457,
16,
76323,
756,
310,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_purge_slots() {
let blockstore_path = get_tmp_ledger_path!();
let blockstore = Blockstore::open(&blockstore_path).unwrap();
let (shreds, _) = make_many_slot_entries(0, 50, 5);
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.purge_and_compact_slots(0, 5);
test_all_empty_or_min(&blockstore, 6);
blockstore.purge_and_compact_slots(0, 50);
test_all_empty_or_min(&blockstore, 100);
test_all_empty_or_min(&blockstore, 0);
blockstore
.slot_meta_iterator(0)
.unwrap()
.for_each(|(_, _)| {
panic!();
});
drop(blockstore);
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/38760 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
54161,
368,
341,
286,
1077,
2504,
4314,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2099,
4574,
4314,
2638,
568,
15454,
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_valid_snapshot_accounts() {
solana_logger::setup();
assert!(is_valid_snapshot_archive_entry(
&["accounts", "0.0"],
tar::EntryType::Regular
));
assert!(is_valid_snapshot_archive_entry(
&["accounts", "01829.077"],
tar::EntryType::Regular
));
assert!(!is_valid_snapshot_archive_entry(
&["accounts", "1.2.34"],
tar::EntryType::Regular
));
assert!(!is_valid_snapshot_archive_entry(
&["accounts", "12."],
tar::EntryType::Regular
));
assert!(!is_valid_snapshot_archive_entry(
&["accounts", ".12"],
tar::EntryType::Regular
));
assert!(!is_valid_snapshot_archive_entry(
&["accounts", "0x0"],
tar::EntryType::Regular
));
assert!(!is_valid_snapshot_archive_entry(
&["accounts", "abc"],
tar::EntryType::Regular
));
assert!(!is_valid_snapshot_archive_entry(
&["accounts", "232323"],
tar::EntryType::Regular
));
} | rust_cleaned_test_functions.jsonl/18324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 617
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
53265,
55665,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
2060,
10297,
285,
8337,
53265,
42873,
9078,
1006,
310,
609,
1183,
26206,
497,
330,
15,
13,
15,
8097,
310,
12183,
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_encode_frame_invalid_buf() {
let frame = Frame {
role: Role::Unassigned,
dlci: DLCI::try_from(0).unwrap(),
data: FrameData::SetAsynchronousBalancedMode,
poll_final: false,
command_response: CommandResponse::Command,
credits: None,
};
let mut buf = [];
assert_matches!(frame.encode(&mut buf[..]), Err(FrameParseError::BufferTooSmall));
} | rust_cleaned_test_functions.jsonl/87871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
8929,
31433,
10363,
368,
341,
286,
1077,
4034,
284,
16321,
341,
310,
3476,
25,
15404,
486,
1806,
39021,
345,
310,
27513,
5855,
25,
42919,
40,
486,
1539,
5673,
7,
15,
568,
15454,
3148,
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_minimize_linear_infinite_lower() {
let quad = BoundedQuadratic::new(f64::NEG_INFINITY, f64::INFINITY, 0., 1., 0.);
let (x1, x2) = quad.minimize();
assert!(x1.is_nan());
assert_eq!(x2, f64::NEG_INFINITY);
} | rust_cleaned_test_functions.jsonl/19888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
11853,
40674,
1243,
25722,
30425,
368,
341,
286,
1077,
27082,
284,
425,
13082,
2183,
88678,
486,
931,
955,
21,
19,
486,
97127,
91110,
11,
282,
21,
19,
486,
687,
55990,
11,
220,
15,
2572,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_module_defined_memories_limit() {
let limits = ModuleLimits {
memories: 0,
..Default::default()
};
let mut module = Module::default();
assert!(limits.validate(&module).is_ok());
module.memory_plans.push(MemoryPlan {
style: MemoryStyle::Static { bound: 0 },
memory: Memory {
minimum: 0,
maximum: None,
shared: false,
memory64: false,
},
pre_guard_size: 0,
offset_guard_size: 0,
});
assert_eq!(
limits.validate(&module).map_err(|e| e.to_string()),
Err("defined memories count of 1 exceeds the limit of 0".into())
);
} | rust_cleaned_test_functions.jsonl/48866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
52870,
12976,
2433,
14763,
368,
341,
286,
1077,
13388,
284,
13711,
94588,
341,
310,
18923,
25,
220,
15,
345,
310,
5241,
3675,
486,
2258,
741,
286,
3634,
286,
1077,
5206,
4688,
284,
13711,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signature_rsa_pkcs1_verify() {
let sha1_params = &[
(
&signature::RSA_PKCS1_1024_8192_SHA1_FOR_LEGACY_USE_ONLY,
1024,
),
(
&signature::RSA_PKCS1_2048_8192_SHA1_FOR_LEGACY_USE_ONLY,
2048,
),
];
let sha256_params = &[
(
&signature::RSA_PKCS1_1024_8192_SHA256_FOR_LEGACY_USE_ONLY,
1024,
),
(&signature::RSA_PKCS1_2048_8192_SHA256, 2048),
];
let sha384_params = &[
(&signature::RSA_PKCS1_2048_8192_SHA384, 2048),
(&signature::RSA_PKCS1_3072_8192_SHA384, 3072),
];
let sha512_params = &[
(
&signature::RSA_PKCS1_1024_8192_SHA512_FOR_LEGACY_USE_ONLY,
1024,
),
(&signature::RSA_PKCS1_2048_8192_SHA512, 2048),
];
test::run(
test_file!("rsa_pkcs1_verify_tests.txt"),
|section, test_case| {
assert_eq!(section, "");
let digest_name = test_case.consume_string("Digest");
let params: &[_] = match digest_name.as_ref() {
"SHA1" => sha1_params,
"SHA256" => sha256_params,
"SHA384" => sha384_params,
"SHA512" => sha512_params,
_ => panic!("Unsupported digest: {}", digest_name),
};
let public_key = test_case.consume_bytes("Key");
// Sanity check that we correctly DER-encoded the originally-
let key_bits = untrusted::Input::from(&public_key)
.read_all(error::Unspecified, |input| {
der::nested(input, der::Tag::Sequence, error::Unspecified, |input| {
let n_bytes =
der::positive_integer(input)?.big_endian_without_leading_zero();
let _e = der::positive_integer(input)?;
// must be less than 8 leading zero bits.
let n_leading_zeros = usize::try_from(n_bytes[0].leading_zeros()).unwrap();
assert!(n_leading_zeros < 8);
Ok((n_bytes.len() * 8) - n_leading_zeros)
})
})
.expect("invalid DER");
let msg = test_case.consume_bytes("Msg");
let sig = test_case.consume_bytes("Sig");
let is_valid = test_case.consume_string("Result") == "P";
for &(alg, min_bits) in params {
let width_ok = key_bits >= min_bits;
let actual_result =
signature::UnparsedPublicKey::new(alg, &public_key).verify(&msg, &sig);
assert_eq!(actual_result.is_ok(), is_valid && width_ok);
}
Ok(())
},
);
} | rust_cleaned_test_functions.jsonl/17913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
82522,
33321,
4837,
16,
35638,
368,
341,
262,
1077,
15870,
16,
6745,
284,
609,
9640,
286,
2399,
310,
609,
34140,
486,
73564,
63898,
6412,
16,
62,
16,
15,
17,
19,
62,
23,
16,
24,
17,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_parse_create_keys_v2_response() {
let _setup = SetupMocks::init();
let mut builder = CreateKeyBuilder::create();
let (for_did, for_verkey) = builder.parse_response(&constants::CREATE_KEYS_V2_RESPONSE.to_vec()).unwrap();
assert_eq!(for_did, "MNepeSWtGfhnv8jLB1sFZC");
assert_eq!(for_verkey, "C73MRnns4qUjR5N4LRwTyiXVPKPrA5q4LCT8PZzxVdt9");
} | rust_cleaned_test_functions.jsonl/90060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8657,
12631,
2273,
17,
9655,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
5206,
7363,
284,
4230,
1592,
3297,
486,
3182,
1428,
286,
1077,
320,
1958,
814,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_func_variadic() {
compare_stderr_output(
r#"
package main
func main() {
var x int = 45
var res_v1_1 = v1(1)
println(res_v1_1)
var res_v1_2 = v1(1, x)
println(res_v1_2)
var res_v1_3 = v1(1, 2, x, 4, 5)
println(res_v1_3)
var res_v1_4 = v1()
println(res_v1_4)
var s string = "good day"
var res_v2_1 = v2("hi")
println(res_v2_1)
var res_v2_2 = v2(s)
println(res_v2_2)
var res_v2_3 = v2("hi", "hello", s)
println(res_v2_3)
var res_v2_4 = v2()
println(res_v2_4)
var ss1 []string = []string{"hi"}
var ss2 []string = []string{"bye", "farewell"}
v3([]string{"hi"})
v3(ss2, []string{"hi"})
v3([]string{"hi"}, []string{"hello"}, []string{"good day"}, ss1, ss2)
}
func v1(x ...int) int {
println(x)
return len(x) - 1
}
func v2(x ...string) bool {
println(x)
return len(x) == 0
}
func v3(x ...[]string) {
println(x)
}
"#,
"<int>[1]
0
<int>[1 45]
1
<int>[1 2 45 4 5]
4
<int>[]
-1
<string>[hi]
false
<string>[good day]
false
<string>[hi hello good day]
false
<string>[]
true
<[]string>[<[]string>[hi]]
<[]string>[<[]string>[bye farewell] <[]string>[hi]]
<[]string>[<[]string>[hi] <[]string>[hello] <[]string>[good day] <[]string>[hi] <[]string>[bye farewell]]
",
)
} | rust_cleaned_test_functions.jsonl/83242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 670
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9596,
4612,
72,
36214,
368,
341,
262,
9429,
93033,
7645,
1006,
286,
435,
2,
698,
1722,
1887,
271,
2830,
1887,
368,
341,
262,
762,
856,
526,
284,
220,
19,
20,
198,
262,
762,
592,
2273,
16,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_from_bytes() {
let one = Scalar::one();
let curve_scalar = CurveScalar::from_bytes_mod_order(*one.as_bytes());
assert_eq!(curve_scalar.scalar, one);
assert_eq!(curve_scalar.as_bytes(), one.as_bytes());
} | rust_cleaned_test_functions.jsonl/65701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
5673,
12524,
368,
341,
286,
1077,
825,
284,
35176,
486,
603,
543,
286,
1077,
15655,
41652,
284,
53677,
20639,
486,
1499,
12524,
7480,
7869,
4071,
603,
5357,
12524,
1423,
286,
2060,
10714,
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 |
#[test]
fn test_process_make_credential_cancelled() {
let mut rng = ThreadRng256 {};
let user_presence_always_cancel = |_| Err(Ctap2StatusCode::CTAP2_ERR_KEEPALIVE_CANCEL);
let mut ctap_state = CtapState::new(&mut rng, user_presence_always_cancel);
let make_credential_params = create_minimal_make_credential_parameters();
let make_credential_response =
ctap_state.process_make_credential(make_credential_params, DUMMY_CHANNEL_ID);
assert_eq!(
make_credential_response,
Err(Ctap2StatusCode::CTAP2_ERR_KEEPALIVE_CANCEL)
);
} | rust_cleaned_test_functions.jsonl/35313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
28230,
666,
30320,
28895,
832,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
1196,
56403,
8418,
2284,
28895,
284,
66091,
15495,
3025,
30047,
17,
15872,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_primitive() {
let value = Value { x: 5 };
assert_eq!(value.to_int(), Some(5));
assert_eq!(value.to_i8(), Some(5));
assert_eq!(value.to_i16(), Some(5));
assert_eq!(value.to_i32(), Some(5));
assert_eq!(value.to_i64(), Some(5));
assert_eq!(value.to_uint(), Some(5));
assert_eq!(value.to_u8(), Some(5));
assert_eq!(value.to_u16(), Some(5));
assert_eq!(value.to_u32(), Some(5));
assert_eq!(value.to_u64(), Some(5));
assert_eq!(value.to_f32(), Some(5f32));
assert_eq!(value.to_f64(), Some(5f64));
} | rust_cleaned_test_functions.jsonl/12472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
84087,
368,
341,
286,
1077,
897,
284,
5162,
314,
856,
25,
220,
20,
2605,
286,
2060,
10714,
10297,
957,
2389,
4042,
1507,
220,
4329,
7,
20,
1106,
286,
2060,
10714,
10297,
957,
2389,
5318,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matrix_plus_zero_equals_matrix() {
let zero = Matrix2x2::zero();
let matrix = Matrix2x2::new(
36.84, 427.46,
7.47, 61.89
);
assert_eq!(matrix + zero, matrix);
} | rust_cleaned_test_functions.jsonl/128966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
28043,
19359,
61664,
10193,
368,
341,
286,
1077,
7168,
284,
11631,
17,
87,
17,
486,
14154,
543,
286,
1077,
6172,
284,
11631,
17,
87,
17,
486,
931,
1006,
310,
220,
18,
21,
13,
23,
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_received_frag_cur_messages_timeout() {
let mut fsm = FragStateMachine::new();
let orig_message = b"This is some message to be split";
let frags = split_message(orig_message,
b"nonce123", 22).unwrap();
let b = (frags.len() + 1) / 2;
for i in 0 .. b - 1 {
assert_eq!(fsm.received_frag_message(&frags[i]), None);
for _ in 0 .. MESSAGE_ID_TICKS - 1 {
fsm.time_tick();
}
}
assert_eq!(fsm.received_frag_message(&frags[frags.len() - 1]), None);
} | rust_cleaned_test_functions.jsonl/24553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40783,
80817,
18956,
23428,
20537,
368,
341,
286,
1077,
5206,
83138,
284,
58089,
94666,
486,
931,
1428,
286,
1077,
2713,
6462,
284,
293,
21520,
374,
1045,
1943,
311,
387,
6718,
876,
286,
1077,
972... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_object_decl() {
let source: &str = "const a = b::c::d.e().await;";
let diag: RefCell<DiagContext> = RefCell::new(DiagContext::new());
let mut parser: Parser = Parser::new(
0, source, &diag
);
let kwd_token: Token = parser.consume_token();
let decl: ConcreteObjectDecl = parser.parse_object_decl(kwd_token, &[]).unwrap();
dbg!(decl);
} | rust_cleaned_test_functions.jsonl/56270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5314,
35814,
368,
341,
286,
1077,
2530,
25,
609,
495,
284,
330,
1024,
264,
284,
293,
486,
66,
486,
67,
1734,
1005,
11421,
26,
3302,
286,
1077,
39717,
25,
8550,
3599,
27,
21685,
351,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node() {
assert_eq!(
node("node"),
Ok((
"",
Some(KdlNode {
name: "node".into(),
values: Vec::new(),
properties: HashMap::new(),
children: Vec::new(),
})
))
);
assert_eq!(
node("node\n"),
Ok((
"",
Some(KdlNode {
name: "node".into(),
values: Vec::new(),
properties: HashMap::new(),
children: Vec::new(),
})
))
);
assert_eq!(
node("node;"),
Ok((
"",
Some(KdlNode {
name: "node".into(),
values: Vec::new(),
properties: HashMap::new(),
children: Vec::new(),
})
))
);
assert_eq!(
node("node 1"),
Ok((
"",
Some(KdlNode {
name: "node".into(),
values: vec![KdlValue::Int(1)],
properties: HashMap::new(),
children: Vec::new(),
})
))
);
assert_eq!(
node("node 1 2 \"3\" true false null"),
Ok((
"",
Some(KdlNode {
name: "node".into(),
values: vec![
KdlValue::Int(1),
KdlValue::Int(2),
KdlValue::String("3".into()),
KdlValue::Boolean(true),
KdlValue::Boolean(false),
KdlValue::Null
],
properties: HashMap::new(),
children: Vec::new(),
})
))
);
assert_eq!(
node("node {\n node2\n}"),
Ok((
"",
Some(KdlNode {
name: "node".into(),
values: Vec::new(),
properties: HashMap::new(),
children: vec![KdlNode {
name: "node2".into(),
values: Vec::new(),
properties: HashMap::new(),
children: Vec::new()
}]
})
))
);
assert_eq!(
node("node { node2; }"),
Ok((
"",
Some(KdlNode {
name: "node".into(),
values: Vec::new(),
properties: HashMap::new(),
children: vec![KdlNode {
name: "node2".into(),
values: Vec::new(),
properties: HashMap::new(),
children: Vec::new()
}]
})
))
);
} | rust_cleaned_test_functions.jsonl/118110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
368,
341,
286,
2060,
10714,
33673,
310,
2436,
445,
3509,
4461,
310,
7622,
94702,
394,
8324,
394,
4329,
16738,
8736,
1955,
341,
503,
829,
25,
330,
3509,
3263,
18122,
3148,
503,
2750,
25,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_at_signs_file() {
let td = tempfile::Builder::new()
.prefix("sccache")
.tempdir()
.unwrap();
File::create(td.path().join("foo"))
.unwrap()
.write_all(b"-c foo.c -o foo.o")
.unwrap();
let arg = format!("-@{}", td.path().join("foo").display());
let ParsedArguments {
input,
language,
outputs,
preprocessor_args,
msvc_show_includes,
common_args,
..
} = match parse_arguments_(vec![arg]) {
CompilerArguments::Ok(args) => args,
o => panic!("Got unexpected parse result: {:?}", o),
};
assert_eq!(Some("foo.c"), input.to_str());
assert_eq!(Language::C, language);
assert_map_contains!(outputs, ("obj", PathBuf::from("foo.o")));
assert!(preprocessor_args.is_empty());
assert!(common_args.is_empty());
assert!(!msvc_show_includes);
} | rust_cleaned_test_functions.jsonl/18540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 545
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
11172,
82,
2458,
368,
341,
286,
1077,
17941,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
445,
82,
638,
1777,
1138,
310,
659,
3888,
3741,
741,
310,
659,
15454,
543,
286,
2887,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_construct_twitter_profile_url() {
let fake_profile = "jsjoeio";
assert_eq!(
construct_twitter_profile_url(fake_profile),
"https://twitter.com/jsjoeio"
);
} | rust_cleaned_test_functions.jsonl/125790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
83338,
13789,
2903,
368,
341,
286,
1077,
12418,
13789,
284,
330,
2519,
73,
4644,
815,
876,
286,
2060,
10714,
33673,
310,
9245,
83338,
13789,
2903,
74138,
13789,
1326,
310,
330,
2428,
1110,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ip() -> Result<()> {
test_opt(
DhcpOption::ServerIdentifier("192.168.0.1".parse::<Ipv4Addr>().unwrap()),
vec![54, 4, 192, 168, 0, 1],
)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/41164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10385,
368,
1464,
5714,
71698,
341,
286,
1273,
15032,
1006,
310,
43227,
4672,
5341,
486,
5475,
8714,
445,
16,
24,
17,
13,
16,
21,
23,
13,
15,
13,
16,
3263,
6400,
27638,
80656,
19,
13986,
10483... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_process_store_fail_account0_not_signer() {
solana_logger::setup();
let keys = vec![];
let (config_keypair, config_account) = create_config_account(keys);
let config_pubkey = config_keypair.pubkey();
let my_config = MyConfig::new(42);
let mut instruction = config_instruction::store(&config_pubkey, true, vec![], &my_config);
instruction.accounts[0].is_signer = false; // <----- not a signer
let keyed_accounts = [(false, false, config_pubkey, config_account)];
assert_eq!(
process_instruction(&instruction.data, &keyed_accounts),
Err(InstructionError::MissingRequiredSignature)
);
} | rust_cleaned_test_functions.jsonl/36694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14809,
22121,
13500,
15,
7913,
11172,
261,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
6894,
284,
7486,
0,
15078,
286,
1077,
320,
1676,
3097,
12670,
11,
2193,
13500,
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... | 1 |
#[test]
fn test_schnorr_recover() {
let gen = Generator::new();
let (privkey, pubkey) = gen.random_keypair().unwrap();
let message = Message::default();
let signature = privkey.sign_schnorr(&message).unwrap();
assert_eq!(pubkey, signature.recover_schnorr(&message).unwrap());
} | rust_cleaned_test_functions.jsonl/100079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
2125,
17391,
1288,
3688,
368,
341,
286,
1077,
4081,
284,
28358,
486,
931,
543,
286,
1077,
320,
11887,
792,
11,
95116,
8,
284,
4081,
7829,
3097,
12670,
1005,
15454,
543,
286,
1077,
1943,
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_hover_intra_link_namespaced() {
check(
r#"
pub struct Foo;
fn Foo() {}
/// [Foo()]
pub struct B<|>ar
"#,
expect
"#]],
);
} | rust_cleaned_test_functions.jsonl/66145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
1243,
2172,
7233,
9187,
68552,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9585,
2036,
33428,
280,
8822,
33428,
368,
5613,
2575,
508,
40923,
27766,
9585,
2036,
425,
27,
91,
29,
277,
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,
1... | 1 |
#[test]
fn test_handle_new_root() {
let genesis_config = create_genesis_config(10_000).genesis_config;
let bank0 = Bank::new_for_tests(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank0)));
let root = 3;
let root_bank = Bank::new_from_parent(
bank_forks.read().unwrap().get(0).unwrap(),
&Pubkey::default(),
root,
);
root_bank.freeze();
let root_hash = root_bank.hash();
bank_forks.write().unwrap().insert(root_bank);
let mut heaviest_subtree_fork_choice = HeaviestSubtreeForkChoice::new((root, root_hash));
let mut progress = ProgressMap::default();
for i in 0..=root {
progress.insert(i, ForkProgress::new(Hash::default(), None, None, 0, 0));
}
let mut duplicate_slots_tracker: DuplicateSlotsTracker =
vec![root - 1, root, root + 1].into_iter().collect();
let mut gossip_duplicate_confirmed_slots: GossipDuplicateConfirmedSlots =
vec![root - 1, root, root + 1]
.into_iter()
.map(|s| (s, Hash::default()))
.collect();
let mut unfrozen_gossip_verified_vote_hashes: UnfrozenGossipVerifiedVoteHashes =
UnfrozenGossipVerifiedVoteHashes {
votes_per_slot: vec![root - 1, root, root + 1]
.into_iter()
.map(|s| (s, HashMap::new()))
.collect(),
};
let mut epoch_slots_frozen_slots: EpochSlotsFrozenSlots = vec![root - 1, root, root + 1]
.into_iter()
.map(|slot| (slot, Hash::default()))
.collect();
let (bank_drop_sender, _bank_drop_receiver) = unbounded();
ReplayStage::handle_new_root(
root,
&bank_forks,
&mut progress,
&AbsRequestSender::default(),
None,
&mut heaviest_subtree_fork_choice,
&mut duplicate_slots_tracker,
&mut gossip_duplicate_confirmed_slots,
&mut unfrozen_gossip_verified_vote_hashes,
&mut true,
&mut Vec::new(),
&mut epoch_slots_frozen_slots,
&bank_drop_sender,
);
assert_eq!(bank_forks.read().unwrap().root(), root);
assert_eq!(progress.len(), 1);
assert!(progress.get(&root).is_some());
// root - 1 is filtered out
assert_eq!(
duplicate_slots_tracker.into_iter().collect::<Vec<Slot>>(),
vec![root, root + 1]
);
assert_eq!(
gossip_duplicate_confirmed_slots
.keys()
.cloned()
.collect::<Vec<Slot>>(),
vec![root, root + 1]
);
assert_eq!(
unfrozen_gossip_verified_vote_hashes
.votes_per_slot
.keys()
.cloned()
.collect::<Vec<Slot>>(),
vec![root, root + 1]
);
assert_eq!(
epoch_slots_frozen_slots
.into_iter()
.map(|(slot, _hash)| slot)
.collect::<Vec<Slot>>(),
vec![root, root + 1]
);
} | rust_cleaned_test_functions.jsonl/25802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1754
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
5921,
12993,
368,
341,
286,
1077,
59366,
5332,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,
15,
15,
568,
77894,
5332,
280,
286,
1077,
6073,
15,
284,
8547,
486,
931,
5478,
32509,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ls_oneline() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch(&at.plus_as_string("test-oneline-1"));
at.touch(&at.plus_as_string("test-oneline-2"));
// except on Windows.
for option in &["-1", "--format=single-column"] {
scene
.ucmd()
.arg(option)
.succeeds()
.stdout_only("test-oneline-1\ntest-oneline-2\n");
}
} | rust_cleaned_test_functions.jsonl/71201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53174,
4470,
4834,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
280,
262,
518,
42129,
2099,
266,
60540,
11898,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fold_object_literal_ref1() {
// Leave extra side-effects in place
fold_same("var x = ({a:foo(),b:bar()}).a");
fold_same("var x = ({a:1,b:bar()}).a");
fold_same("function f() { return {b:foo(), a:2}.a; }");
// on the LHS the object act as a temporary leave it in place.
fold_same("({a:x}).a = 1");
fold("({a:x}).a += 1", "({a:x}).a = x + 1");
fold_same("({a:x}).a ++");
fold_same("({a:x}).a --");
// Getters should not be inlined.
fold_same("({get a() {return this}}).a");
fold("({get a() {return 0}}).a", "(function() {return 0})()");
// testFoldObjectLiteralRefCall)
fold(
"({a:function(){return this}}).a",
"(function(){return this})",
);
// know for sure the function doesn't reference 'this'.
fold("({a:function(){return 0}}).a()", "(function(){return 0})()");
// Don't inline setters.
fold_same("({set a(b) {return this}}).a");
fold_same("({set a(b) {this._a = b}}).a");
// Don't inline if there are side-effects.
fold_same("({[foo()]: 1, a: 0}).a");
fold_same("({['x']: foo(), a: 0}).a");
fold_same("({x: foo(), a: 0}).a");
fold_same("({}).a");
// setters by themselves don't provide a definition
fold_same("({}).a");
fold_same("({set a(b) {}}).a");
// sets don't hide other definitions.
fold("({a:1,set a(b) {}}).a", "1");
fold("({get a() {}}).a", "(function (){})()");
// sets don't hide other definitions.
fold("({get a() {},set a(b) {}}).a", "(function (){})()");
// a function remains a function not a call.
fold(
"var x = ({a:function(){return 1}}).a",
"var x = function(){return 1}",
);
fold("var x = ({a:1}).a", "var x = 1");
fold("var x = ({a:1, a:2}).a", "var x = 2");
fold("var x = ({a:1, a:foo()}).a", "var x = foo()");
fold("var x = ({a:foo()}).a", "var x = foo()");
fold(
"function f() { return {a:1, b:2}.a; }",
"function f() { return 1; }",
);
// GETELEM is handled the same way.
fold("var x = ({'a':1})['a']", "var x = 1");
// try folding string computed properties
fold("var a = {['a']:x}['a']", "var a = x");
fold(
"var a = { get ['a']() { return 1; }}['a']",
"var a = function() { return 1; }();",
);
fold("var a = {'a': x, ['a']: y}['a']", "var a = y;");
fold_same("var a = {['foo']: x}.a;");
// Note: it may be useful to fold symbols in the future.
fold_same("var y = Symbol(); var a = {[y]: 3}[y];");
fold("var x = {a() { 1; }}.a;", "var x = function() { 1; };");
fold(
"var x = {a() { return this; }}.a;",
"var x = function() { return this; };",
);
// `super` is invisibly captures the object that declared the method so we can't
// fold.
fold_same("var x = {a() { return super.a; }}.a;");
fold(
"var x = {a: 1, a() { 2; }}.a;",
"var x = function() { 2; };",
);
fold("var x = {a() {}, a: 1}.a;", "var x = 1;");
fold_same("var x = {a() {}}.b");
} | rust_cleaned_test_functions.jsonl/122225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
5314,
34100,
7793,
16,
368,
341,
262,
442,
25193,
4960,
3108,
74788,
304,
1992,
198,
262,
11555,
33574,
445,
947,
856,
284,
9469,
64,
25,
7975,
1507,
65,
25,
2257,
368,
16630,
64,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_adjust_max() {
assert_eq!(100.0, adjust_max(0.0, 100.0));
assert_eq!(100.0, adjust_max(100.0, 5.0));
assert_eq!(100.0, adjust_max(0.0, 100.0));
} | rust_cleaned_test_functions.jsonl/80584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44153,
6345,
368,
341,
286,
2060,
10714,
10297,
16,
15,
15,
13,
15,
11,
7500,
6345,
7,
15,
13,
15,
11,
220,
16,
15,
15,
13,
15,
1106,
286,
2060,
10714,
10297,
16,
15,
15,
13,
15,
11,
750... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chrono_value() {
let timestamp = chrono::NaiveDate::from_ymd(2020, 1, 1).and_hms(2, 2, 2);
let value: Value = timestamp.into();
let out: NaiveDateTime = value.unwrap();
assert_eq!(out, timestamp);
} | rust_cleaned_test_functions.jsonl/12485 | {
"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,
4138,
2248,
78,
3142,
368,
341,
286,
1077,
11441,
284,
80372,
486,
16193,
533,
1916,
486,
1499,
62,
1600,
67,
7,
17,
15,
17,
15,
11,
220,
16,
11,
220,
16,
568,
437,
1523,
1011,
7,
17,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_language_id() {
assert_eq!(
"javascript".parse::<LanguageId>().unwrap(),
LanguageId::JavaScript
);
assert_eq!(
"javascriptreact".parse::<LanguageId>().unwrap(),
LanguageId::Jsx
);
assert_eq!("jsx".parse::<LanguageId>().unwrap(), LanguageId::Jsx);
assert_eq!(
"typescript".parse::<LanguageId>().unwrap(),
LanguageId::TypeScript
);
assert_eq!(
"typescriptreact".parse::<LanguageId>().unwrap(),
LanguageId::Tsx
);
assert_eq!("tsx".parse::<LanguageId>().unwrap(), LanguageId::Tsx);
assert_eq!("json".parse::<LanguageId>().unwrap(), LanguageId::Json);
assert_eq!("jsonc".parse::<LanguageId>().unwrap(), LanguageId::JsonC);
assert_eq!(
"markdown".parse::<LanguageId>().unwrap(),
LanguageId::Markdown
);
assert_eq!("rust".parse::<LanguageId>().unwrap(), LanguageId::Unknown);
} | rust_cleaned_test_functions.jsonl/89758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29021,
842,
368,
341,
262,
2060,
10714,
33673,
414,
330,
14073,
3263,
6400,
27638,
13806,
764,
10483,
15454,
3148,
414,
11434,
764,
486,
29475,
198,
262,
1439,
262,
2060,
10714,
33673,
414,
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... | 1 |
#[test]
fn test_fun_to_string() {
with_globals(|| {
let abba_ident = ast::Ident::from_str("abba");
let decl = ast::FnDecl {
inputs: Vec::new(),
output: ast::FunctionRetTy::Default(syntax_pos::DUMMY_SP),
variadic: false
};
let generics = ast::Generics::default();
assert_eq!(
fun_to_string(
&decl,
ast::FnHeader {
unsafety: ast::Unsafety::Normal,
constness: codemap::dummy_spanned(ast::Constness::NotConst),
asyncness: ast::IsAsync::NotAsync,
abi: Abi::Rust,
},
abba_ident,
&generics
),
"fn abba()"
);
})
} | rust_cleaned_test_functions.jsonl/45443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 570
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28315,
2346,
3904,
368,
341,
286,
448,
58775,
79453,
341,
310,
1077,
668,
4645,
38399,
284,
11763,
486,
28301,
486,
1499,
2895,
445,
370,
4645,
3071,
310,
1077,
3963,
284,
11763,
486,
24911,
21629... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_record_literal_field_default() {
let test_code = r#"
struct S { foo: u32, bar: usize }
impl core::default::Default for S {
fn default() -> Self {
S {
foo: 0,
bar: 0,
}
}
}
fn process(f: S) {
let other = S {
foo: 5,
.<|>
};
}
"#;
check(
test_code,
expect![[r#"
fd bar usize
"#]],
);
check_snippet(
test_code,
expect![[r#"
sn pd
sn ppd
fd ..Default::default()
"#]],
);
} | rust_cleaned_test_functions.jsonl/60475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
34100,
5013,
9993,
368,
341,
286,
1077,
1273,
4136,
284,
435,
2,
698,
1235,
328,
314,
15229,
25,
575,
18,
17,
11,
3619,
25,
22301,
555,
6383,
6200,
486,
2258,
486,
3675,
369,
328,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug_value_range_builder() {
use super::ValueLabelRangesBuilder;
use crate::debug::ModuleMemoryOffset;
use cranelift_codegen::ir::StackSlots;
use wasmtime_environ::{DefinedFuncIndex, EntityRef};
let addr_tr = create_mock_address_transform();
let stack_slots = StackSlots::new();
let (value_ranges, value_labels) = create_mock_value_ranges();
let fi = FunctionFrameInfo {
memory_offset: ModuleMemoryOffset::None,
stack_slots: &stack_slots,
value_ranges: &value_ranges,
};
let builder = ValueLabelRangesBuilder::new(&[(10, 20)], &addr_tr, Some(&fi));
let ranges = builder.into_ranges().collect::<Vec<_>>();
assert_eq!(ranges.len(), 1);
assert_eq!(ranges[0].func_index, DefinedFuncIndex::new(0));
assert_eq!(ranges[0].start, 0);
assert_eq!(ranges[0].end, 30);
let mut builder = ValueLabelRangesBuilder::new(&[(10, 20)], &addr_tr, Some(&fi));
builder.process_label(value_labels.0);
builder.process_label(value_labels.1);
let ranges = builder.into_ranges().collect::<Vec<_>>();
assert_eq!(ranges.len(), 1);
assert_eq!(ranges[0].start, 5);
assert_eq!(ranges[0].end, 25);
// also narrows range.
let mut builder = ValueLabelRangesBuilder::new(&[(11, 17)], &addr_tr, Some(&fi));
builder.process_label(value_labels.0);
builder.process_label(value_labels.1);
builder.process_label(value_labels.2);
let ranges = builder.into_ranges().collect::<Vec<_>>();
assert_eq!(ranges.len(), 2);
assert_eq!(ranges[0].start, 5);
assert_eq!(ranges[0].end, 10);
assert_eq!(ranges[1].start, 20);
assert_eq!(ranges[1].end, 23);
} | rust_cleaned_test_functions.jsonl/7227 | {
"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,
15446,
3142,
9698,
28532,
368,
341,
286,
990,
2256,
486,
1130,
2476,
74902,
3297,
280,
286,
990,
17717,
486,
8349,
486,
3332,
10642,
6446,
280,
286,
990,
1560,
2387,
2085,
32018,
486,
404,
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_checkout_blob_to_tree() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let target = commit! {
foo {
bar < "bar contents"
}
};
bit_checkout!(repo: &rev!(target))?;
assert_eq!(cat!(repo: "foo/bar"), "bar contents");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62971 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68186,
45908,
2346,
11663,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
2169,
284,
5266,
0,
341,
310,
15229,
341,
394,
3619,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_eq() {
let a = DerefGc::new(1);
let b = DerefGc::new(1);
assert_eq!(a, a);
assert_eq!(b, b);
assert_eq!(a, b);
assert_eq!(b, a);
assert!(a.ptr_eq(&a));
assert!(b.ptr_eq(&b));
assert!(!a.ptr_eq(&b));
assert!(!b.ptr_eq(&a));
assert!(a.ptr_eq(&a.clone()));
} | rust_cleaned_test_functions.jsonl/35065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
341,
286,
1077,
264,
284,
422,
43970,
38,
66,
486,
931,
7,
16,
317,
286,
1077,
293,
284,
422,
43970,
38,
66,
486,
931,
7,
16,
317,
286,
2060,
10714,
10297,
64,
11,
264,
317,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_requesting_bin_summary() {
run_with_server(|mut test_env| {
let new_bin = test_env.create_bin().unwrap();
let bin_id = new_bin.id;
let requests = vec![
ServerRequest {
method: Method::Get,
headers: Headers::new(),
path: "/",
body: None,
},
ServerRequest {
method: Method::Get,
headers: Headers::new(),
path: "/hello/world",
body: None,
},
ServerRequest {
method: Method::Post,
headers: Headers::new(),
path: "/boom/chicka/chicka",
body: Some("{ id: 3 }"),
},
];
test_env.parallel_requests(&bin_id, &requests, 2);
let ref storage = test_env.server.storage.lock().unwrap();
let bin_summary: BinSummary = storage.get_bin_summary(&bin_id).unwrap();
assert_eq!(bin_summary.request_count, requests.len() * 2);
})
} | rust_cleaned_test_functions.jsonl/56479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
287,
21816,
27251,
368,
341,
262,
1598,
6615,
12015,
22428,
6984,
1273,
15879,
91,
341,
286,
1077,
501,
21816,
284,
1273,
15879,
2520,
21816,
1005,
15454,
543,
286,
1077,
9544,
842,
284,
501... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_one() {
let one = Complex64::one();
assert!(one.is_one());
let mut c = Complex::new(1.23, 4.56);
assert!(!c.is_one());
assert_eq!(c * one, c);
c.set_one();
assert!(c.is_one());
} | rust_cleaned_test_functions.jsonl/105675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
368,
341,
286,
1077,
825,
284,
22096,
21,
19,
486,
603,
543,
286,
2060,
10297,
603,
2079,
11667,
5231,
286,
1077,
5206,
272,
284,
22096,
486,
931,
7,
16,
13,
17,
18,
11,
220,
19,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dim_compact_single_bare_duplicate_definition() {
// single is the default type
let program = r#"
DIM A!
DIM A
"#;
assert_linter_err!(program, QError::DuplicateDefinition, 3, 17);
} | rust_cleaned_test_functions.jsonl/122459 | {
"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,
10791,
18177,
531,
19487,
880,
546,
70434,
31698,
368,
341,
262,
442,
3175,
374,
279,
1638,
943,
198,
262,
1077,
2025,
284,
435,
2,
698,
310,
50859,
362,
4894,
310,
50859,
362,
198,
310,
5869,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signature_serde() {
use serde_test::{Configure, Token, assert_tokens};
let s = Secp256k1::new();
let msg = Message::from_slice(&[1; 32]).unwrap();
let sk = SecretKey::from_slice(&[2; 32]).unwrap();
let sig = s.sign(&msg, &sk);
static SIG_BYTES: [u8; 71] = [
48, 69, 2, 33, 0, 157, 11, 173, 87, 103, 25, 211, 42, 231, 107, 237,
179, 76, 119, 72, 102, 103, 60, 189, 227, 244, 225, 41, 81, 85, 92, 148,
8, 230, 206, 119, 75, 2, 32, 40, 118, 231, 16, 47, 32, 79, 107, 254,
226, 108, 150, 124, 57, 38, 206, 112, 44, 249, 125, 75, 1, 0, 98, 225,
147, 247, 99, 25, 15, 103, 118
];
static SIG_STR: &'static str = "\
30450221009d0bad576719d32ae76bedb34c774866673cbde3f4e12951555c9408e6ce77\
4b02202876e7102f204f6bfee26c967c3926ce702cf97d4b010062e193f763190f6776\
";
assert_tokens(&sig.compact(), &[Token::BorrowedBytes(&SIG_BYTES[..])]);
assert_tokens(&sig.readable(), &[Token::BorrowedStr(SIG_STR)]);
} | rust_cleaned_test_functions.jsonl/12679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
75861,
450,
368,
341,
286,
990,
61570,
4452,
22964,
28560,
11,
9660,
11,
2060,
28838,
2315,
286,
1077,
274,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
1428,
286,
1077,
3750,
284,
4856... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mention_type() {
assert_eq!(
MentionType::Channel(ChannelId::new(123).expect("non zero")),
MentionType::parse("<#123>").unwrap()
);
assert_eq!(
MentionType::Emoji(EmojiId::new(123).expect("non zero")),
MentionType::parse("<:name:123>").unwrap()
);
assert_eq!(
MentionType::Role(RoleId::new(123).expect("non zero")),
MentionType::parse("<@&123>").unwrap()
);
assert_eq!(
MentionType::User(UserId::new(123).expect("non zero")),
MentionType::parse("<@123>").unwrap()
);
assert_eq!(
&ParseMentionErrorType::Sigil {
expected: &["#", ":", "@&", "@!", "@", "t:"],
found: Some(';'),
},
MentionType::parse("<;123>").unwrap_err().kind(),
);
} | rust_cleaned_test_functions.jsonl/3590 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
26985,
290,
1819,
368,
341,
286,
2060,
10714,
33673,
310,
85148,
929,
486,
9629,
68420,
764,
486,
931,
7,
16,
17,
18,
568,
17119,
445,
6280,
7168,
30154,
310,
85148,
929,
486,
6400,
9639,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_traffic_model() {
let inp = CsvRecord {
id: "1".to_string(),
origin_lat: "-37.820189".to_string(),
origin_lon: "145.149954".to_string(),
destination_lat: "-37.819681".to_string(),
destination_lon: "144.952302".to_string(),
departure_time: "1534284000".to_string(),
mode: "driving".to_string(),
avoidances: Option::None,
traffic_model: Option::None,
};
let res = Query::from_csv_record(inp, &NaiveDateTime::from_timestamp(1536991111, 0));
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/75496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
90012,
5047,
368,
341,
286,
1077,
32344,
284,
91671,
6471,
341,
310,
877,
25,
330,
16,
3263,
983,
3904,
3148,
310,
6238,
26174,
25,
6523,
18,
22,
13,
23,
17,
15,
16,
23,
24,
3263,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_off_empty_right() {
let mut data = rand_data(173);
let mut map = BTreeMap::from_iter(data.clone());
let right = map.split_off(&(data.iter().max().unwrap().0 + 1));
data.sort();
assert!(map.into_iter().eq(data));
assert!(right.into_iter().eq(None));
} | rust_cleaned_test_functions.jsonl/49403 | {
"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,
17052,
13651,
15124,
10539,
368,
341,
262,
1077,
5206,
821,
284,
10382,
1769,
7,
16,
22,
18,
626,
262,
1077,
5206,
2415,
284,
425,
6533,
2227,
486,
1499,
11723,
2592,
15997,
1423,
262,
1077,
129... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_withdraw_ix_no_acc_data_fail() {
let nonce_address = Pubkey::new_unique();
process_nonce_instruction(
system_instruction::withdraw_nonce_account(
&nonce_address,
&Pubkey::new_unique(),
&nonce_address,
1,
),
Err(InstructionError::InvalidAccountData),
);
} | rust_cleaned_test_functions.jsonl/95895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
6615,
7633,
62686,
6536,
17737,
1769,
22121,
368,
341,
286,
1077,
39676,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1882,
48508,
54923,
1006,
310,
1849,
54923,
486,
62446,
48508,
13500... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_static_method() {
let c_str = unsafe { bindings::Test::name() };
let name = unsafe { CStr::from_ptr(c_str).to_string_lossy().into_owned() };
assert_eq!(name, "Test", "Calling a static C++ method works!");
} | rust_cleaned_test_functions.jsonl/27994 | {
"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,
25360,
9032,
368,
341,
262,
1077,
272,
2895,
284,
19860,
314,
35700,
486,
2271,
486,
606,
368,
2605,
262,
1077,
829,
284,
19860,
314,
356,
2580,
486,
1499,
4348,
1337,
2895,
568,
983,
3904,
1119... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unk_token() {
// 1. Should add `unk_token` as first special token
let trainer = UnigramTrainerBuilder::default()
.show_progress(false)
.special_tokens(vec![
AddedToken::from("[SEP]", true),
AddedToken::from("[CLS]", true),
])
.unk_token(Some("[UNK]".into()))
.build()
.unwrap();
let (unigram, _) = trainer
.train(HashMap::from_iter(vec![
("The".into(), 12),
("are".into(), 11),
]))
.unwrap();
let mut pieces = unigram.iter();
assert_eq!(pieces.next(), Some(&("[UNK]".into(), 0.0)));
assert_eq!(pieces.next(), Some(&("[SEP]".into(), 0.0)));
assert_eq!(pieces.next(), Some(&("[CLS]".into(), 0.0)));
// 2. Let it where it is
let trainer = UnigramTrainerBuilder::default()
.show_progress(false)
.special_tokens(vec![
AddedToken::from("[SEP]", true),
AddedToken::from("[CLS]", true),
AddedToken::from("[UNK]", true),
])
.unk_token(Some("[UNK]".into()))
.build()
.unwrap();
let (unigram, _) = trainer
.train(HashMap::from_iter(vec![
("The".into(), 12),
("are".into(), 11),
]))
.unwrap();
let mut pieces = unigram.iter();
assert_eq!(pieces.next(), Some(&("[SEP]".into(), 0.0)));
assert_eq!(pieces.next(), Some(&("[CLS]".into(), 0.0)));
assert_eq!(pieces.next(), Some(&("[UNK]".into(), 0.0)));
// 3. Don't put it there if not needed
let trainer = UnigramTrainerBuilder::default()
.show_progress(false)
.build()
.unwrap();
let (unigram, _) = trainer
.train(HashMap::from_iter(vec![
("The".into(), 12),
("are".into(), 11),
]))
.unwrap();
let mut pieces = unigram.iter();
assert_eq!(pieces.next().unwrap().0, "e".to_string());
} | rust_cleaned_test_functions.jsonl/18987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3122,
6458,
368,
341,
286,
442,
220,
16,
13,
12260,
912,
1565,
3122,
6458,
63,
438,
1156,
3281,
3950,
198,
286,
1077,
28894,
284,
1230,
49127,
1282,
1743,
3297,
486,
2258,
741,
310,
659,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_accounts_len() {
let pubkey = Pubkey::new_rand();
let mut accounts = [Account::default()];
let ix =
storage_instruction::mining_proof(&pubkey, Hash::default(), 0, Signature::default());
assert!(test_instruction(&ix, &mut accounts).is_err());
let mut accounts = [Account::default(), Account::default(), Account::default()];
assert!(test_instruction(&ix, &mut accounts).is_err());
} | rust_cleaned_test_functions.jsonl/127032 | {
"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,
31433,
55665,
6043,
368,
341,
286,
1077,
95116,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
5206,
9618,
284,
508,
7365,
486,
2258,
368,
4821,
286,
1077,
26864,
4035,
310,
5819,
54923,
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_crystal_shard_version() -> io::Result<()> {
let config_name = "shard.yml";
let config_content = "name: starship\nversion: 1.2.3\n".to_string();
let project_dir = create_project_dir()?;
fill_config(&project_dir, config_name, Some(&config_content))?;
expect_output(&project_dir, Some("v1.2.3"), None);
project_dir.close()
} | rust_cleaned_test_functions.jsonl/100110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32331,
13946,
3712,
567,
9438,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
2193,
1269,
284,
330,
927,
567,
33936,
876,
286,
1077,
2193,
7495,
284,
330,
606,
25,
6774,
5270,
1699,
4366,
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_ls_sort_name() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("test-3");
at.touch("test-1");
at.touch("test-2");
let sep = if cfg!(unix) { "\n" } else { " " };
scene
.ucmd()
.arg("--sort=name")
.succeeds()
.stdout_is(["test-1", "test-2", "test-3\n"].join(sep));
// Order of a named sort ignores leading dots.
let scene_dot = TestScenario::new(util_name!());
let at = &scene_dot.fixtures;
at.touch(".a");
at.touch("a");
at.touch(".b");
at.touch("b");
scene_dot
.ucmd()
.arg("--sort=name")
.arg("-A")
.succeeds()
.stdout_is([".a", "a", ".b", "b\n"].join(sep));
} | rust_cleaned_test_functions.jsonl/71204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53174,
18435,
1269,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
401,
262,
518,
42129,
445,
1944,
12,
18,
797,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_automatic_refund_works_for_multiple_payments() {
new_test_ext().execute_with(|| {
const CANCEL_PERIOD: u64 = 600;
assert_ok!(Payment::pay(
Origin::signed(PAYMENT_CREATOR),
PAYMENT_RECIPENT,
CURRENCY_ID,
20,
None
));
assert_ok!(Payment::pay(
Origin::signed(PAYMENT_CREATOR_TWO),
PAYMENT_RECIPENT_TWO,
CURRENCY_ID,
20,
None
));
assert_ok!(Payment::request_refund(
Origin::signed(PAYMENT_CREATOR),
PAYMENT_RECIPENT
));
run_n_blocks(1);
assert_ok!(Payment::request_refund(
Origin::signed(PAYMENT_CREATOR_TWO),
PAYMENT_RECIPENT_TWO
));
assert_eq!(run_n_blocks(CANCEL_PERIOD - 1), 601);
// Odd block 601 was busy so we still haven't processed the first payment
assert_ok!(PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT).ok_or(()));
// Even block 602 has enough room to process both pending payments
assert_eq!(run_n_blocks(1), 602);
assert_eq!(PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT), None);
assert_eq!(
PaymentStore::<Test>::get(PAYMENT_CREATOR_TWO, PAYMENT_RECIPENT_TWO),
None
);
// the scheduled storage should be cleared
let scheduled_tasks_list = ScheduledTasks::<Test>::get();
assert_eq!(scheduled_tasks_list.get(&(PAYMENT_CREATOR, PAYMENT_RECIPENT)), None);
assert_eq!(
scheduled_tasks_list.get(&(PAYMENT_CREATOR_TWO, PAYMENT_RECIPENT_TWO)),
None
);
// test that the refund happened correctly
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_CREATOR), 100);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_CREATOR_TWO), 100);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT_TWO), 0);
});
} | rust_cleaned_test_functions.jsonl/112006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32808,
13487,
7793,
1241,
11498,
82,
5478,
45233,
91257,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
4777,
356,
29999,
43166,
25,
575,
21,
19,
284,
220,
21,
15,
15,
401,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_clone() {
let mut a = TrieMap::new();
a.insert(1, 'a');
a.insert(2, 'b');
a.insert(3, 'c');
assert!(a.clone() == a);
} | rust_cleaned_test_functions.jsonl/7302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
368,
341,
286,
1077,
5206,
264,
284,
62783,
2227,
486,
931,
1428,
286,
264,
7030,
7,
16,
11,
364,
64,
1157,
286,
264,
7030,
7,
17,
11,
364,
65,
1157,
286,
264,
7030,
7,
18,
11,
364,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_example_4() {
let launch = Vector::new(Position::origin(), 17, -4);
let target = Rectangle::new(20, 30, -10, -5);
let arc = hit_arc(&launch, &target);
assert_eq!(false, arc.is_some());
} | rust_cleaned_test_functions.jsonl/124104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
62,
19,
368,
341,
286,
1077,
7050,
284,
4196,
486,
931,
61843,
486,
8611,
1507,
220,
16,
22,
11,
481,
19,
626,
286,
1077,
2169,
284,
19280,
486,
931,
7,
17,
15,
11,
220,
18,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_snapshot1_create_dir() {
assert_wasi_output!(
"../../wasitests/snapshot1/create_dir.wasm",
"snapshot1_create_dir",
vec![std::path::PathBuf::from("."),],
vec![],
vec![],
"../../wasitests/create_dir.out"
);
} | rust_cleaned_test_functions.jsonl/66529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53265,
16,
8657,
4334,
368,
341,
262,
2060,
1670,
10215,
7645,
33673,
286,
10208,
16123,
275,
17966,
2687,
9601,
16,
25577,
4334,
1418,
10530,
756,
286,
330,
35501,
16,
8657,
4334,
756,
286,
7486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_panic_packet_length() {
// Test that a packet whose payload is longer than 2^16 - 1 bytes is
// rejected.
let _: Buf<&mut [u8]> = Buf::new(&mut [0; 1 << 16][..], ..)
.encapsulate(new_builder())
.serialize_vec_outer()
.unwrap()
.unwrap_a();
} | rust_cleaned_test_functions.jsonl/85894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
620,
31270,
21078,
5118,
368,
341,
286,
442,
3393,
429,
264,
10151,
6693,
7729,
374,
5021,
1091,
220,
17,
61,
16,
21,
481,
220,
16,
5820,
374,
198,
286,
442,
17551,
624,
286,
1077,
5853... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lifetimes() {
// Explicit 'static OCTET_STRING
let result = crate::parse(b"\x04\x01\x00", |p| p.read_element::<&'static [u8]>()).unwrap();
assert_eq!(result, b"\x00");
// Explicit 'static SEQUENCE containing an explicit 'static OCTET_STRING
let result = crate::parse(b"\x30\x03\x04\x01\x00", |p| {
p.read_element::<Sequence<'static>>()?
.parse(|p| p.read_element::<&'static [u8]>())
})
.unwrap();
assert_eq!(result, b"\x00");
// Automatic 'static OCTET_STRING
let result = crate::parse(b"\x04\x01\x00", |p| p.read_element::<&[u8]>()).unwrap();
assert_eq!(result, b"\x00");
// Automatic 'static SEQUENCE containing an automatic 'static
// OCTET_STRING
let result = crate::parse(b"\x30\x03\x04\x01\x00", |p| {
p.read_element::<Sequence>()?
.parse(|p| p.read_element::<&[u8]>())
})
.unwrap();
assert_eq!(result, b"\x00");
// BIT_STRING
let result = crate::parse::<_, ParseError, _>(b"\x03\x02\x00\x00", |p| {
Ok(p.read_element::<BitString>()?.as_bytes())
})
.unwrap();
assert_eq!(result, b"\x00");
} | rust_cleaned_test_functions.jsonl/40816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 668
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
333,
6889,
368,
341,
286,
442,
31330,
364,
1978,
66177,
1348,
12283,
198,
286,
1077,
1102,
284,
17717,
486,
6400,
1883,
11934,
87,
15,
19,
3462,
15,
16,
3462,
15,
15,
497,
760,
79,
91,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_nv_index_attributes_builder_missing_write_attribute_failure() {
// Test missing write error
// Building with only PP read set this should result in an error
single_attribute_error!(with_pp_read);
// Building with only owner read set this should result in an error
single_attribute_error!(with_owner_read);
// Building with only auth read set this should result in an error
single_attribute_error!(with_auth_read);
// Building with only policy read set this should result in an error
single_attribute_error!(with_policy_read);
// Building with all of them set still results in an error
assert_eq!(
Err(Error::WrapperError(WrapperErrorKind::ParamsMissing)),
NvIndexAttributesBuilder::new()
.with_pp_read(true)
.with_owner_read(true)
.with_auth_read(true)
.with_policy_read(true)
.build()
);
} | rust_cleaned_test_functions.jsonl/57725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79430,
3560,
18240,
28532,
40447,
9165,
16791,
43618,
368,
341,
286,
442,
3393,
7402,
3270,
1465,
271,
286,
442,
16858,
448,
1172,
29850,
1349,
738,
419,
1265,
1102,
304,
458,
1465,
198,
286,
3175... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector_2() {
let secp = Secp256k1::new();
let seed = from_hex("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542").unwrap();
// m
test_path(&secp, &seed, &[],
"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U",
"xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB");
// m/0
test_path(&secp, &seed, &[ChildNumber::from_normal_idx(0)],
"xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKYnjwih2yJD9mkrocEZXo1ex8G81dwSM1fwqWpWkeS3v86pgKt",
"xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH");
// m/0/2147483647h
test_path(&secp, &seed, &[ChildNumber::from_normal_idx(0), ChildNumber::from_hardened_idx(2147483647)],
"xprv9wSp6B7kry3Vj9m1zSnLvN3xH8RdsPP1Mh7fAaR7aRLcQMKTR2vidYEeEg2mUCTAwCd6vnxVrcjfy2kRgVsFawNzmjuHc2YmYRmagcEPdU9",
"xpub6ASAVgeehLbnwdqV6UKMHVzgqAG8Gr6riv3Fxxpj8ksbH9ebxaEyBLZ85ySDhKiLDBrQSARLq1uNRts8RuJiHjaDMBU4Zn9h8LZNnBC5y4a");
// m/0/2147483647h/1
test_path(&secp, &seed, &[ChildNumber::from_normal_idx(0), ChildNumber::from_hardened_idx(2147483647), ChildNumber::from_normal_idx(1)],
"xprv9zFnWC6h2cLgpmSA46vutJzBcfJ8yaJGg8cX1e5StJh45BBciYTRXSd25UEPVuesF9yog62tGAQtHjXajPPdbRCHuWS6T8XA2ECKADdw4Ef",
"xpub6DF8uhdarytz3FWdA8TvFSvvAh8dP3283MY7p2V4SeE2wyWmG5mg5EwVvmdMVCQcoNJxGoWaU9DCWh89LojfZ537wTfunKau47EL2dhHKon");
// m/0/2147483647h/1/2147483646h
test_path(&secp, &seed, &[ChildNumber::from_normal_idx(0), ChildNumber::from_hardened_idx(2147483647), ChildNumber::from_normal_idx(1), ChildNumber::from_hardened_idx(2147483646)],
"xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc",
"xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL");
// m/0/2147483647h/1/2147483646h/2
test_path(&secp, &seed, &[ChildNumber::from_normal_idx(0), ChildNumber::from_hardened_idx(2147483647), ChildNumber::from_normal_idx(1), ChildNumber::from_hardened_idx(2147483646), ChildNumber::from_normal_idx(2)],
"xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j",
"xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt");
} | rust_cleaned_test_functions.jsonl/85727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1760
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
17,
368,
341,
197,
10217,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
543,
197,
10217,
10320,
284,
504,
32655,
445,
542,
8316,
69,
24,
69,
21,
69,
18,
69,
15,
15326,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deposit_pausability() {
let (master_account, contract) = init(CUSTODIAN_ADDRESS);
let user_account = create_user_account(&master_account);
// 1st deposit call - should succeed
let promises = call_deposit_with_proof(&user_account, CONTRACT_ACC, PROOF_DATA_NEAR);
for p in promises.iter() {
assert!(p.is_some());
let p = p.as_ref().unwrap();
p.assert_success()
}
// Pause deposit
let res = call_set_paused_flags(&contract, CONTRACT_ACC, PAUSE_DEPOSIT);
res.assert_success();
// 2nd deposit call - should fail
// NB: We can use `PROOF_DATA_ETH` this will be just a different proof but the same deposit
// method which should be paused
let promises = call_deposit_with_proof(&user_account, CONTRACT_ACC, PROOF_DATA_ETH);
let num_promises = promises.len();
let p = promises[num_promises - 2].clone();
assert_execution_status_failure(
p.unwrap().outcome().clone().status,
ERR_PAUSED,
"Expected failure due to pause, but deposit succeeded",
);
// Unpause all
let res = call_set_paused_flags(&contract, CONTRACT_ACC, UNPAUSE_ALL);
res.assert_success();
// 3rd deposit call - should succeed
let promises = call_deposit_with_proof(&user_account, CONTRACT_ACC, PROOF_DATA_ETH);
for p in promises.iter() {
assert!(p.is_some());
let p = p.as_ref().unwrap();
p.assert_success()
}
} | rust_cleaned_test_functions.jsonl/112878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85798,
620,
11855,
2897,
368,
341,
262,
1077,
320,
13629,
13500,
11,
5116,
8,
284,
2930,
3025,
8553,
2069,
22002,
20135,
317,
262,
1077,
1196,
13500,
284,
1855,
3317,
13500,
2099,
13629,
13500,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_rigid_decomposition() {
let translation = Vector3D::new(12.1, 17.8, -5.5);
let rotation = Rotation3D::unit_quaternion(0.5, -7.8, 2.2, 4.3);
let rigid = RigidTransform3D::new(rotation, translation);
let (t2, r2) = rigid.decompose_reversed();
assert!(rigid
.to_transform()
.approx_eq(&t2.to_transform().then(&r2.to_transform())));
} | rust_cleaned_test_functions.jsonl/43229 | {
"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,
1710,
20926,
2259,
76807,
368,
341,
286,
1077,
14468,
284,
4196,
18,
35,
486,
931,
7,
16,
17,
13,
16,
11,
220,
16,
22,
13,
23,
11,
481,
20,
13,
20,
317,
286,
1077,
12695,
284,
47528,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitwise_lmd_ghost() {
// set up logging
test_yaml_vectors(
ForkChoiceAlgorithm::BitwiseLMDGhost,
"tests/bitwise_lmd_ghost_test_vectors.yaml",
100,
);
} | rust_cleaned_test_functions.jsonl/13881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
4482,
907,
2277,
98784,
368,
341,
262,
442,
738,
705,
8392,
87079,
262,
1273,
64380,
49158,
1006,
286,
47850,
24728,
27847,
486,
8344,
4482,
43,
6076,
64686,
345,
286,
330,
23841,
86644,
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 |
#[test]
fn test_print0() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.assert_output(
&["--print0", "foo"],
"a.fooNULL
one/b.fooNULL
one/two/C.Foo2NULL
one/two/c.fooNULL
one/two/three/d.fooNULL
one/two/three/directory_fooNULL",
);
} | rust_cleaned_test_functions.jsonl/10873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
15,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
1013,
3713,
7645,
1006,
286,
609,
1183,
313,
1350,
15,
497,
330,
7975,
8097,
286,
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_sth() {
disasm!("entrypoint:\n sth [r1+0x2], 3\n");
disasm!("entrypoint:\n sth [r1-0x2], 3\n");
} | rust_cleaned_test_functions.jsonl/68760 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
71,
368,
341,
262,
827,
10530,
17223,
4085,
2768,
7190,
77,
262,
357,
71,
508,
81,
16,
10,
15,
87,
17,
1125,
220,
18,
1699,
797,
262,
827,
10530,
17223,
4085,
2768,
7190,
77,
262,
357,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_list_notifications() {
block_on(async {
let (client, mut session) = test_helpers::authenticated_client("notificationsuserid").await;
client
.rpc(&mut session, "echo", Some("Hello World!"))
.await
.expect("Failed to call echo rpc");
client
.rpc(&mut session, "echo", Some("Hello World Two!"))
.await
.expect("Failed to call echo rpc");
let result = client
.list_notifications(&mut session, Some(1), None)
.await
.expect("Failed to list notifications");
let result = client
.list_notifications(&mut session, Some(1), Some(&result.cacheable_cursor))
.await;
assert_eq!(result.is_ok(), true);
println!("{:?}", result);
});
} | rust_cleaned_test_functions.jsonl/50265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
67546,
368,
341,
262,
2504,
4470,
18285,
341,
286,
1077,
320,
2972,
11,
5206,
3797,
8,
284,
1273,
54473,
486,
57707,
8179,
445,
38188,
20085,
1827,
11421,
280,
286,
2943,
198,
310,
659,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reaction() {
let emoji = emoji();
let route = Route::CreateReaction {
channel_id: CHANNEL_ID,
emoji: &emoji,
message_id: MESSAGE_ID,
};
assert_eq!(
route.to_string(),
format!(
"channels/{channel_id}/messages/{message_id}/reactions/{emoji}/@me",
channel_id = CHANNEL_ID,
emoji = emoji,
message_id = MESSAGE_ID
)
);
} | rust_cleaned_test_functions.jsonl/119865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
96631,
368,
341,
286,
1077,
42365,
284,
42365,
1428,
286,
1077,
6021,
284,
9572,
486,
4021,
87236,
341,
310,
5496,
842,
25,
58756,
3450,
345,
310,
42365,
25,
609,
37523,
345,
310,
1943,
84... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stateless_seperation() {
let params: NoiseParams = "Noise_NN_25519_AESGCM_SHA256".parse().unwrap();
let mut h_i = Builder::new(params.clone()).build_initiator().unwrap();
let mut h_r = Builder::new(params).build_responder().unwrap();
let mut buffer_msg = [0u8; 200];
let mut buffer_out = [0u8; 200];
let len = h_i.write_message(b"abc", &mut buffer_msg).unwrap();
h_r.read_message(&buffer_msg[..len], &mut buffer_out).unwrap();
let len = h_r.write_message(b"defg", &mut buffer_msg).unwrap();
h_i.read_message(&buffer_msg[..len], &mut buffer_out).unwrap();
let h_i = h_i.into_transport_mode().unwrap();
let h_r = h_r.into_transport_mode().unwrap();
match h_i.write_message_with_nonce(1, b"hack the planet", &mut buffer_msg) {
Err(SnowError::State {reason: StateProblem::StatelessTransportMode}) => {},
_ => panic!("incorrect failure pattern.")
}
match h_r.read_message_with_nonce(1, &buffer_msg[..len], &mut buffer_out) {
Err(SnowError::State {reason: StateProblem::StatelessTransportMode}) => {},
_ => panic!("incorrect failure pattern.")
}
} | rust_cleaned_test_functions.jsonl/27120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
1717,
3453,
91774,
368,
341,
262,
1077,
3628,
25,
50523,
4870,
284,
330,
61819,
1604,
45,
62,
17,
20,
20,
16,
24,
69381,
38,
9985,
38096,
17,
20,
21,
3263,
6400,
1005,
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... | 3 |
#[test]
fn test_bytes_to_int() {
assert_eq!(bytes_to_int(&[0x7F]), 127);
assert_eq!(bytes_to_int(&[0xFE]), -2);
assert_eq!(bytes_to_int(&[0x00, 0x05]), 5);
} | rust_cleaned_test_functions.jsonl/32841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
2346,
4042,
368,
341,
286,
2060,
10714,
10297,
9651,
2346,
4042,
2099,
58,
15,
87,
22,
37,
9719,
220,
16,
17,
22,
317,
286,
2060,
10714,
10297,
9651,
2346,
4042,
2099,
58,
15,
41381,
97... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_usage_description_wrapping() {
// indentation should be 24 spaces
// lines wrap after 78: or rather descriptions wrap after 54
let mut opts = Options::new();
opts.optflag(
"k",
"kiwi",
"This is a long description which won't be wrapped..+..",
);
opts.optflag(
"a",
"apple",
"This is a long description which _will_ be wrapped..+..",
);
opts.optflag(
"b",
"banana",
"HereWeNeedOneSingleWordThatIsLongerThanTheWrappingLengthAndThisIsIt",
);
let expected = "Usage: fruits
Options:
-k, --kiwi This is a long description which won't be wrapped..+..
-a, --apple This is a long description which _will_ be
wrapped..+..
-b, --banana HereWeNeedOneSingleWordThatIsLongerThanTheWrappingLengthAndThisIsIt
";
let usage = opts.usage("Usage: fruits");
debug!("expected: <<{}>>", expected);
debug!("generated: <<{}>>", usage);
assert!(usage == expected)
} | rust_cleaned_test_functions.jsonl/52391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31507,
11448,
44074,
3629,
368,
341,
262,
442,
69592,
1265,
387,
220,
17,
19,
12621,
198,
262,
442,
5128,
15061,
1283,
220,
22,
23,
25,
476,
4751,
27787,
15061,
1283,
220,
20,
19,
271,
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_hints_has_only_highest_inbound_capacity_channel() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let _chan_1_0_low_inbound_capacity = create_unannounced_chan_between_nodes_with_value(&nodes, 1, 0, 100_000, 0, InitFeatures::known(), InitFeatures::known());
let chan_1_0_high_inbound_capacity = create_unannounced_chan_between_nodes_with_value(&nodes, 1, 0, 10_000_000, 0, InitFeatures::known(), InitFeatures::known());
let _chan_1_0_medium_inbound_capacity = create_unannounced_chan_between_nodes_with_value(&nodes, 1, 0, 1_000_000, 0, InitFeatures::known(), InitFeatures::known());
let mut scid_aliases = HashSet::new();
scid_aliases.insert(chan_1_0_high_inbound_capacity.0.short_channel_id_alias.unwrap());
match_invoice_routes(Some(5000), &nodes[0], scid_aliases);
} | rust_cleaned_test_functions.jsonl/65872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
21042,
21778,
18410,
1523,
7504,
1243,
10891,
35603,
14571,
368,
341,
197,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
197,
10217,
2436,
18343,
82,
284,
185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_private_dict() {
// no non-default values to be stored.
let dict = ReadScope::new(&[]).read::<PrivateDict>();
assert!(dict.is_ok());
} | rust_cleaned_test_functions.jsonl/85334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
15124,
26249,
5243,
368,
341,
1789,
286,
442,
902,
2477,
13672,
2750,
311,
387,
9768,
624,
286,
1077,
6451,
284,
4457,
10803,
486,
931,
2099,
1294,
568,
878,
27638,
16787,
13448,
3913,
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 |
#[test]
fn test_find_duplicate() {
let a1 = &[1, 2, 3, 1];
assert_eq!(find_duplicate(a1), Some((0, 3)));
let a2 = &[1, 2, 2, 1];
assert_eq!(find_duplicate(a2), Some((0, 3)));
let a3 = &[1, 1, 1, 1];
assert_eq!(find_duplicate(a3), Some((0, 1)));
let a4 = &[1, 2, 3, 4];
assert_eq!(find_duplicate(a4), None);
} | rust_cleaned_test_functions.jsonl/10952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
70434,
368,
341,
286,
1077,
264,
16,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
16,
935,
286,
2060,
10714,
10297,
3903,
70434,
2877,
16,
701,
4329,
1188,
15,
11,
220,
18,
2252... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tailn() {
let mut a = vec![11i, 12, 13];
assert_eq!(a.tailn(0), &[11, 12, 13]);
a = vec![11i, 12, 13];
assert_eq!(a.tailn(2), &[13]);
} | rust_cleaned_test_functions.jsonl/33128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35471,
77,
368,
341,
286,
1077,
5206,
264,
284,
7486,
20703,
16,
16,
72,
11,
220,
16,
17,
11,
220,
16,
18,
935,
286,
2060,
10714,
10297,
64,
38711,
77,
7,
15,
701,
44590,
16,
16,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dat_unicode_japanese() {
let strs: Vec<&str> = vec!["アルゴリズム", "データ", "構造"];
let da = DoubleArrayTrieBuilder::new().build(&strs);
let input1 = "データ構造とアルゴリズム";
let result1: Vec<&str> = da
.common_prefix_iter(input1)
.map(|(end_idx, _)| &input1[..end_idx])
.collect();
assert_eq!(result1, vec!["データ"]);
} | rust_cleaned_test_functions.jsonl/6383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15353,
54662,
5374,
28689,
368,
341,
286,
1077,
57584,
25,
11312,
52244,
495,
29,
284,
7486,
0,
1183,
125760,
125619,
36723,
77425,
89962,
497,
330,
131552,
497,
330,
101831,
66078,
6332,
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_iterator_skip_nth() {
let xs = [0, 1, 2, 3, 5, 13, 15, 16, 17, 19, 20, 30];
let mut it = xs.iter().skip(0);
assert_eq!(it.nth(0), Some(&0));
assert_eq!(it.nth(1), Some(&2));
let mut it = xs.iter().skip(5);
assert_eq!(it.nth(0), Some(&13));
assert_eq!(it.nth(1), Some(&16));
let mut it = xs.iter().skip(12);
assert_eq!(it.nth(0), None);
} | rust_cleaned_test_functions.jsonl/25909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
44830,
78342,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
20,
11,
220,
16,
18,
11,
220,
16,
20,
11,
220,
16,
21,
11,
220,
16,
22,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subexpression() {
let mut hbs = Handlebars::new();
hbs.register_helper("gt", Box::new(GtHelper));
hbs.register_helper("not", Box::new(NotHelper));
let data = json!({"a": 1, "b": 0, "c": 2});
assert_eq!(
hbs.render_template("{{#if (gt a b)}}Success{{else}}Failed{{/if}}", &data)
.unwrap(),
"Success"
);
assert_eq!(
hbs.render_template("{{#if (gt a c)}}Success{{else}}Failed{{/if}}", &data)
.unwrap(),
"Failed"
);
assert_eq!(
hbs.render_template("{{#if (not (gt a c))}}Success{{else}}Failed{{/if}}", &data)
.unwrap(),
"Success"
);
assert_eq!(
hbs.render_template("{{#if (not (gt a b))}}Success{{else}}Failed{{/if}}", &data)
.unwrap(),
"Failed"
);
// no argument provided for not
assert_eq!(
hbs.render_template("{{#if (not)}}Success{{else}}Failed{{/if}}", &data)
.unwrap(),
"Failed"
);
// json literal
assert_eq!(
hbs.render_template("{{#if (not true)}}Success{{else}}Failed{{/if}}", &data)
.unwrap(),
"Failed"
);
assert_eq!(
hbs.render_template("{{#if (not false)}}Success{{else}}Failed{{/if}}", &data)
.unwrap(),
"Success"
);
} | rust_cleaned_test_functions.jsonl/47010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 676
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
28099,
368,
341,
262,
1077,
5206,
305,
1279,
284,
13760,
24950,
486,
931,
1428,
262,
305,
1279,
9929,
10418,
445,
5178,
497,
8261,
486,
931,
6699,
83,
5511,
1106,
262,
305,
1279,
9929,
104... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_current_user_retrieval() {
let cache = InMemoryCache::new();
assert!(cache.current_user().is_none());
cache.cache_current_user(current_user(1));
assert!(cache.current_user().is_some());
} | rust_cleaned_test_functions.jsonl/86437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11080,
3317,
1288,
8927,
831,
368,
341,
286,
1077,
6500,
284,
758,
10642,
8233,
486,
931,
543,
286,
2060,
10297,
9360,
4952,
3317,
1005,
285,
31488,
1423,
286,
6500,
20087,
11080,
3317,
8762,
3317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.