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_parse_integer_with_whitespace() {
let arena = Arena::new();
assert_syntaxes(
&parse(&arena, " 123 ", &lang()),
&[Syntax::new_atom(
&arena,
vec![SingleLineSpan {
line: 0.into(),
start_col: 1,
end_col: 4,
}],
"123",
AtomKind::Other,
)],
);
} | rust_cleaned_test_functions.jsonl/52647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31725,
6615,
86175,
368,
341,
286,
1077,
24902,
284,
27047,
486,
931,
1428,
286,
2060,
78894,
288,
1006,
310,
609,
6400,
2099,
30527,
11,
330,
220,
16,
17,
18,
3670,
609,
5205,
14702,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prepare_column_names() -> Result<()> {
let db = checked_memory_handle();
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
let mut stmt = db.prepare("SELECT * FROM foo")?;
stmt.execute([])?;
assert_eq!(stmt.column_count(), 1);
assert_eq!(stmt.column_names(), vec!["x"]);
let mut stmt = db.prepare("SELECT x AS a, x AS b FROM foo")?;
stmt.execute([])?;
assert_eq!(stmt.column_count(), 2);
assert_eq!(stmt.column_names(), vec!["a", "b"]);
Ok(())
} | rust_cleaned_test_functions.jsonl/113051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47460,
8744,
9187,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
2927,
7769,
14534,
445,
22599,
14363,
15229,
2075,
30381,
1215,
899,
69493,
286,
1077,
5206,
2002... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_button_ui_1() {
struct Mock;
let expected = String::from("<div class=\"__azul-native-button\" tabindex=\"0\">\r\n <p>Hello</p>\r\n</div>\r\n");
let button: Dom<Mock> = Button::with_label("Hello").dom();
assert_eq!(expected, button.debug_dump());
} | rust_cleaned_test_functions.jsonl/15945 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8487,
22412,
62,
16,
368,
341,
262,
2036,
14563,
401,
262,
1077,
3601,
284,
923,
486,
1499,
9639,
611,
536,
4070,
563,
1370,
360,
15598,
12444,
2105,
30173,
4070,
15,
38858,
81,
1699,
262,
366,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_completion_works_in_consts() {
assert_debug_snapshot!(
do_ref_completion(
r"
struct A { the_field: u32 }
const X: u32 = {
A { the_field: 92 }.<|>
};
",
),
@r###"
[
CompletionItem {
label: "the_field",
source_range: [106; 106),
delete: [106; 106),
insert: "the_field",
kind: Field,
detail: "u32",
},
]
"###
);
} | rust_cleaned_test_functions.jsonl/57603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60164,
11498,
82,
1243,
48530,
368,
341,
286,
2060,
15446,
53265,
33673,
286,
653,
7793,
60164,
1006,
310,
435,
698,
310,
2036,
362,
314,
279,
5013,
25,
575,
18,
17,
456,
310,
733,
1599,
25,
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_type_expression() {
let want = TypeExpression {
base: BaseNode::default(),
constraints: vec![TypeConstraint {
base: BaseNode::default(),
tvar: Identifier {
base: BaseNode::default(),
name: "T".to_string(),
},
kinds: vec![
Identifier {
base: BaseNode::default(),
name: "Addable".to_string(),
},
Identifier {
base: BaseNode::default(),
name: "Divisible".to_string(),
},
],
}],
monotype: MonoType::Function(Box::new(FunctionType {
base: BaseNode::default(),
parameters: vec![
ParameterType::Required {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "a".to_string(),
},
monotype: MonoType::Tvar(TvarType {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "T".to_string(),
},
}),
},
ParameterType::Required {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "b".to_string(),
},
monotype: MonoType::Tvar(TvarType {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "T".to_string(),
},
}),
},
],
monotype: MonoType::Tvar(TvarType {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "T".to_string(),
},
}),
})),
};
let mut builder = flatbuffers::FlatBufferBuilder::new();
assert_eq!(
want,
flatbuffers::get_root::<fb::TypeExpression>(serialize(
&mut builder,
want.clone(),
build_type_expression,
))
.into()
);
} | rust_cleaned_test_functions.jsonl/112514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1830
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
28068,
368,
341,
286,
1077,
1366,
284,
3990,
9595,
341,
310,
2331,
25,
5351,
1955,
486,
2258,
3148,
310,
16982,
25,
7486,
20703,
929,
17890,
341,
394,
2331,
25,
5351,
1955,
486,
2258,
3148... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_that_second_build_artifacts_removed() {
let path = Path::new("tests/test_sources/compilation/basic_no_deps_test_mode");
let dir = tempdir().unwrap().path().to_path_buf();
BuildConfig {
dev_mode: true,
test_mode: true,
install_dir: Some(dir.clone()),
..Default::default()
}
.compile_package(path, &mut Vec::new())
.unwrap();
let expected_stdlib_path = dir
.join(CompiledPackageLayout::Root.path())
.join("test")
.join(CompiledPackageLayout::CompiledModules.path())
.join(CompiledPackageLayout::Dependencies.path())
.join("MoveStdlib");
assert!(expected_stdlib_path.is_dir());
assert!(dir
.join(CompiledPackageLayout::Root.path())
.join("test")
.join(CompiledPackageLayout::CompiledModules.path())
.join("MTest.mv")
.exists());
BuildConfig {
dev_mode: true,
test_mode: false,
install_dir: Some(dir.clone()),
..Default::default()
}
.compile_package(path, &mut Vec::new())
.unwrap();
assert!(expected_stdlib_path.is_dir());
assert!(!dir
.join(CompiledPackageLayout::Root.path())
.join("test")
.join(CompiledPackageLayout::CompiledModules.path())
.join("MTest.mv")
.exists());
BuildConfig {
dev_mode: false,
test_mode: false,
install_dir: Some(dir.clone()),
..Default::default()
}
.compile_package(path, &mut Vec::new())
.unwrap();
assert!(!expected_stdlib_path.is_dir());
assert!(!dir
.join(CompiledPackageLayout::Root.path())
.join("test")
.join(CompiledPackageLayout::CompiledModules.path())
.join("MTest.mv")
.exists());
} | rust_cleaned_test_functions.jsonl/127136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 833
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70197,
29644,
20801,
36932,
26401,
68248,
368,
341,
262,
1077,
1815,
284,
7933,
486,
931,
445,
23841,
12697,
52896,
14,
5689,
13455,
77909,
6536,
76489,
4452,
7302,
797,
262,
1077,
5419,
284,
2730,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_large_immediate() {
disasm!("entrypoint:\n add64 r1, -1\n");
disasm!("entrypoint:\n add64 r1, -1\n");
} | rust_cleaned_test_functions.jsonl/68771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
17895,
14636,
368,
341,
262,
827,
10530,
17223,
4085,
2768,
7190,
77,
262,
912,
21,
19,
435,
16,
11,
481,
16,
1699,
797,
262,
827,
10530,
17223,
4085,
2768,
7190,
77,
262,
912,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_integer_from_float() {
assert_de_tokens_error::<isize>(
&[Token::F32(0.0)],
"invalid type: floating point `0`, expected isize",
);
} | rust_cleaned_test_functions.jsonl/129546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31725,
5673,
17586,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
285,
551,
17055,
286,
44590,
3323,
486,
37,
18,
17,
7,
15,
13,
15,
30749,
286,
330,
11808,
943,
25,
19057,
1459,
1565,
15,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ttt_negamax_always_draws() {
use minimax::strategies::negamax::{Negamax, Options};
let mut s1 = Negamax::<ttt::Evaluator>::new(Options { max_depth: 10 });
let mut s2 = Negamax::<ttt::Evaluator>::new(Options { max_depth: 10 });
for _ in 0..100 {
assert!(battle_royale(&mut s1, &mut s2) == minimax::Winner::Draw)
}
} | rust_cleaned_test_functions.jsonl/8378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
5566,
28209,
89627,
8418,
2284,
23021,
82,
368,
341,
262,
990,
21187,
706,
486,
495,
69388,
486,
28775,
89627,
22964,
47800,
89627,
11,
14566,
2440,
262,
1077,
5206,
274,
16,
284,
23995,
8962... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_notify_account_at_accounts_update() {
let mut accounts = AccountsDb::new_single_for_tests_with_caching();
let notifier = GeyserTestPlugin::default();
let notifier = Arc::new(RwLock::new(notifier));
accounts.set_geyser_plugin_notifer(Some(notifier.clone()));
// Account with key1 is updated twice in two different slots -- should only get notified twice.
let key1 = solana_sdk::pubkey::new_rand();
let account1_lamports1: u64 = 1;
let account1 =
AccountSharedData::new(account1_lamports1, 1, AccountSharedData::default().owner());
let slot0 = 0;
accounts.store_cached((slot0, &[(&key1, &account1)][..]), None);
let key2 = solana_sdk::pubkey::new_rand();
let account2_lamports: u64 = 200;
let account2 =
AccountSharedData::new(account2_lamports, 1, AccountSharedData::default().owner());
accounts.store_cached((slot0, &[(&key2, &account2)][..]), None);
let account1_lamports2 = 2;
let slot1 = 1;
let account1 = AccountSharedData::new(account1_lamports2, 1, account1.owner());
accounts.store_cached((slot1, &[(&key1, &account1)][..]), None);
let key3 = solana_sdk::pubkey::new_rand();
let account3_lamports: u64 = 300;
let account3 =
AccountSharedData::new(account3_lamports, 1, AccountSharedData::default().owner());
accounts.store_cached((slot1, &[(&key3, &account3)][..]), None);
let notifier = notifier.write().unwrap();
assert_eq!(notifier.accounts_notified.get(&key1).unwrap().len(), 2);
assert_eq!(
notifier.accounts_notified.get(&key1).unwrap()[0]
.1
.lamports(),
account1_lamports1
);
assert_eq!(notifier.accounts_notified.get(&key1).unwrap()[0].0, slot0);
assert_eq!(
notifier.accounts_notified.get(&key1).unwrap()[1]
.1
.lamports(),
account1_lamports2
);
assert_eq!(notifier.accounts_notified.get(&key1).unwrap()[1].0, slot1);
assert_eq!(notifier.accounts_notified.get(&key2).unwrap().len(), 1);
assert_eq!(
notifier.accounts_notified.get(&key2).unwrap()[0]
.1
.lamports(),
account2_lamports
);
assert_eq!(notifier.accounts_notified.get(&key2).unwrap()[0].0, slot0);
assert_eq!(notifier.accounts_notified.get(&key3).unwrap().len(), 1);
assert_eq!(
notifier.accounts_notified.get(&key3).unwrap()[0]
.1
.lamports(),
account3_lamports
);
assert_eq!(notifier.accounts_notified.get(&key3).unwrap()[0].0, slot1);
} | rust_cleaned_test_functions.jsonl/46212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36654,
13500,
3752,
55665,
8882,
368,
341,
286,
1077,
5206,
9618,
284,
40655,
7994,
486,
931,
19487,
5478,
32509,
6615,
666,
11829,
1428,
286,
1077,
73169,
284,
479,
1195,
799,
2271,
11546,
486,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_attribute_refaddr8_version2() {
let buf = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x99, 0x99];
let mut unit = test_parse_attribute_unit(8, Format::Dwarf32, LittleEndian);
unit.encoding.version = 2;
let form = constants::DW_FORM_ref_addr;
let value = AttributeValue::DebugInfoRef(DebugInfoOffset(0x0807_0605_0403_0201));
test_parse_attribute(&buf, 8, &unit, form, value);
} | rust_cleaned_test_functions.jsonl/102038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16791,
7793,
6214,
23,
9438,
17,
368,
341,
286,
1077,
6607,
284,
508,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
19,
11,
220,
15,
87,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculate_storage_count_and_alive_bytes() {
let accounts = AccountsDb::new_single_for_tests();
let shared_key = solana_sdk::pubkey::new_rand();
let account = AccountSharedData::new(1, 1, AccountSharedData::default().owner());
let slot0 = 0;
accounts.store_uncached(slot0, &[(&shared_key, &account)]);
let storage_maps = accounts
.storage
.get_slot_storage_entries(slot0)
.unwrap_or_default();
let storage_info = StorageSizeAndCountMap::default();
let accounts_map = accounts.process_storage_slot(&storage_maps[..]);
AccountsDb::update_storage_info(&storage_info, &accounts_map, &Mutex::default());
assert_eq!(storage_info.len(), 1);
for entry in storage_info.iter() {
assert_eq!(
(entry.key(), entry.value().count, entry.value().stored_size),
(&0, 1, 144)
);
}
} | rust_cleaned_test_functions.jsonl/7052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
23310,
3180,
8378,
58850,
12524,
368,
341,
286,
1077,
9618,
284,
40655,
7994,
486,
931,
19487,
5478,
32509,
543,
286,
1077,
6094,
3097,
284,
2048,
3362,
61783,
486,
9585,
792,
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... | 2 |
#[test]
fn test_cobalt_sender() {
let (sender, mut receiver) = mpsc::channel(1);
let mut sender = CobaltSender::new(sender);
sender.log_event(1, 1);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 1,
event_codes: vec![1],
component: None,
payload: EventPayload::Event(fidl_fuchsia_cobalt::Event {}),
}
);
sender.log_event_count(2, (), 10, 1);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 2,
event_codes: vec![],
component: None,
payload: EventPayload::EventCount(CountEvent {
period_duration_micros: 10,
count: 1
})
}
);
sender.with_component().log_event_count(2, (), "test", 11, 2);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 2,
event_codes: vec![],
component: Some("test".to_owned()),
payload: EventPayload::EventCount(CountEvent {
period_duration_micros: 11,
count: 2
})
}
);
sender.log_elapsed_time(3, [1, 2], 30);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 3,
event_codes: vec![1, 2],
component: None,
payload: EventPayload::ElapsedMicros(30),
}
);
sender.with_component().log_elapsed_time(3, [1, 2], "test".to_owned(), 30);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 3,
event_codes: vec![1, 2],
component: Some("test".to_owned()),
payload: EventPayload::ElapsedMicros(30),
}
);
sender.log_frame_rate(4, [1, 2, 3, 4], 10.0);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 4,
event_codes: vec![1, 2, 3, 4],
component: None,
payload: EventPayload::Fps(10.0),
}
);
sender.with_component().log_frame_rate(4, (), "testing", 100.0);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 4,
event_codes: vec![],
component: Some("testing".to_owned()),
payload: EventPayload::Fps(100.0),
}
);
sender.log_memory_usage(5, [1, 2, 3, 4, 5], 100);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 5,
event_codes: vec![1, 2, 3, 4, 5],
component: None,
payload: EventPayload::MemoryBytesUsed(100),
}
);
sender.with_component().log_memory_usage(5, [1, 2, 3, 4, 5], "a test", 100);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 5,
event_codes: vec![1, 2, 3, 4, 5],
component: Some("a test".to_owned()),
payload: EventPayload::MemoryBytesUsed(100),
}
);
sender.log_int_histogram(4, [1, 2, 3], vec![HistogramBucket { index: 2, count: 2 }]);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 4,
event_codes: vec![1, 2, 3],
component: None,
payload: EventPayload::IntHistogram(vec![HistogramBucket { index: 2, count: 2 }]),
}
);
sender.with_component().log_int_histogram(
4,
[1, 2, 3],
"Component",
vec![HistogramBucket { index: 2, count: 2 }],
);
assert_eq!(
receiver.try_next().unwrap().unwrap(),
CobaltEvent {
metric_id: 4,
event_codes: vec![1, 2, 3],
component: Some("Component".to_owned()),
payload: EventPayload::IntHistogram(vec![HistogramBucket { index: 2, count: 2 }]),
}
);
} | rust_cleaned_test_functions.jsonl/121110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2608
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
674,
3145,
54356,
368,
341,
286,
1077,
320,
11644,
11,
5206,
13964,
8,
284,
296,
81984,
486,
10119,
7,
16,
317,
286,
1077,
5206,
4646,
284,
45951,
3145,
20381,
486,
931,
19377,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ring() {
let mut buf = [0u8; 16];
let ring = Ring::new(&mut buf);
for i in 0..16 {
if let Some(elt) = ring.head_elt() {
*elt = i as u8;
ring.incr_head();
}
}
for i in 0..16 {
if let Some(elt) = ring.tail_elt() {
assert_eq!(*elt, i as u8);
ring.incr_tail();
}
}
let buf = ring.into_slice();
for i in 0..16 {
assert_eq!(buf[i], i as u8);
}
} | rust_cleaned_test_functions.jsonl/114707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34683,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
84,
23,
26,
220,
16,
21,
935,
286,
1077,
10058,
284,
21525,
486,
931,
2099,
6984,
6607,
626,
286,
369,
600,
304,
220,
15,
496,
16,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_is_bingo() {
let mut board = Board {
cells: vec![vec![BingoNumber {
number: 1,
is_called: true,
}, BingoNumber {
number: 2,
is_called: false,
}],
vec![BingoNumber {
number: 3,
is_called: false,
}, BingoNumber {
number: 4,
is_called: false,
}]],
last_called: 1,
..Default::default()
};
assert!(!is_bingo(&board));
board.cells[0][1].is_called = true;
assert!(is_bingo(&board));
board.cells[0][1].is_called = false;
board.cells[1][0].is_called = true;
assert!(is_bingo(&board));
} | rust_cleaned_test_functions.jsonl/117727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
880,
27908,
368,
341,
262,
1077,
5206,
4479,
284,
8751,
341,
286,
7761,
25,
7486,
20703,
4083,
20703,
33,
27908,
2833,
341,
310,
1372,
25,
220,
16,
345,
310,
374,
27859,
25,
830,
345,
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_stop_sending_and_reset_other_error_with_events() {
let (mut hconn, mut peer_conn) = connect(Client);
let request_stream_id = hconn
.fetch("GET", "https", "something.com", "/", &[])
.unwrap();
assert_eq!(request_stream_id, 0);
let out = hconn.process(None, now());
peer_conn.conn.process(out.dgram(), now());
// Get DataWritable for the request stream so that we can write the request body.
let data_writable = |e| matches!(e, Http3Event::DataWritable { .. });
assert!(hconn.events().any(data_writable));
let sent = hconn.send_request_body(request_stream_id, &[0u8; 10000]);
assert_eq!(sent, Ok(10000));
let out = hconn.process(None, now());
let _ = peer_conn.conn.process(out.dgram(), now());
read_request(&mut peer_conn.conn, request_stream_id);
// send response - 200 Content-Length: 3
// with content: 'abc'.
let _ = peer_conn.conn.stream_send(
request_stream_id,
&[
// headers
0x01, 0x06, 0x00, 0x00, 0xd9, 0x54, 0x01, 0x33, // a data frame
0x0, 0x3, 0x61, 0x62, 0x63,
],
);
let out = peer_conn.conn.process(None, now());
hconn.process(out.dgram(), now());
// Send a stop sending and reset.
assert_eq!(
Ok(()),
peer_conn
.conn
.stream_stop_sending(request_stream_id, Error::RequestCancelled.code())
);
assert_eq!(
Ok(()),
peer_conn
.conn
.stream_reset_send(request_stream_id, Error::RequestCancelled.code())
);
let out = peer_conn.conn.process(None, now());
hconn.process(out.dgram(), now());
let http_events = hconn.events();
for e in http_events {
match e {
Http3Event::StopSending { .. } => {
panic!("We should not get StopSending.");
}
Http3Event::Reset { stream_id, error } => {
assert_eq!(stream_id, request_stream_id);
assert_eq!(error, Error::RequestCancelled.code());
}
Http3Event::HeaderReady { .. } | Http3Event::DataReadable { .. } => {
panic!("We should not get any headers or data");
}
_ => {}
}
}
// after this stream will be removed from hconn. We will check this by trying to read
// from the stream and that should fail.
let mut buf = [0u8; 100];
let res = hconn.read_response_data(now(), request_stream_id, &mut buf);
assert!(res.is_err());
assert_eq!(res.unwrap_err(), Error::InvalidStreamId);
hconn.close(now(), 0, "");
} | rust_cleaned_test_functions.jsonl/10935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19039,
643,
2459,
8378,
18983,
30456,
4096,
6615,
19691,
368,
341,
286,
1077,
320,
6984,
305,
5148,
11,
5206,
14397,
17241,
8,
284,
4564,
46851,
317,
286,
1077,
1681,
12673,
842,
284,
305,
5148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_selection_movement() {
let mut editor = Editor::new(Rc::new(RefCell::new(Buffer::new(1))));
editor.buffer.borrow_mut().splice(0..0, "abc");
editor.buffer.borrow_mut().splice(3..3, "\n");
editor.buffer.borrow_mut().splice(4..4, "\ndef");
assert_eq!(render_selections(&editor), vec![empty_selection(0, 0)]);
editor.select_right();
assert_eq!(render_selections(&editor), vec![selection((0, 0), (0, 1))]);
// Selecting right wraps across newlines
for _ in 0..3 { editor.select_right(); }
assert_eq!(render_selections(&editor), vec![selection((0, 0), (1, 0))]);
// Moving right with a non-empty selection clears the selection
editor.move_right();
assert_eq!(render_selections(&editor), vec![empty_selection(1, 0)]);
editor.move_right();
assert_eq!(render_selections(&editor), vec![empty_selection(2, 0)]);
// Selecting left wraps across newlines
editor.select_left();
assert_eq!(render_selections(&editor), vec![rev_selection((1, 0), (2, 0))]);
editor.select_left();
assert_eq!(render_selections(&editor), vec![rev_selection((0, 3), (2, 0))]);
// Moving left with a non-empty selection clears the selection
editor.move_left();
assert_eq!(render_selections(&editor), vec![empty_selection(0, 3)]);
// Reverse is updated correctly when selecting left and right
editor.select_left();
assert_eq!(render_selections(&editor), vec![rev_selection((0, 2), (0, 3))]);
editor.select_right();
assert_eq!(render_selections(&editor), vec![empty_selection(0, 3)]);
editor.select_right();
assert_eq!(render_selections(&editor), vec![selection((0, 3), (1, 0))]);
editor.select_left();
assert_eq!(render_selections(&editor), vec![empty_selection(0, 3)]);
editor.select_left();
assert_eq!(render_selections(&editor), vec![rev_selection((0, 2), (0, 3))]);
// Selecting vertically moves the head and updates the reversed property
editor.select_left();
assert_eq!(render_selections(&editor), vec![rev_selection((0, 1), (0, 3))]);
editor.select_down();
assert_eq!(render_selections(&editor), vec![selection((0, 3), (1, 0))]);
editor.select_down();
assert_eq!(render_selections(&editor), vec![selection((0, 3), (2, 1))]);
editor.select_up();
editor.select_up();
assert_eq!(render_selections(&editor), vec![rev_selection((0, 1), (0, 3))]);
// Favors selection end when moving down
editor.move_down();
editor.move_down();
assert_eq!(render_selections(&editor), vec![empty_selection(2, 3)]);
// Favors selection start when moving up
editor.move_left();
editor.move_left();
editor.select_right();
editor.select_right();
assert_eq!(render_selections(&editor), vec![selection((2, 1), (2, 3))]);
editor.move_up();
editor.move_up();
assert_eq!(render_selections(&editor), vec![empty_selection(0, 1)]);
} | rust_cleaned_test_functions.jsonl/123912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23672,
70325,
368,
341,
286,
1077,
5206,
6440,
284,
12580,
486,
931,
2785,
66,
486,
931,
7,
3945,
3599,
486,
931,
55574,
486,
931,
7,
16,
38776,
286,
6440,
24465,
83640,
29523,
1005,
94960,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_quat_lerp() {
let q0 = Quat::from_rotation_y(deg(0.0));
let q1 = Quat::from_rotation_y(deg(90.0));
assert_approx_eq!(q0, q0.lerp(q1, 0.0));
assert_approx_eq!(q1, q0.lerp(q1, 1.0));
assert_approx_eq!(Quat::from_rotation_y(deg(45.0)), q0.lerp(q1, 0.5));
} | rust_cleaned_test_functions.jsonl/73792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
266,
907,
22632,
368,
341,
262,
1077,
2804,
15,
284,
3406,
266,
486,
1499,
44813,
4178,
77127,
7,
15,
13,
15,
1106,
262,
1077,
2804,
16,
284,
3406,
266,
486,
1499,
44813,
4178,
77127,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dirty_sample_with_a_bad_checksum_2() {
// TODO: investigate 2 failing records
test_full_sample(sample_with_a_bad_checksum_2(), 1774, 2)
} | rust_cleaned_test_functions.jsonl/64580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63642,
17491,
6615,
4306,
34199,
64038,
62,
17,
368,
341,
262,
442,
5343,
25,
19314,
220,
17,
21394,
7424,
198,
262,
1273,
16372,
17491,
32968,
6615,
4306,
34199,
64038,
62,
17,
1507,
220,
16,
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 |
#[test]
fn test_transpile() {
let specifier =
ModuleSpecifier::parse("https://deno.land/x/mod.ts").unwrap();
let source = r#"
enum D {
A,
B,
}
namespace N {
export enum D {
A = "value"
}
export const Value = 5;
}
export class A {
private b: string;
protected c: number = 1;
e: "foo";
constructor (public d = D.A) {
const e = "foo" as const;
this.e = e;
console.log(N.Value);
}
}
"#;
let module = parse_module(ParseParams {
specifier: specifier.as_str().to_string(),
source: SourceTextInfo::from_string(source.to_string()),
media_type: MediaType::TypeScript,
capture_tokens: false,
maybe_syntax: None,
scope_analysis: false,
})
.unwrap();
let transpiled_source = module.transpile(&EmitOptions::default()).unwrap();
let expected_text = r#"var D;
(function(D) {
D[D["A"] = 0] = "A";
D[D["B"] = 1] = "B";
})(D || (D = {}));
var N;
(function(N1) {
let D;
(function(D) {
D["A"] = "value";
})(D = N1.D || (N1.D = {}));
var Value = N1.Value = 5;
})(N || (N = {}));
export class A {
d;
b;
c = 1;
e;
constructor(d = D.A){
this.d = d;
const e = "foo";
this.e = e;
console.log(N.Value);
}
}
"#;
assert_eq!(
&transpiled_source.text[..expected_text.len()],
expected_text
);
assert!(transpiled_source
.text
.contains("\n//# sourceMappingURL=data:application/json;base64,"));
assert!(transpiled_source.source_map.is_none());
} | rust_cleaned_test_functions.jsonl/133954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
12192,
368,
341,
262,
1077,
97616,
4035,
414,
13711,
87297,
486,
6400,
445,
2428,
1110,
5183,
78,
87627,
10776,
38479,
21288,
1827,
15454,
543,
262,
1077,
2530,
284,
435,
2,
698,
9018,
422,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_does_not_start_with() {
let mut buf = Buffer::new();
buf.insert(0, &['a', 'b', 'c']);
let mut buf2 = Buffer::new();
buf2.insert(0, &['a', 'b', 'c']);
assert_eq!(buf.starts_with(&buf2), false);
} | rust_cleaned_test_functions.jsonl/61896 | {
"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,
96374,
7913,
4906,
6615,
368,
341,
286,
1077,
5206,
6607,
284,
10312,
486,
931,
543,
286,
6607,
7030,
7,
15,
11,
609,
677,
64,
516,
364,
65,
516,
364,
66,
5860,
286,
1077,
5206,
6607,
17,
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_pow() {
let tests = vec![
(Datum::F64(1.0), Datum::F64(3.0), Datum::F64(1.0)),
(Datum::F64(3.0), Datum::F64(0.0), Datum::F64(1.0)),
(Datum::F64(2.0), Datum::F64(4.0), Datum::F64(16.0)),
];
for (arg0, arg1, exp) in tests {
let got = eval_func(ScalarFuncSig::Pow, &[arg0, arg1]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/13181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
68036,
486,
37,
21,
19,
7,
16,
13,
15,
701,
68459,
486,
37,
21,
19,
7,
18,
13,
15,
701,
68459,
486,
37,
21,
19,
7,
16,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_vcx_credential_get_new_offers(){
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE,"true");
let cxn = ::connection::build_connection("test_get_new_offers").unwrap();
let cb = return_types_u32::Return_U32_STR::new().unwrap();
assert_eq!(vcx_credential_get_offers(cb.command_handle,
cxn,
Some(cb.get_callback())),
error::SUCCESS.code_num as u32);
cb.receive(Some(Duration::from_secs(10))).unwrap();
} | rust_cleaned_test_functions.jsonl/58636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
666,
30320,
3062,
5921,
13651,
388,
3032,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
1335,
1866,
797,
286,
1077,
20716,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_map() {
let size: [u8; 4] = unsafe { mem::transmute(1u32.to_be()) };
let b: [u8; 28] = [
0x48,
0x02,
size[0],
size[1],
size[2],
size[3],
0x06,
7,
b'f',
b'o',
b'o',
b' ',
b'b',
b'a',
b'r',
0x16,
11,
b'h',
b'e',
b'l',
b'l',
b'o',
b' ',
b'w',
b'o',
b'r',
b'l',
b'd',
];
let mut de = TarsDecoder::from(&b[..]);
let map: BTreeMap<String, String> = de.read_map(4, true, BTreeMap::new()).unwrap();
let value2 = map.get(&String::from(&"foo bar"[..])).unwrap();
assert_eq!(value2, &String::from(&"hello world"[..]));
let b2: [u8; 6] = [0x48, 0x02, 0, 0, 0, 0];
let mut de2 = TarsDecoder::from(&b2[..]);
let map2: BTreeMap<Vec<String>, BTreeMap<i32, String>> =
de2.read_map(4, true, BTreeMap::new()).unwrap();
assert_eq!(map2, BTreeMap::new());
let omap2: BTreeMap<Vec<String>, BTreeMap<i32, String>> =
de2.read_map(129, false, BTreeMap::new()).unwrap();
assert_eq!(omap2, BTreeMap::new());
let err: Result<BTreeMap<Vec<String>, BTreeMap<i32, String>>, DecodeErr> =
de2.read_map(129, true, BTreeMap::new());
assert_eq!(err, Err(DecodeErr::TarsTagNotFoundErr));
} | rust_cleaned_test_functions.jsonl/128473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1008
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
5376,
368,
341,
286,
1077,
1379,
25,
508,
84,
23,
26,
220,
19,
60,
284,
19860,
314,
1833,
486,
1458,
52214,
7,
16,
84,
18,
17,
2389,
21263,
2140,
2605,
286,
1077,
293,
25,
508,
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_key() {
let mut p = Parser::new();
assert_eq!(p.key("\"GřáƥèƒřúïÆ\"").1, Done("", "\"GřáƥèƒřúïÆ\""));
p = Parser::new();
assert_eq!(p.key("_is-key").1, Done("", "_is-key"));
} | rust_cleaned_test_functions.jsonl/27421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
368,
341,
262,
1077,
5206,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
4735,
38915,
38,
144044,
16109,
18791,
39832,
144839,
81093,
18791,
75005,
144839,
527,
144044,
16109,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ramdisk_with_large_block_size_returns_error() {
ramdevice_client::wait_for_device(
"/dev/sys/platform/00:00:2d/ramctl",
std::time::Duration::from_secs(30),
)
.expect("ramctl did not appear");
let ramdisk =
RamdiskClient::create(super::BLOCK_SIZE * 2, 10).expect("RamdiskClient::create failed");
let remote_block_device =
RemoteBlockClientSync::new(ramdisk.open().expect("ramdisk.open failed"))
.expect("RemoteBlockClientSync::new failed");
Cache::new(remote_block_device).err().expect("Cache::new succeeded");
} | rust_cleaned_test_functions.jsonl/107009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62124,
30496,
6615,
45228,
7113,
2368,
58900,
4096,
368,
341,
286,
17823,
6111,
8179,
486,
11489,
5478,
9204,
1006,
310,
3521,
3583,
41836,
27294,
14,
15,
15,
25,
15,
15,
25,
17,
67,
14,
2396,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_atoibm_and_ucase_conv_spec_test() {
new_ucmd!()
.args(&["conv=ibm,ucase"])
.pipe_in_fixture("seq-byte-values-b632a992d3aed5d8d1a59cc5a5a455ba.test")
.succeeds()
.stdout_is_fixture_bytes("lcase-ibm.test");
} | rust_cleaned_test_functions.jsonl/99854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
78,
579,
76,
8378,
68887,
519,
22716,
13594,
4452,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12027,
28,
579,
76,
11,
1754,
519,
14108,
286,
659,
13768,
1243,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_preboot_get_balloon_config() {
let req = VmmAction::GetBalloonConfig;
let expected_cfg = BalloonDeviceConfig::default();
check_preboot_request(req, |result, _| {
assert_eq!(result, Ok(VmmData::BalloonConfig(expected_cfg)))
});
} | rust_cleaned_test_functions.jsonl/44528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
4619,
3062,
56441,
31335,
5332,
368,
341,
286,
1077,
4232,
284,
647,
3821,
2512,
486,
1949,
37889,
31335,
2648,
280,
286,
1077,
3601,
18343,
284,
19420,
31335,
6985,
2648,
486,
2258,
543,
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_assert_pixels_eq_passes() {
let image = gray_image!(
00, 01, 02;
10, 11, 12);
assert_pixels_eq!(image, image);
} | rust_cleaned_test_functions.jsonl/4649 | {
"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,
16553,
49745,
10714,
15464,
288,
368,
341,
286,
1077,
2168,
284,
17545,
4954,
33673,
310,
220,
15,
15,
11,
220,
15,
16,
11,
220,
15,
17,
280,
310,
220,
16,
15,
11,
220,
16,
16,
11,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fmt() {
let a = Wrapper(Dummy);
assert_eq!(&*format!("{:b}", a), "binary");
assert_eq!(&*format!("{:?}", a), "debug");
assert_eq!(&*format!("{}", a), "display");
assert_eq!(&*format!("{:e}", a), "lowerexp");
assert_eq!(&*format!("{:x}", a), "lowerhex");
assert_eq!(&*format!("{:o}", a), "octal");
assert_eq!(&*format!("{:p}", a), "pointer");
assert_eq!(&*format!("{:E}", a), "upperexp");
assert_eq!(&*format!("{:X}", a), "upperhex");
} | rust_cleaned_test_functions.jsonl/124343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
368,
341,
262,
1077,
264,
284,
35488,
5432,
8574,
626,
262,
2060,
10714,
0,
2099,
9,
2243,
88928,
25,
65,
9545,
264,
701,
330,
25891,
797,
262,
2060,
10714,
0,
2099,
9,
2243,
88928,
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... | 1 |
#[test]
fn test_style_variable_holder() {
const FORMAT_STR: &str = "($a [($b) $c](none $s)) $d [t]($t)";
let expected_variables = vec!["s", "t"].into_iter().map(String::from).collect();
let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let variables = formatter.get_style_variables();
assert_eq!(variables, expected_variables);
} | rust_cleaned_test_functions.jsonl/71893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15117,
14635,
50788,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
330,
699,
64,
508,
699,
65,
8,
400,
66,
9533,
6697,
400,
82,
593,
400,
67,
508,
83,
60,
699,
83,
24023,
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_vmerge() {
let c = TableCellProperty::new().vertical_merge(VMergeType::Continue);
let b = c.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:tcPr><w:vMerge w:val="continue" /></w:tcPr>"#
);
} | rust_cleaned_test_functions.jsonl/22961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
19052,
368,
341,
286,
1077,
272,
284,
84370,
3052,
486,
931,
1005,
15292,
20888,
7,
11187,
10080,
929,
486,
23526,
317,
286,
1077,
293,
284,
272,
13239,
543,
286,
2060,
10714,
33673,
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_get_raw_returns_most_recent_value_from_webcam() -> Result<(), Box<dyn Error>> {
let (als, webcam_tx) = setup();
webcam_tx.send(42)?;
webcam_tx.send(43)?;
webcam_tx.send(44)?;
assert_eq!(44, als.get_raw()?);
Ok(())
} | rust_cleaned_test_functions.jsonl/25976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
16067,
58900,
81416,
62361,
3142,
5673,
25960,
11599,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
320,
1127,
11,
25951,
17805,
8,
284,
6505,
1428,
286,
25951,
17805,
5219,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_paths() {
let tmp_dir = tempdir().unwrap();
// Test if passing paths to GLib and getting them back
// gives us useful results
let dir_1 = tmp_dir.path().join("abcd");
fs::create_dir(&dir_1).unwrap();
assert_eq!(crate::path_get_basename(&dir_1), Path::new("abcd"));
assert_eq!(
crate::path_get_basename(dir_1.canonicalize().unwrap()),
Path::new("abcd")
);
// This currently fails on Windows because C:\\Users\\runneradmin
// gets shortened to C:\\Users\\RUNNER~1
#[cfg(not(windows))]
assert_eq!(
crate::path_get_dirname(dir_1.canonicalize().unwrap()),
tmp_dir.path()
);
assert!(crate::file_test(
&dir_1,
crate::FileTest::EXISTS | crate::FileTest::IS_DIR
));
assert!(crate::file_test(
&dir_1.canonicalize().unwrap(),
crate::FileTest::EXISTS | crate::FileTest::IS_DIR
));
// And test with some non-ASCII characters
let dir_2 = tmp_dir.as_ref().join("øäöü");
fs::create_dir(&dir_2).unwrap();
assert_eq!(crate::path_get_basename(&dir_2), Path::new("øäöü"));
assert_eq!(
crate::path_get_basename(dir_2.canonicalize().unwrap()),
Path::new("øäöü")
);
// This currently fails on Windows because C:\\Users\\runneradmin
// gets shortened to C:\\Users\\RUNNER~1
#[cfg(not(windows))]
assert_eq!(
crate::path_get_dirname(dir_2.canonicalize().unwrap()),
tmp_dir.path()
);
assert!(crate::file_test(
&dir_2,
crate::FileTest::EXISTS | crate::FileTest::IS_DIR
));
assert!(crate::file_test(
&dir_2.canonicalize().unwrap(),
crate::FileTest::EXISTS | crate::FileTest::IS_DIR
));
} | rust_cleaned_test_functions.jsonl/75836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 983
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24152,
368,
341,
286,
1077,
4174,
4334,
284,
2730,
3741,
1005,
15454,
1428,
286,
442,
3393,
421,
12299,
12716,
311,
5588,
579,
323,
3709,
1105,
1182,
198,
286,
442,
6696,
601,
5390,
3059,
198,
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_lock_unlock_header() {
let container = [0u8; constants::MIN_ORDER_SIZE];
let block = get_header(&container);
let header_bytes: [u8; 8] = [0x20, 0x00, 0x00, 0x00, 0x49, 0x4e, 0x53, 0x50];
// Can't unlock unlocked header.
assert!(block.unlock_header().is_err());
assert!(block.lock_header().is_ok());
assert!(block.header_is_locked().unwrap());
assert_eq!(block.header_generation_count().unwrap(), 1);
assert_eq!(container[..8], header_bytes[..]);
assert_eq!(container[8..], [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
// Can't lock locked header.
assert!(block.lock_header().is_err());
assert!(block.unlock_header().is_ok());
assert!(!block.header_is_locked().unwrap());
assert_eq!(block.header_generation_count().unwrap(), 2);
assert_eq!(container[..8], header_bytes[..]);
assert_eq!(container[8..], [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
// Test overflow: set payload bytes to max u64 value. Ensure we cannot lock
(&container[..]).write_bytes(8, &u64::max_value().to_le_bytes());
assert!(block.lock_header().is_err());
assert!(block.unlock_header().is_ok());
assert_eq!(block.header_generation_count().unwrap(), 0);
assert_eq!(container[..8], header_bytes[..]);
assert_eq!(container[8..], [0, 0, 0, 0, 0, 0, 0, 0]);
test_ok_types(
move |b| {
b.header_generation_count()?;
b.lock_header()?;
b.unlock_header()
},
&BTreeSet::from_iter(vec![BlockType::Header]),
);
} | rust_cleaned_test_functions.jsonl/100149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 836
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9818,
19465,
8757,
368,
341,
286,
1077,
5476,
284,
508,
15,
84,
23,
26,
18021,
486,
16413,
26677,
4098,
935,
286,
1077,
2504,
284,
633,
8757,
2099,
3586,
317,
286,
1077,
4247,
12524,
25,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transform_with_suffix_on_input() {
new_ucmd!()
.args(&["--suffix=b", "--to=si"])
.pipe_in("2000b")
.succeeds()
.stdout_only("2.0Kb\n");
} | rust_cleaned_test_functions.jsonl/93649 | {
"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,
18449,
6615,
37151,
4470,
5898,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
26786,
22086,
497,
14482,
983,
28,
6321,
14108,
286,
659,
13768,
1243,
445,
17,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_overlap_1() {
DelayPlusPoolProblem {
input: vec![0.0, 0.0, 0.0],
pulse: 1,
delay: 0,
stride: 1,
pool_window: 3,
}
.run()
.unwrap()
} | rust_cleaned_test_functions.jsonl/125719 | {
"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,
17799,
65794,
62,
16,
368,
341,
262,
39793,
21807,
10551,
31198,
341,
286,
1946,
25,
7486,
20703,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
1259,
286,
27235,
25,
220,
16,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub_borrow() {
let _ = u256([0, 1, 0, 0]) - u256([0, 0, 1, 0]);
} | rust_cleaned_test_functions.jsonl/13485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 53
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
880,
7768,
368,
341,
262,
1077,
716,
284,
575,
17,
20,
21,
2561,
15,
11,
220,
16,
11,
220,
15,
11,
220,
15,
2467,
481,
575,
17,
20,
21,
2561,
15,
11,
220,
15,
11,
220,
16,
11,
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 |
#[test]
fn test_bytewise_should_preserve_empty_line_and_final_newline() {
new_ucmd!()
.args(&["-w2", "-b"])
.pipe_in("12\n\n34\n")
.succeeds()
.stdout_is("12\n\n34\n");
} | rust_cleaned_test_functions.jsonl/23299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3710,
83,
24350,
43378,
32116,
5852,
15124,
6528,
8378,
20676,
5921,
1056,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
17,
497,
6523,
65,
14108,
286,
659,
13768,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_genesis() {
let (config, _genesis_key) = config_builder::test_config();
let (db, _executor) = create_db_and_executor(&config);
let (li, epoch_change_proof, _accumulator_consistency_proof) =
db.reader.get_state_proof(0).unwrap();
let trusted_state = TrustedState::from(config.base.waypoint.waypoint_from_config().unwrap());
trusted_state
.verify_and_ratchet(&li, &epoch_change_proof)
.unwrap();
let li = li.ledger_info();
assert_eq!(li.version(), 0);
let association_account = db
.reader
.get_account_state_with_proof(association_address(), 0, 0)
.unwrap();
association_account
.verify(li, 0, association_address())
.unwrap();
} | rust_cleaned_test_functions.jsonl/28484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
13774,
368,
341,
262,
1077,
320,
1676,
11,
716,
77894,
3097,
8,
284,
2193,
28532,
486,
1944,
5332,
543,
262,
1077,
320,
1999,
11,
716,
80787,
8,
284,
1855,
8685,
8378,
81207,
2099,
1676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_metalink() {
test_harness(|| unsafe {
library_init();
let session = get_session();
let metalink_path = "./tests/metalink4.xml";
let mut gids = vec![];
assert_eq!(
add_metalink(session, &mut gids, metalink_path, &vec![], -1),
0
);
assert_eq!(gids.len(), 2);
gids.clear();
assert_eq!(
add_metalink(
session,
&mut gids,
metalink_path,
&vec![KeyVal {
key: "file-allocation".into(),
val: "foo".into(),
}],
-1,
),
-1
);
library_deinit();
});
} | rust_cleaned_test_functions.jsonl/25962 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
717,
21323,
766,
368,
341,
262,
1273,
1523,
23518,
79453,
19860,
341,
286,
6733,
6137,
543,
286,
1077,
3797,
284,
633,
12316,
1428,
286,
1077,
9317,
766,
2638,
284,
5924,
23841,
3183,
21323,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ticker() {
delay();
let client: Public<Sync> = Public::new(SANDBOX_URL);
let ticker = client.get_ticker("BTC-USD").unwrap();
let str = format!("{:?}", ticker);
dbg!(&str);
assert!(str.starts_with("Ticker { trade_id:"));
assert!(str.contains("time:"));
} | rust_cleaned_test_functions.jsonl/50633 | {
"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,
3062,
528,
5215,
368,
341,
262,
7626,
543,
262,
1077,
2943,
25,
3066,
27,
12154,
29,
284,
3066,
486,
931,
3759,
1093,
3506,
60155,
8000,
317,
262,
1077,
46987,
284,
2943,
670,
528,
5215,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lcg64_xor_1024mix_double() {
let mut prng = Lcg64Xor1024Mix::new();
for _ in 0..16 {
println!("{}", prng.next_double());
}
for _ in 0..16 {
assert_ne!(prng.next_double(), prng.next_double());
}
} | rust_cleaned_test_functions.jsonl/54524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
27446,
21,
19,
76462,
62,
16,
15,
17,
19,
35071,
24598,
368,
341,
286,
1077,
5206,
548,
968,
284,
444,
27446,
21,
19,
55,
269,
16,
15,
17,
19,
58083,
486,
931,
543,
286,
369,
716,
304... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_err_empty_str() {
let res = Decimal::<2>::from_str("");
assert!(res.is_err());
let err = res.unwrap_err();
assert_eq!(err, ParseDecimalError::Empty);
} | rust_cleaned_test_functions.jsonl/12023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9266,
15124,
2895,
368,
341,
286,
1077,
592,
284,
26728,
27638,
17,
6831,
1499,
2895,
13056,
286,
2060,
10297,
416,
2079,
9266,
1423,
286,
1077,
1848,
284,
592,
55395,
9266,
543,
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 |
#[test]
fn test_kokushi() {
assert_bot(
&[
M1, M2, M4, M5, M7, M8, M9, P1, P2, P4, P5, P7, P8, P9, S1, S2, S4, S5, S7, S8, S9,
X1, X1, X1, X1, X2, X2, X3, X3, X4, X4, X5, X5, X7,
],
M3,
X3,
);
} | rust_cleaned_test_functions.jsonl/77929 | {
"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,
4698,
562,
37074,
368,
341,
286,
2060,
38883,
1006,
310,
609,
9640,
394,
386,
16,
11,
386,
17,
11,
386,
19,
11,
386,
20,
11,
386,
22,
11,
386,
23,
11,
386,
24,
11,
393,
16,
11,
393,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_format_o_default() {
assert_eq!(
parse_format_flags_str(&["od", "--format=o"]).unwrap(),
vec![FORMAT_ITEM_OCT32]
);
} | rust_cleaned_test_functions.jsonl/78700 | {
"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,
17799,
8955,
14179,
9993,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
8955,
14130,
2895,
2099,
1183,
347,
497,
14482,
2243,
85876,
45014,
15454,
3148,
286,
7486,
20703,
46559,
16461,
2232,
1162,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_typedef_for_explicit_template_specialization() -> Result<()> {
let ir = ir_from_cc(
r#" #pragma clang lifetime_elision
template <typename T>
struct MyStruct final {};
// Doc comment for template specialization for T=int.
template<>
struct MyStruct<int> final {
// Doc comment of the GetValue method specialization for T=int.
const int& GetValue() const { return value * 42; }
// Doc comment of the `value` field specialization for T=int.
int value;
};
// Doc comment of MyTypeAlias.
using MyTypeAlias = MyStruct<int>; "#,
)?;
// Make sure the explicit specialization of the struct template appears exactly
// once in the `top_level_item_ids`.
let record = ir.records().find(|r| r.cc_name == "MyStruct<int>").unwrap();
assert_eq!(1, ir.top_level_item_ids().filter(|&&id| id == record.id).count());
// Instantiation of the struct template based on the specialization for T=int:
assert_ir_matches!(
ir,
quote! {
Record {
rs_name: "__CcTemplateInst8MyStructIiE", ...
cc_name: "MyStruct<int>", ...
owning_target: BazelLabel("//test:testing_target"), ...
doc_comment: Some("Doc comment for template specialization for T=int."), ...
fields: [Field {
identifier: Some("value"), ...
doc_comment: Some("Doc comment of the `value` field specialization for T=int."), ...
type_: Ok(MappedType {
rs_type: RsType { name: Some("i32"), ... },
cc_type: CcType { name: Some("int"), ... },
}),
access: Public,
offset: 0, ...
}], ...
}
}
);
// Instance method inside the struct template:
assert_ir_matches!(
ir,
quote! {
Func {
name: "GetValue",
owning_target: BazelLabel("//test:testing_target"),
mangled_name: "_ZNK8MyStructIiE8GetValueEv___test_testing_target", ...
doc_comment: Some("Doc comment of the GetValue method specialization for T=int."), ...
is_inline: true, ...
member_func_metadata: Some(MemberFuncMetadata {
record_id: ItemId(...),
instance_method_metadata: Some(InstanceMethodMetadata { ... }), ...
}), ...
}
}
);
Ok(())
} | rust_cleaned_test_functions.jsonl/37172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42111,
4219,
5478,
14214,
6026,
8693,
41629,
2022,
368,
1464,
5714,
71698,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
435,
55543,
671,
6015,
18260,
19031,
21602,
1816,
271,
310,
3811,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_src_file_to_url_4() {
let (_temp_dir, deno_dir) = test_setup();
let x = deno_dir.deps_https.join("localhost_PORT4545/world.txt");
assert_eq!(
"https://localhost:4545/world.txt",
deno_dir.src_file_to_url(x.to_str().unwrap())
);
} | rust_cleaned_test_functions.jsonl/72751 | {
"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,
16274,
2458,
2346,
2903,
62,
19,
368,
341,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
543,
262,
1077,
856,
284,
3371,
78,
4334,
2285,
1690,
26817,
5446,
445,
8301,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_link_verify_and_trim() {
let string = verify_and_trim("> some string <", (b'>', b'<'));
assert_eq!(string.ok(), Some("some string"));
let err = verify_and_trim(" > some string <", (b'>', b'<'));
assert_eq!(err.is_err(), true);
} | rust_cleaned_test_functions.jsonl/46354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
35638,
8378,
70025,
368,
341,
286,
1077,
914,
284,
10146,
8378,
70025,
63853,
220,
1045,
914,
256,
98388,
320,
65,
6270,
516,
293,
21524,
6336,
286,
2060,
10714,
10297,
917,
18165,
1507,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_operators() {
let source = "//////=/ /";
let tokens = lex_source(source);
assert_eq!(
tokens,
vec![
Tok::DoubleSlash,
Tok::DoubleSlash,
Tok::DoubleSlashEqual,
Tok::Slash,
Tok::Slash,
Tok::Newline,
]
);
} | rust_cleaned_test_functions.jsonl/95231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25634,
2973,
368,
341,
286,
1077,
2530,
284,
330,
725,
322,
23286,
608,
876,
286,
1077,
11211,
284,
22429,
10347,
12437,
317,
286,
2060,
10714,
33673,
310,
11211,
345,
310,
7486,
90515,
394,
21447... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eh_frame_fde_lsda_function_relative() {
let instrs = [1, 2, 3, 4];
let cie_offset = 1;
let mut cie = make_test_cie();
cie.format = Format::Dwarf32;
cie.version = 1;
cie.augmentation = Some(Augmentation::default());
cie.augmentation.as_mut().unwrap().lsda = Some(constants::DwEhPe(
constants::DW_EH_PE_funcrel.0 | constants::DW_EH_PE_absptr.0,
));
let mut fde = FrameDescriptionEntry {
offset: 0,
length: 0,
format: Format::Dwarf32,
cie: cie.clone(),
initial_segment: 0,
initial_address: 0xfeed_face,
address_range: 9000,
augmentation: Some(AugmentationData {
lsda: Some(Pointer::Direct(0xbeef)),
}),
instructions: EndianSlice::new(&instrs, LittleEndian),
};
let rest = [1, 2, 3, 4];
let kind = eh_frame_le();
let section = Section::with_endian(kind.endian())
.append_repeated(10, 10)
.fde(kind, cie_offset, &mut fde)
.append_bytes(&rest)
.get_contents()
.unwrap();
let section = kind.section(§ion);
let input = &mut section.section().range_from(10..);
// Adjust the FDE's augmentation to be relative to the function.
fde.augmentation.as_mut().unwrap().lsda = Some(Pointer::Direct(0xfeed_face + 0xbeef));
let result = parse_fde(section, input, |_, _, _| Ok(cie.clone()));
assert_eq!(result, Ok(fde));
assert_eq!(*input, EndianSlice::new(&rest, LittleEndian));
} | rust_cleaned_test_functions.jsonl/9398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 836
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
71,
8929,
761,
450,
53174,
3235,
9174,
29286,
368,
341,
286,
1077,
9491,
82,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
1077,
272,
645,
6917,
284,
220,
16,
401,
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_example_1() {
let launch = Vector::new(Position::origin(), 7, 2);
let target = Rectangle::new(20, 30, -10, -5);
let arc = hit_arc(&launch, &target);
assert_eq!(true, arc.is_some());
assert_eq!(Position::new(28, -7), arc.unwrap().last().unwrap().pos);
} | rust_cleaned_test_functions.jsonl/124101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
62,
16,
368,
341,
286,
1077,
7050,
284,
4196,
486,
931,
61843,
486,
8611,
1507,
220,
22,
11,
220,
17,
626,
286,
1077,
2169,
284,
19280,
486,
931,
7,
17,
15,
11,
220,
18,
15,
11,
481... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_virtio_write_config() {
let mut block = default_block();
let expected_config_space: [u8; CONFIG_SPACE_SIZE] =
[0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
block.write_config(0, &expected_config_space);
let mut actual_config_space = [0u8; CONFIG_SPACE_SIZE];
block.read_config(0, &mut actual_config_space);
assert_eq!(actual_config_space, expected_config_space);
// Invalid write.
let new_config_space: [u8; CONFIG_SPACE_SIZE] = [0xd, 0xe, 0xa, 0xd, 0xb, 0xe, 0xe, 0xf];
block.write_config(5, &new_config_space);
// Make sure nothing got written.
block.read_config(0, &mut actual_config_space);
assert_eq!(actual_config_space, expected_config_space);
} | rust_cleaned_test_functions.jsonl/76935 | {
"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,
2273,
2106,
815,
9165,
5332,
368,
341,
286,
1077,
5206,
2504,
284,
1638,
7113,
1428,
286,
1077,
3601,
5332,
14663,
25,
508,
84,
23,
26,
13202,
38404,
4098,
60,
4035,
310,
508,
15,
87,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_b() {
let oxy = solve_b(&input(), Rating::Oxygen, 5);
let co2 = solve_b(&input(), Rating::Co2, 5);
assert_eq!((oxy, co2), (10, 23));
} | rust_cleaned_test_functions.jsonl/32786 | {
"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,
880,
368,
341,
286,
1077,
98590,
284,
11625,
880,
2099,
1355,
1507,
19216,
486,
46,
18936,
11,
220,
20,
317,
286,
1077,
1062,
17,
284,
11625,
880,
2099,
1355,
1507,
19216,
486,
7339,
17,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find() {
let skm = make_skipmap();
assert_eq!(
skm.map
.borrow()
.get_greater_or_equal(&"abf".as_bytes().to_vec())
.unwrap()
.key,
"abf".as_bytes().to_vec()
);
assert!(skm
.map
.borrow()
.get_greater_or_equal(&"ab{".as_bytes().to_vec())
.is_none());
assert_eq!(
skm.map
.borrow()
.get_greater_or_equal(&"aaa".as_bytes().to_vec())
.unwrap()
.key,
"aba".as_bytes().to_vec()
);
assert_eq!(
skm.map
.borrow()
.get_greater_or_equal(&"ab".as_bytes())
.unwrap()
.key
.as_slice(),
"aba".as_bytes()
);
assert_eq!(
skm.map
.borrow()
.get_greater_or_equal(&"abc".as_bytes())
.unwrap()
.key
.as_slice(),
"abc".as_bytes()
);
assert!(skm
.map
.borrow()
.get_next_smaller(&"ab0".as_bytes())
.is_none());
assert_eq!(
skm.map
.borrow()
.get_next_smaller(&"abd".as_bytes())
.unwrap()
.key
.as_slice(),
"abc".as_bytes()
);
assert_eq!(
skm.map
.borrow()
.get_next_smaller(&"ab{".as_bytes())
.unwrap()
.key
.as_slice(),
"abz".as_bytes()
);
} | rust_cleaned_test_functions.jsonl/89153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
368,
341,
286,
1077,
1901,
76,
284,
1281,
44830,
2186,
543,
286,
2060,
10714,
33673,
310,
1901,
76,
4770,
198,
394,
659,
71141,
741,
394,
659,
455,
97994,
8734,
11478,
2099,
1,
370,
69,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map() {
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert((true, false), 4);
map.insert((false, false), 123);
let s = to_string(&map).unwrap();
s.starts_with("{");
s.contains("(true,false):4");
s.contains("(false,false):123");
s.ends_with("}");
} | rust_cleaned_test_functions.jsonl/2822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
368,
341,
286,
990,
1460,
486,
51137,
486,
18497,
401,
286,
1077,
5206,
2415,
284,
10528,
486,
931,
543,
286,
2415,
7030,
1188,
1866,
11,
895,
701,
220,
19,
317,
286,
2415,
7030,
1188,
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_epoch_slots_uncompressed_add_1() {
let mut slots = Uncompressed::new(1);
assert_eq!(slots.slots.capacity(), 8);
assert_eq!(slots.add(&[1]), 1);
assert_eq!(slots.to_slots(1), vec![1]);
assert!(slots.to_slots(2).is_empty());
} | rust_cleaned_test_functions.jsonl/116093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20682,
54161,
4907,
45703,
2891,
62,
16,
368,
341,
286,
1077,
5206,
15711,
284,
1230,
45703,
486,
931,
7,
16,
317,
286,
2060,
10714,
10297,
49767,
25101,
2412,
59168,
1507,
220,
23,
317,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_forced_checkout_locally_modified_tree() -> BitResult<()> {
BitRepo::with_sample_repo(|repo| {
touch!(repo: "dir/bar.l" < "modified");
bit_checkout!(repo: --force "master")?;
assert_eq!(cat!(repo: "dir/bar.l"), "");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
1998,
68186,
13400,
745,
37749,
11663,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
17491,
37784,
22428,
23476,
91,
341,
286,
5796,
10297,
23476,
25,
330,
3741,
49513,
918,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_register_gauge_trailing_comma() {
let opts = opts!("test_macro_gauge", "help",);
let res1 = register_gauge!(opts,);
assert!(res1.is_ok());
let res2 = register_gauge!("test_macro_gauge_2", "help",);
assert!(res2.is_ok());
} | rust_cleaned_test_functions.jsonl/86369 | {
"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,
14000,
1889,
19392,
3547,
14277,
2965,
1728,
368,
341,
262,
1077,
12185,
284,
12185,
17223,
1944,
58810,
1889,
19392,
497,
330,
8653,
497,
317,
262,
1077,
592,
16,
284,
4161,
1889,
19392,
10297,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aloha_locking() {
let dir = TempDir::new("segment_dir").unwrap();
let segment1 = build_segment_1(dir.path());
let segment2 = build_segment_2(dir.path());
let mut holder = SegmentHolder::default();
let sid1 = holder.add(segment1);
let sid2 = holder.add(segment2);
let locked_segment1 = holder.get(sid1).unwrap().get();
let locked_segment2 = holder.get(sid2).unwrap().clone();
let _read_lock_1 = locked_segment1.read();
let handler = thread::spawn(move || {
let lc = locked_segment2.get();
let _guard = lc.read();
thread::sleep(time::Duration::from_millis(100));
});
thread::sleep(time::Duration::from_millis(10));
holder
.aloha_random_write(&[sid1, sid2], |idx, _seg| {
assert_eq!(idx, sid2);
Ok(true)
})
.unwrap();
handler.join().unwrap();
} | rust_cleaned_test_functions.jsonl/115811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8418,
65083,
9818,
287,
368,
341,
286,
1077,
5419,
284,
19944,
6184,
486,
931,
445,
23169,
4334,
1827,
15454,
1428,
286,
1077,
10238,
16,
284,
1936,
28061,
62,
16,
14161,
3875,
1423,
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... | 2 |
#[test]
fn test_execute_select() {
let db = checked_memory_handle();
let err = db.execute("SELECT 1 WHERE 1 < ?", &[1i32]).unwrap_err();
if err != Error::ExecuteReturnedResults {
panic!("Unexpected error: {}", err);
}
} | rust_cleaned_test_functions.jsonl/25505 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
13051,
368,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
1077,
1848,
284,
2927,
7769,
445,
4858,
220,
16,
5288,
220,
16,
366,
42313,
44590,
16,
72,
18,
17,
10697,
15454,
9266... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_teq_reg_w() {
assert_eq!(
decode_32(0xea910f03),
Instruction::TEQ_reg {
params: Reg2ShiftNoSetFlagsParams {
rn: Reg::R1,
rm: Reg::R3,
shift_t: SRType::LSL,
shift_n: 0
}
}
);
} | rust_cleaned_test_functions.jsonl/64857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
528,
11006,
4920,
1670,
368,
341,
14808,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
56570,
24,
16,
15,
69,
15,
18,
1326,
286,
29051,
486,
2446,
48,
4920,
341,
310,
3628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_brace_escape() {
maybe_install_handler().unwrap();
let err = eyre!("unterminated ${{..}} expression");
assert_eq!("unterminated ${..} expression", err.to_string());
} | rust_cleaned_test_functions.jsonl/111497 | {
"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,
17682,
578,
21832,
368,
341,
262,
7196,
34245,
10183,
1005,
15454,
1428,
262,
1077,
1848,
284,
3912,
265,
17223,
359,
68659,
400,
2979,
496,
3417,
7493,
797,
262,
2060,
10714,
17223,
359,
68659,
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 |
#[test]
fn test_wrong_calling_convention() {
let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA")
.finish(Flags::new(builder()));
let mut context = Context::for_function(create_function(CallConv::SystemV, None));
context.compile(&*isa).expect("expected compilation");
assert_eq!(
create_unwind_info(&context.func, &*isa).expect("can create unwind info"),
None
);
} | rust_cleaned_test_functions.jsonl/10563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75198,
13429,
287,
3382,
7459,
368,
341,
286,
1077,
51335,
284,
18615,
7624,
3778,
17223,
87,
23,
21,
62,
21,
19,
5455,
310,
659,
17119,
445,
17119,
856,
23,
21,
84290,
1138,
310,
659,
30150,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_fail_2() {
#[derive(Debug, Clone, Copy, RpnFunction)]
#[rpn_function(args = 1)]
struct FnFoo;
impl FnFoo {
fn call(
_ctx: &mut EvalContext,
_payload: RpnFnCallPayload<'_>,
v: &Option<f64>,
) -> Result<Option<f64>> {
Ok(v.map(|v| v * 2.0))
}
}
// FnFoo only accepts 1 parameter but we will give 2.
let exp = RpnExpressionBuilder::new()
.push_constant(3.0f64)
.push_constant(1.5f64)
.push_fn_call(FnFoo, FieldTypeTp::Double)
.build();
let mut ctx = EvalContext::default();
let mut columns = LazyBatchColumnVec::empty();
let hooked_eval = ::panic_hook::recover_safe(|| {
let _ = exp.eval(&mut ctx, 3, &[], &mut columns);
});
assert!(hooked_eval.is_err());
} | rust_cleaned_test_functions.jsonl/111593 | {
"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,
21296,
22121,
62,
17,
368,
341,
1789,
286,
11506,
27098,
42618,
11,
27913,
11,
14540,
11,
431,
19958,
5152,
5563,
286,
11506,
81,
19958,
9174,
7356,
284,
220,
16,
5563,
286,
2036,
50182,
40923,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arguments_response_file() {
assert_eq!(CompilerArguments::CannotCache("@", None),
_parse_arguments(&stringvec!["-c", "foo.c", "@foo", "-o", "foo.o"]));
assert_eq!(CompilerArguments::CannotCache("@", None),
_parse_arguments(&stringvec!["-c", "foo.c", "-o", "@foo"]));
} | rust_cleaned_test_functions.jsonl/15026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
43433,
9655,
2458,
368,
341,
286,
2060,
10714,
10297,
38406,
19139,
486,
17444,
8233,
10662,
497,
2240,
1326,
4293,
716,
6400,
43433,
2099,
917,
4083,
0,
1183,
12,
66,
497,
330,
7975,
520,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part2_e() {
let input =
"#########
#G......#
#.E.#...#
#..##..G#
#...##..#
#...#...#
#.G...G.#
#.....G.#
#########";
assert_eq!(part2(&as_input(input)), 1140);
} | rust_cleaned_test_functions.jsonl/13281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
17,
2204,
368,
341,
286,
1077,
1946,
4035,
310,
330,
1357,
4956,
1797,
671,
38,
28149,
4956,
1797,
671,
13,
36,
43326,
1112,
4956,
1797,
671,
496,
565,
496,
38,
4956,
1797,
671,
1112,
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_merge_lrs_different_leader() {
let mut target = PartitionStatus::new((5000, 100, 110), vec![(5001, 95, 110).into()]);
let source = PartitionStatus::new((5001, 120, 120), vec![(5000, -1, -1).into()]);
target.merge(source);
assert_eq!(target.leader, (5001, 120, 120).into());
assert_eq!(target.replicas.len(), 1);
assert_eq!(target.replicas[0], (5000, 100, 110).into());
} | rust_cleaned_test_functions.jsonl/106844 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
907,
5428,
82741,
79991,
368,
341,
286,
1077,
5206,
2169,
284,
54626,
2522,
486,
931,
1188,
20,
15,
15,
15,
11,
220,
16,
15,
15,
11,
220,
16,
16,
15,
701,
7486,
0,
9697,
20,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_neuron_merge_follow() {
fn icp(amount: u64) -> u64 {
amount * 100_000_000
}
let n1_stake = icp(1);
let n2_stake = icp(10);
let n3_stake = icp(10);
let mut nns = NNSBuilder::new()
.set_economics(NetworkEconomics::with_default_values())
.with_supply(0) // causes minting account to be created
.add_account_for(principal(1), 0)
// the controller
.add_neuron(
NeuronBuilder::new(1, n1_stake, principal(1))
.set_dissolve_delay(MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS * 4),
)
// the source
.add_neuron(
NeuronBuilder::new(2, n2_stake, principal(1))
.set_dissolve_delay(MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS * 4)
.set_aging_since_timestamp(DEFAULT_TEST_START_TIMESTAMP_SECONDS)
.set_managers(Followees {
followees: vec![NeuronId { id: 1 }],
}),
)
// the target
.add_neuron(
NeuronBuilder::new(3, n3_stake, principal(1))
.set_dissolve_delay(MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS * 4)
.set_aging_since_timestamp(DEFAULT_TEST_START_TIMESTAMP_SECONDS)
.set_managers(Followees {
followees: vec![NeuronId { id: 1 }],
}),
)
.create();
nns.governance
.merge_neurons(
&NeuronId { id: 3 },
&principal(1),
&Merge {
source_neuron_id: Some(NeuronId { id: 2 }),
},
)
.now_or_never()
.unwrap()
.unwrap();
#[cfg(feature = "test")]
let fee = nns
.governance
.proto
.economics
.as_ref()
.unwrap()
.transaction_fee_e8s;
#[cfg(feature = "test")]
assert_changes!(
nns,
Changed::Changed(vec![
NNSStateChange::Accounts(vec![
MapChange::Changed(nns.get_neuron_account_id(2), U64Change(n2_stake, 0)),
MapChange::Changed(
nns.get_neuron_account_id(3),
U64Change(n3_stake, n3_stake + n2_stake - fee),
),
]),
NNSStateChange::GovernanceProto(vec![GovernanceChange::Neurons(vec![
MapChange::Changed(
2,
vec![NeuronChange::CachedNeuronStakeE8S(U64Change(n2_stake, 0)),],
),
MapChange::Changed(
3,
vec![NeuronChange::CachedNeuronStakeE8S(U64Change(
n3_stake,
n3_stake + n2_stake - fee,
)),],
),
])]),
])
);
} | rust_cleaned_test_functions.jsonl/42935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
36090,
20888,
43490,
368,
341,
262,
5168,
17902,
79,
33989,
25,
575,
21,
19,
8,
1464,
575,
21,
19,
341,
286,
3311,
353,
220,
16,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
198,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dead_fork_entry_deserialize_failure() {
// Insert entry that causes deserialization failure
let res = check_dead_fork(|_, bank| {
let gibberish = [0xa5u8; PACKET_DATA_SIZE];
let mut data_header = DataShredHeader::default();
data_header.flags |= DATA_COMPLETE_SHRED;
// Need to provide the right size for Shredder::deshred.
data_header.size = SIZE_OF_DATA_SHRED_PAYLOAD as u16;
data_header.parent_offset = (bank.slot() - bank.parent_slot()) as u16;
let shred_common_header = ShredCommonHeader {
slot: bank.slot(),
..ShredCommonHeader::default()
};
let mut shred = Shred::new_empty_from_header(
shred_common_header,
data_header,
CodingShredHeader::default(),
);
bincode::serialize_into(
&mut shred.payload[SIZE_OF_COMMON_SHRED_HEADER + SIZE_OF_DATA_SHRED_HEADER..],
&gibberish[..SIZE_OF_DATA_SHRED_PAYLOAD],
)
.unwrap();
vec![shred]
});
assert_matches!(
res,
Err(BlockstoreProcessorError::FailedToLoadEntries(
BlockstoreError::InvalidShredData(_)
),)
);
} | rust_cleaned_test_functions.jsonl/25810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53427,
761,
669,
9078,
15768,
9050,
43618,
368,
341,
286,
442,
17101,
4343,
429,
11137,
939,
50563,
7901,
198,
286,
1077,
592,
284,
1779,
53427,
761,
669,
22428,
6878,
6073,
91,
341,
310,
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_gte() {
let a: Array = [0, 1, 2][..].into();
let b: Array = [1][..].into();
assert_eq!(a.gte(&b), [false, true, true][..].into());
assert_eq!(a.gte_const(Number::from(1)), [false, true, true][..].into());
} | rust_cleaned_test_functions.jsonl/45226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
665,
368,
341,
286,
1077,
264,
25,
2910,
284,
508,
15,
11,
220,
16,
11,
220,
17,
1457,
496,
936,
18122,
543,
286,
1077,
293,
25,
2910,
284,
508,
16,
1457,
496,
936,
18122,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_in_memory_io() {
let input: &[u8] = b"50 8";
let mut scan = Scanner::new(input);
let mut out = vec![];
solve(&mut scan, &mut out);
assert_eq!(out, b"50 - 8 = 42\n");
} | rust_cleaned_test_functions.jsonl/129557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
19195,
16939,
368,
341,
286,
1077,
1946,
25,
44590,
84,
23,
60,
284,
293,
1,
20,
15,
220,
23,
876,
286,
1077,
5206,
8569,
284,
17170,
486,
931,
5384,
317,
286,
1077,
5206,
700,
284,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reset_current() {
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 bank = Arc::new(Bank::new_for_tests(&genesis_config));
let (mut poh_recorder, _entry_receiver, _record_receiver) = PohRecorder::new(
0,
Hash::default(),
bank.clone(),
Some((4, 4)),
DEFAULT_TICKS_PER_SLOT,
&Pubkey::default(),
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::default()),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
poh_recorder.tick();
poh_recorder.tick();
assert_eq!(poh_recorder.tick_cache.len(), 2);
poh_recorder.reset(bank, Some((4, 4)));
assert_eq!(poh_recorder.tick_cache.len(), 0);
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/106269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18983,
11080,
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,
50704,
2638,
340,
394,
659,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_characteristic_number() {
assert_eq!(find_characteristic_number("Device Name"), Some(CHARACTERISTIC_NUMBERS[0]));
assert_eq!(find_characteristic_number("aPPEARANCE"), Some(CHARACTERISTIC_NUMBERS[1]));
assert_eq!(find_characteristic_number("fake characteristic name"), None);
assert_eq!(find_characteristic_number("2a00"), Some(CHARACTERISTIC_NUMBERS[0]));
assert_eq!(find_characteristic_number("zzzz"), None);
} | rust_cleaned_test_functions.jsonl/46713 | {
"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,
21814,
40988,
4532,
5500,
368,
341,
286,
2060,
10714,
10297,
3903,
40988,
4532,
5500,
445,
6985,
3988,
3975,
4329,
7,
15237,
37397,
82556,
9631,
44116,
58,
15,
14382,
286,
2060,
10714,
10297,
3903,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_phishtank_client() {
let client = PhishtankClient::new("someapikey");
assert_eq!(client.api_key, "someapikey");
assert_eq!(client.data_endpoint, "https://data.phishtank.com/data");
assert_eq!(
client.check_endpoint,
"https://checkurl.phishtank.com/checkurl/"
);
} | rust_cleaned_test_functions.jsonl/21338 | {
"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,
9782,
285,
426,
1180,
8179,
368,
341,
286,
1077,
2943,
284,
2350,
285,
426,
1180,
2959,
486,
931,
445,
14689,
72174,
797,
286,
2060,
10714,
10297,
2972,
6183,
3097,
11,
330,
14689,
72174,
797,
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_empty_df_hstack() -> Result<()> {
let mut base = df!(
"a" => [1, 2, 3],
"b" => [1, 2, 3]
)?;
let mut df = base.slice(0, 0);
let out = df.with_column(Series::new("c", [1]))?;
assert_eq!(out.shape(), (0, 3));
assert!(out.iter().all(|s| s.len() == 0));
// no columns
base.columns = vec![];
let out = base.with_column(Series::new("c", [1]))?;
assert_eq!(out.shape(), (1, 1));
Ok(())
} | rust_cleaned_test_functions.jsonl/103189 | {
"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,
15124,
10894,
1523,
7693,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
2331,
284,
6764,
33673,
310,
330,
64,
1,
589,
508,
16,
11,
220,
17,
11,
220,
18,
1259,
310,
330,
65,
1,
589,
508,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_debug_clone_partialeq() {
let backend = Backend::new(0_usize);
// Test Debug trait
assert_eq!(format!("{:?}", backend), "Backend { number_qubits: 0 }");
// Test Clone trait
assert_eq!(backend.clone(), backend);
// PartialEq
let backend_0 = Backend::new(0_usize);
let backend_2 = Backend::new(2_usize);
assert!(backend_0 == backend);
assert!(backend == backend_0);
assert!(backend_2 != backend);
assert!(backend != backend_2);
} | rust_cleaned_test_functions.jsonl/13554 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
54742,
10495,
19893,
80,
368,
341,
262,
1077,
19163,
284,
55260,
486,
931,
7,
15,
11306,
551,
626,
262,
442,
3393,
11091,
17567,
198,
262,
2060,
10714,
10297,
2243,
88928,
25,
52652,
19163,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compression() {
let bytes = include_bytes!("../../test_data/sign/psbt_bip.json");
let (psbt_ser, _) = extract_psbt(bytes);
let mut e = ZlibEncoder::new(Vec::new(), Compression::best());
e.write_all(&psbt_ser).unwrap();
let compressed_bytes = e.finish().unwrap();
assert_eq!(psbt_ser.len(), 903);
assert_eq!(compressed_bytes.len(), 722);
let bytes = include_bytes!("../../test_data/sign/psbt_bip.signed.json");
let (psbt_ser, _) = extract_psbt(bytes);
let mut e = ZlibEncoder::new(Vec::new(), Compression::best());
e.write_all(&psbt_ser).unwrap();
let compressed_bytes = e.finish().unwrap();
assert_eq!(psbt_ser.len(), 1583);
assert_eq!(compressed_bytes.len(), 1192);
} | rust_cleaned_test_functions.jsonl/129314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
4011,
368,
341,
286,
1077,
5820,
284,
2924,
12524,
17223,
2748,
1944,
1769,
35763,
14,
1690,
12755,
880,
573,
4323,
797,
286,
1077,
320,
1690,
12755,
75861,
11,
27439,
284,
8649,
26047,
1275... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zmq_unencrypted() {
let inet1 = IpAddr::from_str("127.0.0.1").unwrap();
let inet2 = IpAddr::from_str("127.0.0.2").unwrap();
let locator1 =
PartialNodeAddr::ZmqTcpUnencrypted(ZmqType::Push, inet1, None);
let locator2 =
PartialNodeAddr::ZmqTcpUnencrypted(ZmqType::Req, inet2, None);
let locator3 =
PartialNodeAddr::ZmqTcpUnencrypted(ZmqType::Pull, inet1, None);
let locator4 =
PartialNodeAddr::ZmqTcpUnencrypted(ZmqType::Rep, inet2, None);
assert_ne!(locator1, locator2);
assert_ne!(locator2, locator4);
assert_ne!(locator1, locator3);
assert_eq!(locator1, locator1.clone());
assert_eq!(locator2, locator2.clone());
assert_eq!(locator1.url_scheme(), "lnpz");
assert_eq!(locator1.node_id(), None);
assert_eq!(locator1.port(), None);
assert_eq!(locator1.api_type(), Some(ZmqType::Push));
assert_eq!(locator1.inet_addr(), Some(InetAddr::from(inet1)));
let locator_with_port = locator1.with_port(24);
assert_eq!(locator_with_port.port(), Some(24));
assert_eq!(
RemoteNodeAddr::try_from(locator1.clone()),
Err(AddrError::Unsupported("Given PartialNodeAddr type can't be converted into RemoteNodeAddr"))
);
assert_eq!(
RemoteNodeAddr::try_from(locator_with_port.clone()),
Err(AddrError::Unsupported("Given PartialNodeAddr type can't be converted into RemoteNodeAddr"))
);
assert_eq!(locator1.to_url_string(), "lnpz://127.0.0.1/?api=p2p");
assert_eq!(locator2.to_url_string(), "lnpz://127.0.0.2/?api=rpc");
assert_eq!(
locator_with_port.to_url_string(),
"lnpz://127.0.0.1:24/?api=p2p"
);
#[cfg(feature = "url")]
{
assert_eq!(
PartialNodeAddr::from_str("lnpz://127.0.0.1/?api=p2p").unwrap(),
locator1
);
}
} | rust_cleaned_test_functions.jsonl/117290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1065
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
27674,
4907,
36444,
368,
341,
286,
1077,
49476,
16,
284,
35033,
13986,
486,
1499,
2895,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
1827,
15454,
543,
286,
1077,
49476,
17,
284,
35033,
13986... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sync_list_v1() -> anyhow::Result<()> {
env_logger::builder().is_test(true).try_init().ok();
#[derive(Debug, Default)]
struct FakeHttpCaller {
counter: AtomicUsize,
}
impl HttpCaller for FakeHttpCaller {
fn call(&self, request: &mut SyncRequest<'_>) -> SyncResponseResult {
let n = self.counter.fetch_add(1, Ordering::SeqCst);
let body = match n {
0 => {
assert!(request
.url()
.to_string()
.ends_with("/list?bucket=fakebucketname&limit=1000"));
SyncResponseBody::from_bytes(
json_to_vec(&json!({
"marker": "fakemarker",
"items": [{
"key": "fakeobj1",
"put_time": generate_put_time(),
"hash": "fakeobj1hash",
"fsize": 1usize,
"mime_type": "text/plain",
}, {
"key": "fakeobj2",
"put_time": generate_put_time(),
"hash": "fakeobj2hash",
"fsize": 2usize,
"mime_type": "text/plain",
}]
}))
.unwrap(),
)
}
1 => {
assert!(request
.url()
.to_string()
.ends_with("/list?bucket=fakebucketname&marker=fakemarker&limit=1000"));
SyncResponseBody::from_bytes(
json_to_vec(&json!({
"marker": "",
"items": [{
"key": "fakeobj3",
"put_time": generate_put_time(),
"hash": "fakeobj3hash",
"fsize": 3usize,
"mime_type": "text/plain",
}, {
"key": "fakeobj4",
"put_time": generate_put_time(),
"hash": "fakeobj4hash",
"fsize": 4usize,
"mime_type": "text/plain",
}]
}))
.unwrap(),
)
}
_ => unreachable!(),
};
Ok(SyncResponse::builder()
.status_code(StatusCode::OK)
.header("x-reqid", HeaderValue::from_static("FakeReqid"))
.body(body)
.build())
}
#[cfg(feature = "async")]
fn async_call(&self, _request: &mut AsyncRequest<'_>) -> BoxFuture<AsyncResponseResult> {
unreachable!()
}
}
let mut counter = 0usize;
for (i, entry) in get_bucket(FakeHttpCaller::default())
.list()
.version(ListVersion::V1)
.iter()
.enumerate()
{
counter += 1;
let entry = entry?;
assert_eq!(entry.get_key_as_str(), &format!("fakeobj{}", i + 1));
assert_eq!(entry.get_hash_as_str(), &format!("fakeobj{}hash", i + 1));
assert_eq!(entry.get_size_as_u64(), i as u64 + 1);
}
assert_eq!(counter, 4usize);
Ok(())
} | rust_cleaned_test_functions.jsonl/61338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2728
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23008,
2019,
2273,
16,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
6105,
27413,
486,
17850,
1005,
285,
4452,
3715,
568,
1539,
6137,
1005,
562,
1428,
286,
11506,
27098,
42618,
11,
7899,
5563,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strict_mode_dup_func_parameters() {
// Checks that a function cannot contain duplicate parameter
let scenario = r#"
'use strict';
function f(a, b, b) {}
"#;
let mut context = Context::new();
let string = dbg!(forward(&mut context, scenario));
assert!(string.starts_with("Uncaught \"SyntaxError\": "));
} | rust_cleaned_test_functions.jsonl/39567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
849,
7302,
51932,
9596,
18263,
368,
341,
262,
442,
24843,
429,
264,
729,
4157,
6644,
22513,
5733,
87079,
262,
1077,
15048,
284,
435,
2,
698,
262,
364,
810,
7304,
1010,
262,
729,
282,
2877,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pause_bg_work() {
let path = TempDir::new("_rust_rocksdb_pause_bg_work").expect("");
let db = DB::open_default(path.path().to_str().unwrap()).unwrap();
let db = Arc::new(db);
let db1 = db.clone();
let builder = thread::Builder::new().name(String::from("put-thread"));
let h = builder
.spawn(move || {
db1.put(b"k1", b"v1").unwrap();
db1.put(b"k2", b"v2").unwrap();
db1.flush(true).unwrap();
db1.compact_range(None, None);
})
.unwrap();
// Wait until all currently running background processes finish.
db.pause_bg_work();
assert_eq!(
db.get_property_int("rocksdb.num-running-compactions")
.unwrap(),
0
);
assert_eq!(
db.get_property_int("rocksdb.num-running-flushes").unwrap(),
0
);
db.continue_bg_work();
h.join().unwrap();
} | rust_cleaned_test_functions.jsonl/99618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59989,
23122,
11498,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
35788,
26608,
14553,
1999,
59989,
23122,
11498,
1827,
17119,
13056,
286,
1077,
2927,
284,
5952,
486,
2508,
9993,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unit_or_join_doesnt_flatten() {
let schema = prepopulated_schema();
let known = Known::for_schema(&schema);
let query = r#"[:find ?x
:where [?x :foo/knows ?y]
(or-join [?x] [?x :foo/parent ?y])]"#;
let cc = alg(known, query);
let vx = Variable::from_valid_name("?x");
let vy = Variable::from_valid_name("?y");
let d0 = "causets00".to_string();
let c0 = "c00".to_string();
let c0x = QualifiedAlias::new(c0.clone(), VariableColumn::Variable(vx.clone()));
let d0e = QualifiedAlias::new(d0.clone(), causetsColumn::Causets);
let d0a = QualifiedAlias::new(d0.clone(), causetsColumn::Attribute);
let d0v = QualifiedAlias::new(d0.clone(), causetsColumn::Value);
let knows = QueryValue::Causetid(66);
assert!(!cc.is_known_empty());
assert_eq!(cc.wheres, ColumnIntersection(vec![
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::Equals(d0a.clone(), knows.clone())),
// different things in each place.
ColumnConstraintOrAlternation::Constraint(ColumnConstraint::Equals(d0e.clone(), QueryValue::Column(c0x.clone()))),
]));
assert_eq!(cc.column_bindings.get(&vx), Some(&vec![d0e, c0x]));
// ?y does not have a binding in the `or-join` parity_filter.
assert_eq!(cc.column_bindings.get(&vy), Some(&vec![d0v]));
assert_eq!(cc.from, vec![SourceAlias(causetsTable::causets, d0),
SourceAlias(causetsTable::Computed(0), c0)]);
} | rust_cleaned_test_functions.jsonl/44229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 798
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14832,
8734,
31017,
96374,
406,
5081,
14456,
368,
341,
286,
1077,
10802,
284,
855,
8374,
7757,
25371,
543,
286,
1077,
3881,
284,
48286,
486,
1958,
25371,
2099,
17349,
317,
286,
1077,
3239,
284,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let (process, port) = named_process();
let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port);
let conn = UdpClientConnection::new(socket).unwrap();
let client = create_sig0_ready_client(conn);
let origin = Name::from_str("example.com.").unwrap();
// create a record
let mut record = Record::with(
Name::from_str("new.example.com.").unwrap(),
RecordType::A,
Duration::minutes(5).num_seconds() as u32,
);
record.set_rdata(RData::A(Ipv4Addr::new(100, 10, 100, 10)));
let result = client
.create(record.clone(), origin.clone())
.expect("create failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
let result = client
.query(record.name(), record.dns_class(), record.rr_type())
.expect("query failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
assert_eq!(result.answers().len(), 1);
assert_eq!(result.answers()[0], record);
// trying to create again should error
// TODO: it would be cool to make this
let result = client
.create(record.clone(), origin.clone())
.expect("create failed");
assert_eq!(result.response_code(), ResponseCode::YXRRSet);
// will fail if already set and not the same value.
let mut record = record;
record.set_rdata(RData::A(Ipv4Addr::new(101, 11, 101, 11)));
let result = client.create(record, origin).expect("create failed");
assert_eq!(result.response_code(), ResponseCode::YXRRSet);
} | rust_cleaned_test_functions.jsonl/96283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 623
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
368,
341,
262,
1077,
320,
4630,
11,
2635,
8,
284,
6941,
11305,
543,
262,
1077,
7575,
284,
20954,
13986,
486,
931,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
486,
931,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_operator() {
equal_tokens! {
<nodes>
">" -> b::token_list(vec![b::op(">")])
}
equal_tokens! {
<nodes>
">=" -> b::token_list(vec![b::op(">=")])
}
equal_tokens! {
<nodes>
"<" -> b::token_list(vec![b::op("<")])
}
equal_tokens! {
<nodes>
"<=" -> b::token_list(vec![b::op("<=")])
}
equal_tokens! {
<nodes>
"==" -> b::token_list(vec![b::op("==")])
}
equal_tokens! {
<nodes>
"!=" -> b::token_list(vec![b::op("!=")])
}
} | rust_cleaned_test_functions.jsonl/5857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40594,
368,
341,
286,
6144,
28838,
0,
341,
310,
366,
20008,
397,
310,
90013,
1464,
293,
486,
5839,
2019,
25592,
20703,
65,
486,
453,
63853,
899,
2546,
286,
555,
286,
6144,
28838,
0,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_cow_str() {
assert_eq!(
TinyString::<[u8; 16]>::from(Cow::Borrowed("string")),
"string"
);
assert_eq!(
TinyString::<[u8; 16]>::from(Cow::Owned(String::from("string"))),
"string"
);
} | rust_cleaned_test_functions.jsonl/3620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
666,
363,
2895,
368,
341,
6948,
10714,
33673,
197,
10261,
6441,
703,
27638,
58,
84,
23,
26,
220,
16,
21,
60,
6831,
1499,
3025,
363,
486,
33,
7768,
291,
445,
917,
30154,
197,
197,
1,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_memory_read_and_write_byte() {
// given
let mem: &mut dyn Memory = &mut vec![];
mem.resize(32);
// when
mem.write_byte(U256::from(0x1d), U256::from(0xab));
mem.write_byte(U256::from(0x1e), U256::from(0xcd));
mem.write_byte(U256::from(0x1f), U256::from(0xef));
// then
assert_eq!(mem.read(U256::from(0x00)), U256::from(0xabcdef));
} | rust_cleaned_test_functions.jsonl/18677 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19195,
6443,
8378,
9165,
19737,
368,
341,
197,
197,
322,
2661,
198,
197,
10217,
1833,
25,
609,
6984,
31070,
13850,
284,
609,
6984,
7486,
0,
15078,
197,
14145,
17382,
7,
18,
17,
626,
197,
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_right_binary() {
let cases = vec![
(
Datum::Bytes(b"hello".to_vec()),
Datum::I64(-1),
Datum::Bytes(b"".to_vec()),
),
(
Datum::Bytes(b"hello".to_vec()),
Datum::I64(0),
Datum::Bytes(b"".to_vec()),
),
(
Datum::Bytes(b"hello".to_vec()),
Datum::I64(1),
Datum::Bytes(b"o".to_vec()),
),
(
Datum::Bytes(b"hello".to_vec()),
Datum::I64(5),
Datum::Bytes(b"hello".to_vec()),
),
(
Datum::Bytes(b"hello".to_vec()),
Datum::I64(6),
Datum::Bytes(b"hello".to_vec()),
),
(
Datum::Bytes(b"hello".to_vec()),
Datum::U64(u64::max_value()),
Datum::Bytes(b"hello".to_vec()),
),
(
Datum::Bytes(b"\x61\x76\x5e".to_vec()),
Datum::I64(1),
Datum::Bytes(b"\x5e".to_vec()),
),
];
for (input, length, exp) in cases {
let got = eval_func(ScalarFuncSig::RightBinary, &[input, length]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/9128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 922
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10539,
31761,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
68459,
486,
7078,
1883,
1,
14990,
3263,
983,
13251,
14702,
394,
68459,
486,
40,
21,
19,
4080,
16,
1326,
394,
68459,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bbox2_max_extent() {
let bbox = BBox2::new(Point2::new(1, 0), Point2::new(0, 10));
assert!(bbox.max_extent() == 1);
let bbox = BBox2::new(Point2::new(100, 0), Point2::new(0, 10));
assert!(bbox.max_extent() == 0);
} | rust_cleaned_test_functions.jsonl/133235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59390,
17,
6345,
70102,
368,
341,
286,
1077,
29749,
284,
425,
1611,
17,
486,
931,
32737,
17,
486,
931,
7,
16,
11,
220,
15,
701,
5126,
17,
486,
931,
7,
15,
11,
220,
16,
15,
1106,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_expr_without_name_matches() -> Result<()> {
set_rustflags();
let expr = FilteringExpr::parse(
"test(test_multiply_two) | test(=tests::call_dylib_add_two)",
&*PACKAGE_GRAPH,
)
.expect("filter expression is valid");
let test_filter =
TestFilterBuilder::new(RunIgnored::Default, None, Vec::<String>::new(), vec![expr]);
let test_list = FIXTURE_TARGETS.make_test_list(&test_filter, &TargetRunner::empty());
for test in test_list.iter_tests() {
if test.name.contains("test_multiply_two") || test.name == "tests::call_dylib_add_two" {
assert!(
test.test_info.filter_match.is_match(),
"expected test {test:?} to be a match, but it isn't"
);
} else {
assert!(
!test.test_info.filter_match.is_match(),
"expected test {test:?} to not be a match, but it is"
)
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/118816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
21915,
39904,
1269,
38344,
368,
1464,
5714,
71698,
341,
262,
738,
1710,
590,
11161,
1428,
262,
1077,
15169,
284,
81531,
16041,
486,
6400,
1006,
286,
330,
1944,
8623,
93054,
23241,
8,
760,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_new() {
let mut context = get_context(3_600_000_000_000, false);
testing_env!(context.clone());
let contract = Place::new();
context.is_view = true;
testing_env!(context.clone());
assert_eq!(contract.get_pixel_cost().0, PIXEL_COST);
assert_eq!(
contract.get_line_versions(),
vec![0u32; BOARD_HEIGHT as usize]
);
} | rust_cleaned_test_functions.jsonl/79117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
7,
18,
62,
21,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
11,
895,
317,
286,
7497,
15879,
10297,
2147,
15997,
1423,
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_stable_compatibility() {
if env::var_os("FORCE_STATIC").is_none() && fs::metadata(STATIC_PATH).is_err() {
// run if static files aren't present unless we know they should be.
return;
}
// Ensure we can parse all output from all Linux stable releases.
for v in 0..DATES.len() {
let (version, date) = (&format!("1.{}.0", v), Some(DATES[v]));
check_terse_parse!(read_static(false, "stable", v) => version, date,);
check_verbose_parse!(read_static(true, "stable", v) => version, date,);
}
} | rust_cleaned_test_functions.jsonl/79906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
480,
2965,
53053,
368,
341,
286,
421,
6105,
486,
947,
29387,
445,
80205,
31352,
1827,
285,
31488,
368,
1009,
8619,
486,
17637,
7,
40881,
7944,
568,
285,
9266,
368,
341,
3374,
310,
442,
159... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cpu() {
let mut m = MockMachine {
cpu: Cpu::new(),
bus: MockBus { addr: 0, value: 0 },
symtab: symtab::Symtab::prepopulated(),
};
for i in 0..32 {
assert_eq!(m.cpu.regs[i], 0);
}
m.exec("(nop)");
for i in 0..32 {
assert_eq!(m.cpu.regs[i], 0);
}
// Test I computation
m.exec("(addi t0 t0 1)");
assert_eq!(m.reg_from_name("t0"), 1, "addi 1");
m.exec("(addi t0 t0 0xF0)");
assert_eq!(m.reg_from_name("t0"), 0xF1, "addi 0xF0");
m.exec("(slti t1 t0 1)");
assert_eq!(m.reg_from_name("t1"), 0, "slti false");
m.exec("(slti t1 t0 0xFF)");
assert_eq!(m.reg_from_name("t1"), 1, "slti true");
m.exec("(ori t2 t0 0x765)");
assert_eq!(m.reg_from_name("t2"), 0x7F5, "ori");
m.exec("(slli t2 t2 4)");
assert_eq!(m.reg_from_name("t2"), 0x7F50, "slli");
// Test U instructions
m.exec("(lui t2 0x12345678)");
assert_eq!(m.reg_from_name("t2"), 0x12345000, "lui");
m.cpu.pc = 0x1C;
m.exec("(auipc t2 0x23456789)");
assert_eq!(m.reg_from_name("t2"), 0x2345601C, "auipc");
// Test R computation
m.exec("(li t0 5)");
assert_eq!(m.reg_from_name("t0"), 5, "li");
m.exec("(mv t1 t0)");
assert_eq!(m.reg_from_name("t1"), 5, "mv");
m.exec("(add t0 t0 t1)");
assert_eq!(m.reg_from_name("t0"), 10, "add");
m.exec("(li t3 3)");
m.exec("(sub t0 t0 t3)");
assert_eq!(m.reg_from_name("t0"), 7, "sub");
m.exec("(sll t2 t0 t1)");
assert_eq!(m.reg_from_name("t2"), 224, "sll");
// Test JAL
m.cpu.pc = 0x100;
m.exec("(jal t0 0x1234)");
assert_eq!(m.reg_from_name("t0"), 0x104, "jal rd");
assert_eq!(m.cpu.pc, 0x1334, "jal pc");
// Test conditional branches
m.exec("(li t1 0)");
m.cpu.pc = 0;
m.exec("(beq t1 zero 0x120)");
assert_eq!(m.cpu.pc, 0x120, "beq");
m.exec("(li t1 5)");
m.cpu.pc = 0;
m.exec("(blt t1 zero 0x120)");
assert_eq!(m.cpu.pc, 0x4, "blt false");
// Test Load and Store
let there: u32 = 0x450;
m.symtab.register_label("there", there);
// TODO: Note that parameter order for store is not good
m.exec("(li t1 0x123)");
m.exec("(sw zero t1 there)");
assert_eq!(m.bus.addr, there, "sw addr");
assert_eq!(m.bus.value, 0x123, "sw value");
m.exec("(lw t0 zero there)");
assert_eq!(m.reg_from_name("t0"), 0x123, "lw");
} | rust_cleaned_test_functions.jsonl/9272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21795,
368,
1476,
262,
1077,
5206,
296,
284,
14563,
21605,
341,
286,
17319,
25,
356,
5584,
486,
931,
3148,
286,
5828,
25,
14563,
15073,
314,
10789,
25,
220,
15,
11,
897,
25,
220,
15,
1153,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_substitute_lambdas() {
// [x -> s]x = s
let exp = parse(&lexpr::from_str("x").unwrap()).unwrap();
let match_exp = "x";
let replace_with = parse(&lexpr::from_str("s").unwrap()).unwrap();
let expected = parse(&lexpr::from_str("s").unwrap()).unwrap();
assert_eq!(
substitute(&exp, match_exp, &replace_with).unwrap(),
expected
);
// [x -> s]y = y if y != x
let exp = parse(&lexpr::from_str("y").unwrap()).unwrap();
let match_exp = "x";
let replace_with = parse(&lexpr::from_str("s").unwrap()).unwrap();
let expected = parse(&lexpr::from_str("y").unwrap()).unwrap();
assert_eq!(
substitute(&exp, match_exp, &replace_with).unwrap(),
expected
);
let exp = parse(&lexpr::from_str("(lambda ((y : int)) : int (+ x y))").unwrap()).unwrap();
let match_exp = "x";
let replace_with = parse(&lexpr::from_str("s").unwrap()).unwrap();
let expected =
parse(&lexpr::from_str("(lambda ((y : int)) : int (+ s y))").unwrap()).unwrap();
assert_eq!(
substitute(&exp, match_exp, &replace_with).unwrap(),
expected
);
let exp = parse(&lexpr::from_str("(lambda ((x : int)) : int (+ x y))").unwrap()).unwrap();
let match_exp = "x";
let replace_with = parse(&lexpr::from_str("s").unwrap()).unwrap();
let expected =
parse(&lexpr::from_str("(lambda ((x : int)) : int (+ x y))").unwrap()).unwrap();
assert_eq!(
substitute(&exp, match_exp, &replace_with).unwrap(),
expected
);
let exp = parse(&lexpr::from_str("(lambda ((x : int)) : int x)").unwrap()).unwrap();
let match_exp = "x";
let replace_with = parse(&lexpr::from_str("y").unwrap()).unwrap();
let expected = parse(&lexpr::from_str("(lambda ((x : int)) : int x)").unwrap()).unwrap();
assert_eq!(
substitute(&exp, match_exp, &replace_with).unwrap(),
expected
);
let exp = parse(&lexpr::from_str("(lambda ((z : int)) : int x)").unwrap()).unwrap();
let match_exp = "x";
let replace_with = parse(&lexpr::from_str("z").unwrap()).unwrap();
let _expected =
parse(&lexpr::from_str("(lambda ((temp0 : int)) : int z)").unwrap()).unwrap();
assert_eq!(substitute(&exp, match_exp, &replace_with).is_err(), true);
// This fails because our substitute method does not change type annotations etc.
// let match_exp = "x";
// let replace_with =
// let expected = parse(
// assert_eq!(
// expected
} | rust_cleaned_test_functions.jsonl/62139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
7660,
907,
2969,
34889,
368,
341,
286,
442,
508,
87,
1464,
274,
60,
87,
284,
274,
198,
286,
1077,
1343,
284,
4715,
2099,
2571,
649,
486,
1499,
2895,
445,
87,
1827,
15454,
6011,
15454,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stream_lookup_faulty() {
let spec = "input a: UInt8\n output b: Float64 := a";
assert_eq!(1, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
27464,
70097,
88,
368,
341,
286,
1077,
1398,
284,
330,
1355,
264,
25,
22275,
23,
1699,
2550,
293,
25,
13001,
21,
19,
1669,
264,
876,
286,
2060,
10714,
10297,
16,
11,
1629,
1819,
20196,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_file_pattern_match() {
let patts = ["README.md", "*.iml", ".packages"];
assert_eq!(file_pattern_match("test.iml", &patts), true);
assert_eq!(file_pattern_match("test.txt", &patts), false);
assert_eq!(file_pattern_match("README.md", &patts), true);
assert_eq!(file_pattern_match("README.txt", &patts), false);
assert_eq!(file_pattern_match(".packages", &patts), true);
assert_eq!(file_pattern_match(".iml", &patts), false);
} | rust_cleaned_test_functions.jsonl/49959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
21260,
10708,
368,
341,
286,
1077,
281,
20983,
284,
4383,
54675,
21324,
497,
59128,
318,
75,
497,
5933,
43141,
6332,
286,
2060,
10714,
10297,
1192,
21260,
10708,
445,
1944,
12053,
75,
497,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_rate_limiting() {
let bucket_size = 5;
let bucket_rate = 3;
let key = "Key";
let rate_limiter = TokenBucketRateLimiter::test(bucket_size, bucket_rate);
let bucket_arc = rate_limiter.bucket(key);
let mut bucket = bucket_arc.lock();
let result = bucket.acquire_all_tokens(bucket_size + 1);
assert!(result.expect_err("Should not give tokens").is_none());
// Normal case
let result = bucket.acquire_all_tokens(bucket_size);
result.expect("Should be successful");
// Test future wait
let result = bucket.acquire_all_tokens(bucket_size);
let wait_time = result
.expect_err("Should not succeed, but will in future")
.expect("Should have a time it succeeds");
sleep(wait_time.duration_since(Instant::now()));
let result = bucket.acquire_all_tokens(bucket_size);
result.expect("Should be successful");
} | rust_cleaned_test_functions.jsonl/129419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 434
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
9246,
14763,
287,
368,
341,
286,
1077,
15621,
2368,
284,
220,
20,
280,
286,
1077,
15621,
9246,
284,
220,
18,
280,
286,
1077,
1376,
284,
330,
1592,
876,
286,
1077,
4379,
907,
17700,
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_transaction_updates_inspect() {
let inspector = fuchsia_inspect::Inspector::new();
let node = inspector.root().create_child("rewrite_manager");
let dynamic_config = make_rule_config(vec![]);
let mut manager =
RewriteManagerBuilder::new(Some(&dynamic_config)).unwrap().inspect_node(node).build();
assert_data_tree!(
inspector,
root: {
rewrite_manager: {
dynamic_rules: {},
dynamic_rules_path: format!("{:?}", Some(&*dynamic_config)),
static_rules: {},
generation: 0u64,
}
}
);
let mut transaction = manager.transaction();
transaction
.add(rule!("example.com" => "example.org", "/this_rolldice/" => "/that_rolldice/"));
manager.apply(transaction).unwrap();
assert_data_tree!(
inspector,
root: {
rewrite_manager: {
dynamic_rules: {
"0": {
host_match: "example.com",
host_replacement: "example.org",
path_prefix_match: "/this_rolldice/",
path_prefix_replacement: "/that_rolldice/",
},
},
dynamic_rules_path: format!("{:?}", Some(&*dynamic_config)),
static_rules: {},
generation: 1u64,
}
}
);
} | rust_cleaned_test_functions.jsonl/46506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 920
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
57829,
34386,
987,
368,
341,
286,
1077,
44725,
284,
282,
73391,
34386,
987,
486,
46230,
486,
931,
543,
286,
1077,
2436,
284,
44725,
12576,
1005,
3182,
17268,
445,
52473,
12144,
797,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_latin1_to_utf16() {
let mut src: Vec<u8> = Vec::with_capacity(256);
src.resize(256, 0);
let mut reference: Vec<u16> = Vec::with_capacity(256);
reference.resize(256, 0);
for i in 0..256 {
src[i] = i as u8;
reference[i] = i as u16;
}
let mut dst: Vec<u16> = Vec::with_capacity(src.len());
dst.resize(src.len(), 0);
convert_latin1_to_utf16(&src[..], &mut dst[..]);
assert_eq!(dst, reference);
} | rust_cleaned_test_functions.jsonl/27311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
907,
14768,
16,
2346,
39453,
16,
21,
368,
341,
286,
1077,
5206,
2286,
25,
11312,
34837,
23,
29,
284,
11312,
486,
4197,
35603,
7,
17,
20,
21,
317,
286,
2286,
17382,
7,
17,
20,
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... | 2 |
#[test]
fn test_select_cert_alpn_extension() {
let mut server = Server::builder();
let alpn_extension = std::sync::Arc::new(std::sync::Mutex::new(None));
server.ctx().set_select_certificate_callback({
let alpn = alpn_extension.clone();
move |client_hello| {
*alpn.lock().unwrap() = Some(
client_hello
.get_extension(ExtensionType::APPLICATION_LAYER_PROTOCOL_NEGOTIATION)
.unwrap()
.to_owned(),
);
Ok(())
}
});
let server = server.build();
let mut client = server.client();
client.ctx().set_alpn_protos(b"\x06http/2").unwrap();
client.connect();
assert_eq!(
alpn_extension.lock().unwrap().as_deref(),
Some(&b"\x00\x07\x06http/2"[..]),
);
} | rust_cleaned_test_functions.jsonl/110813 | {
"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,
13051,
37097,
8418,
19958,
31035,
368,
341,
262,
1077,
5206,
3538,
284,
8422,
486,
17850,
543,
262,
1077,
452,
19958,
31035,
284,
1460,
486,
12996,
486,
36809,
486,
931,
5194,
486,
12996,
486,
380... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.