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_into_bytes_string() {
let b = Bytes::new("hello, world!".to_string());
let actual = b.into_bytes();
assert_eq!(b"hello, world!\0", &actual[..]);
} | rust_cleaned_test_functions.jsonl/66211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
12524,
3904,
368,
341,
286,
1077,
293,
284,
30024,
486,
931,
445,
14990,
11,
1879,
92993,
983,
3904,
1423,
286,
1077,
5042,
284,
293,
39860,
12524,
543,
286,
2060,
10714,
10297,
65,
1,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_minus_real() {
let test_cases = vec![
(
Real::new(1.01001).ok(),
Real::new(-0.01).ok(),
Real::new(1.02001).ok(),
false,
),
(
Real::new(std::f64::MIN).ok(),
Real::new(std::f64::MAX).ok(),
None,
true,
),
];
for (lhs, rhs, expected, is_err) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate(ScalarFuncSig::MinusReal);
if is_err {
assert!(output.is_err())
} else {
let output = output.unwrap();
assert_eq!(output, expected, "lhs={:?}, rhs={:?}", lhs, rhs);
}
}
} | rust_cleaned_test_functions.jsonl/5284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38457,
15266,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
2399,
394,
8800,
486,
931,
7,
16,
13,
15,
16,
15,
15,
16,
568,
562,
3148,
394,
8800,
486,
931,
4080,
15,
13,
15,
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... | 3 |
#[test]
fn test_tokenize_fields_custom_separator() {
let line = "aaa foo bar b x";
assert_eq!(
tokenize_helper(line, Some('a')),
vec![0..0, 1..1, 2..2, 3..9, 10..18,]
);
} | rust_cleaned_test_functions.jsonl/31607 | {
"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,
86508,
12132,
15875,
58204,
368,
341,
286,
1077,
1555,
284,
330,
32646,
15229,
3619,
293,
262,
856,
876,
286,
2060,
10714,
33673,
310,
77651,
10418,
8797,
11,
4329,
492,
64,
22337,
310,
7486,
2070... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tree_insertion_and_search() {
let sample = |_| {
rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(20)
.collect::<String>()
};
let sample_vec = vec![0; 20];
let sample_vec: Vec<String> = sample_vec.iter().map(sample).collect();
let mut rb_tree = RBTree::new();
for key in &sample_vec {
rb_tree.insert(key, key);
}
for key in &sample_vec {
assert!(
&rb_tree.search(key).unwrap().0 == key,
format!("Did not find key: {}", key)
);
}
} | rust_cleaned_test_functions.jsonl/61996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
17678,
290,
8378,
10716,
368,
341,
286,
1077,
6077,
284,
66091,
341,
310,
10382,
486,
4528,
66849,
741,
394,
659,
13611,
11723,
2099,
2101,
65788,
340,
394,
659,
22769,
7,
17,
15,
340,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_select_utxos_for_optimization_selects_smallest_inputs() {
{
let mut utxos = generate_utxos(6);
utxos[0].value = 100 * MILLIMOB_TO_PICOMOB;
utxos[1].value = 200 * MILLIMOB_TO_PICOMOB;
utxos[2].value = 150 * MILLIMOB_TO_PICOMOB;
utxos[3].value = 300 * MILLIMOB_TO_PICOMOB;
utxos[4].value = 2000 * MILLIMOB_TO_PICOMOB;
utxos[5].value = 1000 * MILLIMOB_TO_PICOMOB;
let selected_utxos = TransactionsManager::<
ThickClient<HardcodedCredentialsProvider>,
MockFogPubkeyResolver,
>::select_utxos_for_optimization(
1000, &utxos, 2, Mob::ID, Mob::MINIMUM_FEE
)
.unwrap();
assert_eq!(selected_utxos, vec![utxos[0].clone(), utxos[4].clone()]);
}
{
let mut utxos = generate_utxos(6);
utxos[0].value = 100 * MILLIMOB_TO_PICOMOB;
utxos[1].value = 200 * MILLIMOB_TO_PICOMOB;
utxos[2].value = 150 * MILLIMOB_TO_PICOMOB;
utxos[3].value = 300 * MILLIMOB_TO_PICOMOB;
utxos[4].value = 2000 * MILLIMOB_TO_PICOMOB;
utxos[5].value = 1000 * MILLIMOB_TO_PICOMOB;
let selected_utxos = TransactionsManager::<
ThickClient<HardcodedCredentialsProvider>,
MockFogPubkeyResolver,
>::select_utxos_for_optimization(
1000, &utxos, 3, Mob::ID, Mob::MINIMUM_FEE
)
.unwrap();
assert_eq!(
selected_utxos,
vec![utxos[0].clone(), utxos[2].clone(), utxos[4].clone()]
);
}
} | rust_cleaned_test_functions.jsonl/526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1009
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
60363,
87,
436,
5478,
15032,
65964,
13051,
82,
15874,
19236,
28557,
368,
341,
1789,
286,
341,
310,
1077,
5206,
8621,
87,
436,
284,
6923,
60363,
87,
436,
7,
21,
626,
310,
8621,
87,
436,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dense_rank() -> Result<()> {
let r = dense_rank("arr".into());
test_without_rank(&r, vec![1; 8])?;
test_with_rank(&r, vec![1, 1, 2, 3, 3, 3, 4, 5])?;
Ok(())
} | rust_cleaned_test_functions.jsonl/129705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72619,
20417,
368,
1464,
5714,
71698,
341,
286,
1077,
435,
284,
27950,
20417,
445,
1118,
3263,
18122,
1423,
286,
1273,
39904,
20417,
2099,
81,
11,
7486,
20703,
16,
26,
220,
23,
2467,
37445,
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_body_brotli() {
let mut srv = TestServer::new(move || {
h1::H1Service::new(App::new().wrap(Compress::new(ContentEncoding::Br)).service(
web::resource("/").route(web::to(move || Response::Ok().body(STR))),
))
});
// client request
let mut response = srv
.block_on(
srv.get("/")
.header(ACCEPT_ENCODING, "br")
.no_decompress()
.send(),
)
.unwrap();
assert!(response.status().is_success());
// read response
let bytes = srv.block_on(response.body()).unwrap();
// decode brotli
let mut e = BrotliDecoder::new(Vec::with_capacity(2048));
e.write_all(bytes.as_ref()).unwrap();
let dec = e.finish().unwrap();
assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref()));
} | rust_cleaned_test_functions.jsonl/48229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14114,
880,
4640,
742,
368,
341,
262,
1077,
5206,
43578,
284,
3393,
5475,
486,
931,
34081,
1369,
341,
286,
305,
16,
486,
39,
16,
1860,
486,
931,
23231,
486,
931,
1005,
10097,
7,
1092,
1873,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_bank_process_and_record_transactions() {
analog_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_slow_genesis_config(10_000);
let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let pubkey = analog_sdk::pubkey::new_rand();
let transactions = sanitize_transactions(vec![system_transaction::transfer(
&mint_keypair,
&pubkey,
1,
genesis_config.hash(),
)]);
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger");
let (poh_recorder, entry_receiver, record_receiver) = PohRecorder::new(
bank.tick_height(),
bank.last_blockhash(),
bank.clone(),
Some((4, 4)),
bank.ticks_per_slot(),
&pubkey,
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
let recorder = poh_recorder.recorder();
let poh_recorder = Arc::new(Mutex::new(poh_recorder));
let poh_simulator = simulate_poh(record_receiver, &poh_recorder);
poh_recorder.lock().unwrap().set_bank(&bank);
let (gossip_vote_sender, _gossip_vote_receiver) = unbounded();
BankingStage::process_and_record_transactions(
&bank,
&transactions,
&recorder,
0,
None,
&gossip_vote_sender,
)
.0
.unwrap();
// Tick up to max tick height
while poh_recorder.lock().unwrap().tick_height() != bank.max_tick_height() {
poh_recorder.lock().unwrap().tick();
}
let mut done = false;
while let Ok((_bank, (entry, _tick_height))) = entry_receiver.recv() {
if !entry.is_tick() {
trace!("got entry");
assert_eq!(entry.transactions.len(), transactions.len());
assert_eq!(bank.get_balance(&pubkey), 1);
done = true;
}
if done {
break;
}
}
trace!("done ticking");
assert!(done);
let transactions = sanitize_transactions(vec![system_transaction::transfer(
&mint_keypair,
&pubkey,
2,
genesis_config.hash(),
)]);
assert_matches!(
BankingStage::process_and_record_transactions(
&bank,
&transactions,
&recorder,
0,
None,
&gossip_vote_sender,
)
.0,
Err(PohRecorderError::MaxHeightReached)
);
poh_recorder
.lock()
.unwrap()
.is_exited
.store(true, Ordering::Relaxed);
let _ = poh_simulator.join();
assert_eq!(bank.get_balance(&pubkey), 1);
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/4989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2041
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
11305,
8378,
14192,
68182,
368,
341,
286,
23400,
27413,
486,
15188,
543,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
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... | 5 |
#[test]
fn test_to_urn_string() {
let yyid = Yyid::new();
let yurn = yyid.to_urn_ref().to_string();
let ystr = &yurn[9..];
assert!(yurn.starts_with("urn:yyid:"));
assert!(ystr.len() == 36);
assert!(ystr.chars().all(|c| c.is_digit(16) || c == '-'));
} | rust_cleaned_test_functions.jsonl/134734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
62,
399,
3904,
368,
341,
286,
1077,
13197,
307,
284,
809,
88,
307,
486,
931,
543,
286,
1077,
379,
399,
284,
13197,
307,
2389,
62,
399,
7793,
1005,
983,
3904,
543,
286,
1077,
379,
495,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_range_size_hint() {
use core::usize::MAX as UMAX;
assert_eq!((0..0usize).size_hint(), (0, Some(0)));
assert_eq!((0..100usize).size_hint(), (100, Some(100)));
assert_eq!((0..UMAX).size_hint(), (UMAX, Some(UMAX)));
let umax = u128::try_from(UMAX).unwrap();
assert_eq!((0..0u128).size_hint(), (0, Some(0)));
assert_eq!((0..100u128).size_hint(), (100, Some(100)));
assert_eq!((0..umax).size_hint(), (UMAX, Some(UMAX)));
assert_eq!((0..umax + 1).size_hint(), (UMAX, None));
use core::isize::{MAX as IMAX, MIN as IMIN};
assert_eq!((0..0isize).size_hint(), (0, Some(0)));
assert_eq!((-100..100isize).size_hint(), (200, Some(200)));
assert_eq!((IMIN..IMAX).size_hint(), (UMAX, Some(UMAX)));
let imin = i128::try_from(IMIN).unwrap();
let imax = i128::try_from(IMAX).unwrap();
assert_eq!((0..0i128).size_hint(), (0, Some(0)));
assert_eq!((-100..100i128).size_hint(), (200, Some(200)));
assert_eq!((imin..imax).size_hint(), (UMAX, Some(UMAX)));
assert_eq!((imin..imax + 1).size_hint(), (UMAX, None));
} | rust_cleaned_test_functions.jsonl/54164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 522
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
2368,
45825,
368,
341,
262,
990,
6200,
486,
51878,
486,
10586,
438,
547,
10586,
280,
262,
2060,
10714,
0,
1188,
15,
496,
15,
51878,
568,
2141,
45825,
1507,
320,
15,
11,
4329,
7,
15,
4945... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shorten() {
let src = r#"
// Package foo does a thing.
//
// This is a description.
//
// ## Examples
//
// ### Using foo
//
// ```
// import "foo"
//
// foo.a
// ```
package foo
// a is a constant.
//
// This is a description.
//
// ## Examples
//
// ### Using a
//
// ```
// # import "foo"
// foo.a
// ```
a = 1
// f is a function.
//
// This is a description.
//
// ## Parameters
//
// - x: is a parameter.
//
// This is a description of x.
//
// ## Examples
//
// ### Using f
//
// ```
// # import "foo"
// foo.f(x:1)
// ```
f = (x) => 1
// o is an option.
//
// This is a description.
//
// ## Examples
//
// ### Using o
//
// ```
// # import "foo"
// option foo.o = 2
// ```
option o = 1
"#;
let loc = Locator::new(&src[..]);
assert_docs_short(
src,
PackageDoc {
path: "path".to_string(),
name: "foo".to_string(),
headline: "Package foo does a thing.".to_string(),
description: None,
members: map![
"a" => Doc::Value(Box::new(ValueDoc{
name: "a".to_string(),
headline: "a is a constant.".to_string(),
description: None,
flux_type: "int".to_string(),
is_option: false,
source_location: loc.get(29,9,29,14),
examples: vec![],
metadata: None,
})),
"f" => Doc::Function(Box::new(FunctionDoc{
name: "f".to_string(),
headline: "f is a function.".to_string(),
description: None,
parameters: vec![ParameterDoc{
name: "x".to_string(),
headline: "x: is a parameter.".to_string(),
description: None,
required: true,
} ],
flux_type: "(x:A) => int".to_string(),
is_option: false,
source_location: loc.get(49,9,49,21),
examples: vec![],
metadata: None,
})),
"o" => Doc::Value(Box::new(ValueDoc{
name: "o".to_string(),
headline: "o is an option.".to_string(),
description: None,
flux_type: "int".to_string(),
is_option: true,
source_location: loc.get(63,9,63,21),
examples: vec![],
metadata: None,
})),
],
examples: Vec::new(),
metadata: None,
},
vec![],
);
} | rust_cleaned_test_functions.jsonl/9988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
268,
368,
341,
286,
1077,
2286,
284,
435,
2,
698,
286,
442,
16906,
15229,
1558,
264,
3166,
624,
286,
6475,
286,
442,
1096,
374,
264,
4008,
624,
286,
6475,
286,
442,
7704,
25311,
198,
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_wrong_number_of_parameters_error() {
test_parse_error!(
vec![("a", "1")],
(u32, u32),
ErrorKind::WrongNumberOfParameters {
got: 1,
expected: 2,
}
);
} | rust_cleaned_test_functions.jsonl/16605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75198,
5500,
3575,
18263,
4096,
368,
341,
286,
1273,
21039,
4096,
33673,
310,
7486,
20703,
445,
64,
497,
330,
16,
899,
1259,
310,
320,
84,
18,
17,
11,
575,
18,
17,
1326,
310,
4600,
10629,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_i64() {
let cases = vec![
(-12345i64, "-12345"),
(-1, "-1"),
(1, "1"),
(-9223372036854775807, "-9223372036854775807"),
(-9223372036854775808, "-9223372036854775808"),
];
for (num, exp) in cases {
let dec: Decimal = num.into();
let dec_str = format!("{}", dec);
assert_eq!(dec_str, exp);
}
} | rust_cleaned_test_functions.jsonl/13652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
5318,
21,
19,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
10293,
16,
17,
18,
19,
20,
72,
21,
19,
11,
6523,
16,
17,
18,
19,
20,
4461,
310,
10293,
16,
11,
6523,
16,
4461,
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... | 2 |
#[test]
fn test_impossible_keys() {
// make sure not infinite loops are hit here.
let seed = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap();
let mut rng = StdRng::seed_from_u64(seed.as_secs());
for i in 0..32 {
let _ = RSAPrivateKey::new(&mut rng, i).is_err();
let _ = generate_multi_prime_key(&mut rng, 3, i);
let _ = generate_multi_prime_key(&mut rng, 4, i);
let _ = generate_multi_prime_key(&mut rng, 5, i);
}
} | rust_cleaned_test_functions.jsonl/29037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17895,
10031,
12631,
368,
341,
286,
442,
1281,
2704,
537,
23809,
29753,
525,
4201,
1588,
624,
286,
1077,
10320,
284,
739,
1462,
486,
3328,
1005,
17021,
56262,
10407,
1462,
486,
99089,
2089,
69945,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_change_rate_limiter_auto_tuned() {
let (mut cfg, _dir) = TiKvConfig::with_tmp().unwrap();
// vanilla limiter does not support dynamically changing auto-tuned mode.
cfg.rocksdb.rate_limiter_auto_tuned = true;
cfg.validate().unwrap();
let (storage, cfg_controller, ..) = new_engines(cfg);
let db = storage.get_engine().get_rocksdb();
// update rate_limiter_auto_tuned
assert_eq!(
db.get_db_options().get_rate_limiter_auto_tuned().unwrap(),
true
);
cfg_controller
.update_config("rocksdb.rate_limiter_auto_tuned", "false")
.unwrap();
assert_eq!(
db.get_db_options().get_rate_limiter_auto_tuned().unwrap(),
false
);
} | rust_cleaned_test_functions.jsonl/2157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15947,
9246,
907,
17700,
27740,
528,
48883,
368,
341,
286,
1077,
320,
6984,
13286,
11,
716,
3741,
8,
284,
22325,
42,
85,
2648,
486,
4197,
16125,
1005,
15454,
543,
286,
442,
32065,
4568,
2015,
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_ledger_cleanup_service() {
solana_logger::setup();
error!("test_ledger_cleanup_service");
let num_nodes = 3;
let mut validator_config = ValidatorConfig::default();
validator_config.max_ledger_slots = Some(100);
let config = ClusterConfig {
cluster_lamports: 10_000,
poh_config: PohConfig::new_sleep(Duration::from_millis(50)),
node_stakes: vec![100; num_nodes],
validator_configs: vec![validator_config.clone(); num_nodes],
..ClusterConfig::default()
};
let mut cluster = LocalCluster::new(&config);
sleep(Duration::from_secs(60));
cluster_tests::spend_and_verify_all_nodes(
&cluster.entry_point_info,
&cluster.funding_keypair,
num_nodes,
HashSet::new(),
);
cluster.close_preserve_ledgers();
//check everyone's ledgers and make sure only ~100 slots are stored
for (_, info) in &cluster.validator_infos {
let mut slots = 0;
let blocktree = Blocktree::open(&info.info.ledger_path).unwrap();
blocktree
.slot_meta_iterator(0)
.unwrap()
.for_each(|_| slots += 1);
// with 3 nodes upto 3 slots can be in progress and not complete so max slots in blocktree should be upto 103
assert!(slots <= 103, "got {}", slots);
}
} | rust_cleaned_test_functions.jsonl/55963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38367,
1389,
42444,
12267,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
543,
262,
1465,
17223,
1944,
38367,
1389,
42444,
12267,
797,
262,
1077,
1629,
14896,
284,
220,
18,
280,
262,
1077,
5206,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_primorial() {
let alpha = 6370;
let mut primorial = BigNumber::one();
for i in 1..alpha {
if BigNumber::from(i).is_prime() {
primorial *= i;
}
}
let primorial_from_bytes = BigNumber::from_slice(ALPHA_PRIMORIAL_BYTES);
assert_eq!(primorial, primorial_from_bytes);
} | rust_cleaned_test_functions.jsonl/52309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87419,
21913,
368,
341,
286,
1077,
8287,
284,
220,
21,
18,
22,
15,
280,
286,
1077,
5206,
8860,
21913,
284,
53673,
486,
603,
1428,
286,
369,
600,
304,
220,
16,
496,
7141,
341,
310,
421,
53673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_execution_summary() {
let helper = TableScanTestHelper::new();
let mut executor = BatchTableScanExecutor::new(
helper.store(),
Arc::new(EvalConfig::default()),
helper.columns_info_by_idx(&[0]),
vec![helper.whole_table_range()],
false,
)
.unwrap()
.with_summary_collector(ExecSummaryCollectorEnabled::new(1));
executor.next_batch(1);
executor.next_batch(2);
let mut s = BatchExecuteStatistics::new(2, 1);
executor.collect_statistics(&mut s);
assert_eq!(s.scanned_rows_per_range[0], 3);
// 0 remains Default because our output index is 1
assert_eq!(s.summary_per_executor[0], ExecSummary::default());
let exec_summary = s.summary_per_executor[1];
assert_eq!(3, exec_summary.num_produced_rows);
assert_eq!(2, exec_summary.num_iterations);
executor.collect_statistics(&mut s);
// Collected statistics remain unchanged because of no newly generated delta statistics.
assert_eq!(s.scanned_rows_per_range[0], 3);
assert_eq!(s.summary_per_executor[0], ExecSummary::default());
let exec_summary = s.summary_per_executor[1];
assert_eq!(3, exec_summary.num_produced_rows);
assert_eq!(2, exec_summary.num_iterations);
// Reset collected statistics so that now we will only collect statistics in this round.
s.clear();
executor.next_batch(10);
executor.collect_statistics(&mut s);
assert_eq!(s.scanned_rows_per_range[0], 2);
assert_eq!(s.summary_per_executor[0], ExecSummary::default());
let exec_summary = s.summary_per_executor[1];
assert_eq!(2, exec_summary.num_produced_rows);
assert_eq!(1, exec_summary.num_iterations);
} | rust_cleaned_test_functions.jsonl/66511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60948,
27251,
368,
341,
286,
1077,
13137,
284,
6633,
26570,
2271,
5511,
486,
931,
1428,
286,
1077,
5206,
31558,
284,
33904,
2556,
26570,
25255,
486,
931,
1006,
310,
13137,
16114,
3148,
310,
19689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_optional_value() {
// simple list with 3-Options
let encoded =
"0b000000030a000000000000000000000000000000000f090a000000000000000000000000000000000f";
let bytes = hex::decode(encoded).unwrap();
let (_, value) = Value::from_bytes(&bytes).unwrap();
assert!(matches!(value.value_id().unwrap(), ValueId::List));
assert_eq!(bytes.len(), value.0.len());
let three_depth = "0a0a0a0100000000000000000000000000000001";
let bytes = hex::decode(three_depth).unwrap();
let (_, value) = Value::from_bytes(&bytes).unwrap();
assert!(matches!(value.value_id().unwrap(), ValueId::OptionalSome));
assert_eq!(bytes.len(), value.0.len());
let five_depth = "0a0a0a0a0a0100000000000000000000000000000001";
let bytes = hex::decode(five_depth).unwrap();
Value::value_len(&bytes).unwrap_err();
} | rust_cleaned_test_functions.jsonl/49839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74644,
3142,
368,
341,
286,
442,
4285,
1140,
448,
220,
18,
12,
3798,
198,
286,
1077,
20498,
4035,
310,
330,
15,
65,
15,
15,
15,
15,
15,
15,
15,
18,
15,
64,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u128() {
const VALUE: u128 = u128_from_bytes!("aaaaaaaabbbbbbbb");
assert_eq!(0x62626262626262626161616161616161, VALUE);
} | rust_cleaned_test_functions.jsonl/114329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
16,
17,
23,
368,
341,
262,
733,
26827,
25,
575,
16,
17,
23,
284,
575,
16,
17,
23,
5673,
12524,
17223,
28458,
32646,
370,
87609,
53151,
797,
262,
2060,
10714,
10297,
15,
87,
21,
17,
21,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delegate_subscribe_unsubscribe() {
let new_downstream = |id: u64, region_version: u64| {
let peer = format!("{}", id);
let mut epoch = RegionEpoch::default();
epoch.set_conf_ver(region_version);
epoch.set_version(region_version);
Downstream::new(peer, epoch, id, ConnID::new())
};
// Create a new delegate.
let txn_extra_op = Arc::new(AtomicCell::new(TxnExtraOp::Noop));
let mut delegate = Delegate::new(1, txn_extra_op.clone());
assert_eq!(txn_extra_op.load(), TxnExtraOp::Noop);
assert!(delegate.handle.is_observing());
delegate.subscribe(new_downstream(1, 1)).unwrap();
assert_eq!(txn_extra_op.load(), TxnExtraOp::ReadOldValue);
assert!(delegate.handle.is_observing());
// Subscribe twice and then unsubscribe the second downstream.
delegate.subscribe(new_downstream(2, 1)).unwrap();
assert!(!delegate.unsubscribe(DownstreamID(1), None));
assert_eq!(txn_extra_op.load(), TxnExtraOp::ReadOldValue);
assert!(delegate.handle.is_observing());
// `on_region_ready` when the delegate isn't resolved.
delegate.subscribe(new_downstream(1, 2)).unwrap();
let mut region = Region::default();
region.mut_region_epoch().set_conf_ver(1);
region.mut_region_epoch().set_version(1);
{
let failures = delegate.on_region_ready(Resolver::new(1), region);
assert_eq!(failures.len(), 1);
let id = failures[0].0.id;
delegate.unsubscribe(id, None);
assert_eq!(delegate.downstreams().len(), 1);
}
assert_eq!(txn_extra_op.load(), TxnExtraOp::ReadOldValue);
assert!(delegate.handle.is_observing());
// Subscribe with an invalid epoch.
assert!(delegate.subscribe(new_downstream(1, 2)).is_err());
assert_eq!(delegate.downstreams().len(), 1);
// Unsubscribe all downstreams.
assert!(delegate.unsubscribe(DownstreamID(0), None));
assert!(delegate.downstreams().is_empty());
assert_eq!(txn_extra_op.load(), TxnExtraOp::Noop);
assert!(!delegate.handle.is_observing());
} | rust_cleaned_test_functions.jsonl/112319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1023
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55312,
88935,
4907,
9384,
368,
341,
286,
1077,
501,
13998,
4027,
284,
760,
307,
25,
575,
21,
19,
11,
5537,
9438,
25,
575,
21,
19,
91,
341,
310,
1077,
14397,
284,
3561,
79878,
877,
317,
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_scalar_multiplication() {
println!("Started getting field elements");
let f1 = Fr::from_str(
"4691331900926794624732159288782398864809513177368446695323460897088210774597",
)
.unwrap();
let f2 = Fr::from_str(
"1305028103380024953477151132159456965337646722479526711736847301646466538045",
)
.unwrap();
println!("Finished getting field elements");
let g = JubJubAffine::from_str(
"(1158870117176967269192899343636553522971009777237254192973081388797299308391, \
36933624999642413792569726058244472742169727126562409632889593958355839948294)",
)
.unwrap();
let f1f2g = JubJubAffine::from_str(
"(12638652891150111215300246576936483137884466359309882317048163368620501191944, \
38385045634663742820428406709832518145724237919360177362175527604556651918148)",
)
.unwrap();
println!("Finished getting group elements");
assert!(!g.is_zero());
assert!(!f1f2g.is_zero());
let f1g = g * &f1;
println!("f1: {:?}", f1);
println!("f2: {:?}", f2);
println!("g: {:?}", g);
println!("f1f2g: {:?}", f1f2g);
assert_eq!(g * &(f1 * &f2), f1f2g);
assert_eq!(f1g * &f2, f1f2g);
} | rust_cleaned_test_functions.jsonl/76307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 610
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
91802,
1693,
368,
341,
262,
13751,
17223,
32527,
3709,
2070,
5424,
797,
262,
1077,
282,
16,
284,
2869,
486,
1499,
2895,
1006,
286,
330,
19,
21,
24,
16,
18,
18,
16,
24,
15,
15,
24,
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_optimized_regression() {
let mut lin_mod = LinRegressor::default();
let inputs = Matrix::new(3, 1, vec![2.0, 3.0, 4.0]);
let targets = Vector::new(vec![5.0, 6.0, 7.0]);
lin_mod.train_with_optimization(&inputs, &targets);
let _ = lin_mod.parameters().unwrap();
} | rust_cleaned_test_functions.jsonl/69350 | {
"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,
15032,
45706,
91144,
368,
341,
262,
1077,
5206,
9805,
7480,
284,
8564,
93139,
486,
2258,
543,
262,
1077,
11127,
284,
11631,
486,
931,
7,
18,
11,
220,
16,
11,
7486,
20703,
17,
13,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple() {
let resp = find_nearest_test_markers("./fixtures/rust/cargo/src/pickers/tester.rs", 16)
.unwrap()
.unwrap();
assert_eq!(
resp.name.unwrap(),
WithLineNo {
no: 15,
value: "test_function".to_string()
}
);
assert_eq!(resp.namespace.len(), 0);
} | rust_cleaned_test_functions.jsonl/29649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
286,
1077,
9039,
284,
1477,
13925,
15432,
4452,
92082,
13988,
45247,
7382,
590,
2899,
12088,
13437,
4322,
39089,
12697,
261,
25638,
497,
220,
16,
21,
340,
310,
659,
15454,
741,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul_overflowing() {
let a = Primitive::from(&vec![None, Some(6), None, Some(6)]).to(DataType::Int32);
let b = Primitive::from(&vec![Some(5), None, None, Some(6)]).to(DataType::Int32);
let (result, overflow) = overflowing_mul(&a, &b).unwrap();
let expected = Primitive::from(&vec![None, None, None, Some(36)]).to(DataType::Int32);
assert_eq!(result, expected);
assert_eq!(overflow.as_slice()[0], 0b0000);
let a = Primitive::from(&vec![Some(1i8), Some(-100i8)]).to(DataType::Int8);
let b = Primitive::from(&vec![Some(1i8), Some(100i8)]).to(DataType::Int8);
let (result, overflow) = overflowing_mul(&a, &b).unwrap();
let expected = Primitive::from(&vec![Some(1i8), Some(-16i8)]).to(DataType::Int8);
assert_eq!(result, expected);
assert_eq!(overflow.as_slice()[0], 0b10);
} | rust_cleaned_test_functions.jsonl/12705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
79073,
287,
368,
341,
286,
1077,
264,
284,
51460,
486,
1499,
2099,
4083,
20703,
4064,
11,
4329,
7,
21,
701,
2240,
11,
4329,
7,
21,
7252,
568,
983,
63941,
486,
1072,
18,
17,
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_writer_append_ser() {
let schema = Schema::parse_str(SCHEMA).unwrap();
let mut writer = Writer::new(&schema, Vec::new());
let record = TestSerdeSerialize {
a: 27,
b: "foo".to_owned(),
};
let n1 = writer.append_ser(record).unwrap();
let n2 = writer.flush().unwrap();
let result = writer.into_inner().unwrap();
assert_eq!(n1 + n2, result.len());
let mut data = Vec::new();
zig_i64(27, &mut data);
zig_i64(3, &mut data);
data.extend(b"foo");
// starts with magic
assert_eq!(&result[..AVRO_OBJECT_HEADER_LEN], AVRO_OBJECT_HEADER);
// ends with data and sync marker
let last_data_byte = result.len() - 16;
assert_eq!(
&result[last_data_byte - data.len()..last_data_byte],
data.as_slice()
);
} | rust_cleaned_test_functions.jsonl/37661 | {
"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,
28908,
26041,
75861,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
59461,
35839,
568,
15454,
543,
286,
1077,
5206,
6916,
284,
29404,
486,
931,
2099,
17349,
11,
11312,
486,
931,
5231,
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_aggsig_batch() {
let secp = Secp256k1::with_caps(ContextFlag::Full);
let mut sigs: Vec<Signature> = vec![];
let mut msgs: Vec<Message> = vec![];
let mut pub_keys: Vec<PublicKey> = vec![];
for _ in 0..100 {
let (sk, pk) = secp.generate_keypair(&mut thread_rng()).unwrap();
let mut msg = [0u8; 32];
thread_rng().fill(&mut msg);
let msg = Message::from_slice(&msg).unwrap();
let sig = sign_single(&secp, &msg, &sk, None, None, None, Some(&pk), None).unwrap();
let result_single = verify_single(&secp, &sig, &msg, None, &pk, Some(&pk), None, false);
assert!(result_single == true);
pub_keys.push(pk);
msgs.push(msg);
sigs.push(sig);
}
println!("Verifying aggsig batch of 100");
let result = verify_batch(&secp, &sigs, &msgs, &pub_keys);
assert!(result == true);
} | rust_cleaned_test_functions.jsonl/15035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
5857,
343,
14534,
368,
341,
197,
10217,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
4197,
52955,
14001,
12135,
486,
9432,
626,
197,
10217,
5206,
8366,
82,
25,
11312,
27,
25088,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_filter_by_pid() {
timeout_ms(
|| {
let p = setup_default_packet();
let mut p2 = p.clone();
p2.metadata.pid = 0;
let lm = LogMessage {
pid: p.metadata.pid,
tid: p.metadata.tid,
time: p.metadata.time,
dropped_logs: p.metadata.dropped_logs,
severity: p.metadata.severity,
msg: String::from("BBBBB"),
tags: vec![String::from("AAAAA")],
};
let options = &mut LogFilterOptions {
filter_by_pid: true,
pid: 1,
filter_by_tid: false,
tid: 0,
min_severity: LogLevelFilter::None,
verbosity: 0,
tags: vec![],
};
filter_test_helper(vec![lm], vec![p, p2], Some(options), "test_filter_by_pid");
},
TEST_TIMEOUT,
);
} | rust_cleaned_test_functions.jsonl/76994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 698
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
3710,
30065,
368,
341,
286,
9632,
21416,
1006,
310,
1369,
341,
394,
1077,
281,
284,
6505,
9993,
21078,
543,
394,
1077,
5206,
281,
17,
284,
281,
15997,
543,
394,
281,
17,
27544,
40939,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_radd() {
// Bazel/Buck `select` function.
#[derive(Debug, Display, Clone)]
#[display(fmt = "${:?}", _0)]
struct Select(Vec<i32>);
starlark_simple_value!(Select);
impl<'v> UnpackValue<'v> for Select {
fn expected() -> String {
Select::get_type_value_static().as_str().to_owned()
}
fn unpack_value(value: Value<'v>) -> Option<Self> {
match Select::from_value(value) {
Some(x) => Some(x.clone()),
None => Some(Select(UnpackValue::unpack_value(value)?)),
}
}
}
impl Select {
fn add(mut self, x: &Select) -> Self {
self.0.extend(x.0.iter().copied());
self
}
}
impl<'v> StarlarkValue<'v> for Select {
starlark_type!("select");
fn radd(&self, lhs: Value<'v>, heap: &'v Heap) -> Option<anyhow::Result<Value<'v>>> {
let lhs: Select = UnpackValue::unpack_value(lhs).unwrap();
Some(Ok(heap.alloc(lhs.add(self))))
}
fn add(&self, rhs: Value<'v>, heap: &'v Heap) -> anyhow::Result<Value<'v>> {
let rhs: Select = UnpackValue::unpack_value(rhs).unwrap();
Ok(heap.alloc(self.clone().add(&rhs)))
}
fn collect_repr(&self, collector: &mut String) {
write!(collector, "{}", self).unwrap()
}
}
#[starlark_module]
fn module(build: &mut GlobalsBuilder) {
fn select(xs: Vec<i32>) -> Select {
Ok(Select(xs))
}
}
let mut a = Assert::new();
a.globals_add(module);
a.pass(
r#"
s1 = select([1])
s2 = select([2])
assert_eq(repr(s1), "$[1]")
assert_eq(repr(s1 + [3]), "$[1, 3]")
assert_eq(repr([3] + s1), "$[3, 1]")
assert_eq(repr(s1 + s2), "$[1, 2]")
s1 += [3]
v = [4]
v += s2
s2 += s1
assert_eq(repr(s1), "$[1, 3]")
assert_eq(repr(v), "$[4, 2]")
assert_eq(repr(s2), "$[2, 1, 3]")
"#,
);
} | rust_cleaned_test_functions.jsonl/92433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1035
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
718,
368,
341,
1066,
262,
442,
425,
68326,
16276,
1942,
1565,
1742,
63,
729,
624,
262,
11506,
27098,
42618,
11,
10623,
11,
27913,
5563,
262,
11506,
5493,
28197,
284,
10857,
25,
52652,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_draw_hollow_ellipse() {
use imageproc::drawing::draw_hollow_ellipse_mut;
let red = Rgb([255, 0, 0]);
let green = Rgb([0, 255, 0]);
let blue = Rgb([0, 0, 255]);
let mut image = RgbImage::from_pixel(200, 200, Rgb([255, 255, 255]));
// Circle
draw_hollow_ellipse_mut(&mut image, (100, 100), 50, 50, red);
// Vertically stretched
draw_hollow_ellipse_mut(&mut image, (50, 100), 40, 90, blue);
// Horizontally stretched
draw_hollow_ellipse_mut(&mut image, (100, 150), 80, 30, green);
// Partially off-screen
draw_hollow_ellipse_mut(&mut image, (150, 150), 100, 60, blue);
if REGENERATE {
save_truth_image(&image, "hollow_ellipse.png");
}
else {
let truth = load_truth_image("hollow_ellipse.png").to_rgb();
assert_pixels_eq!(image, truth);
}
} | rust_cleaned_test_functions.jsonl/20082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23021,
1523,
1544,
62,
68004,
368,
341,
262,
990,
2168,
15782,
486,
80849,
486,
7633,
1523,
1544,
62,
68004,
29523,
401,
262,
1077,
2518,
284,
431,
9511,
2561,
17,
20,
20,
11,
220,
15,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_entering_and_leving() {
with_externalities(&mut new_test_ext(), || {
let user = 1;
assert_eq!(Parking::all_parking_lots_count(), 2);
let parking_lot_hash = Parking::owner_parking_lots_array((0, 0));
assert_eq!(Parking::parking_lots_by_index(0), parking_lot_hash);
assert_ok!(Parking::entering(Origin::signed(user), parking_lot_hash.clone()));
let parking_info = Parking::user_parking_info(user).unwrap();
assert_eq!(parking_info.user_id, user);
assert_eq!(parking_info.current_fee, 0);
assert_eq!(parking_info.current_time.clone(), parking_info.enter_time.clone());
assert_err!(
Parking::entering(Origin::signed(user), parking_lot_hash.clone()),
"User already has entered a parking lot"
);
assert_ok!(Parking::leaving(Origin::signed(user)));
assert_ok!(Parking::entering(Origin::signed(user), parking_lot_hash.clone()));
let parking_info = Parking::user_parking_info(user).unwrap();
assert_eq!(parking_info.user_id, user);
assert_eq!(parking_info.current_fee, 0);
assert_eq!(parking_info.current_time.clone(), parking_info.enter_time.clone());
assert_err!(
Parking::entering(Origin::signed(user), parking_lot_hash.clone()),
"User already has entered a parking lot"
);
assert_ok!(Parking::leaving(Origin::signed(user)));
})
} | rust_cleaned_test_functions.jsonl/105203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 749
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37480,
287,
8378,
62,
3449,
287,
368,
341,
286,
448,
47432,
1361,
2099,
6984,
501,
4452,
9927,
1507,
1369,
341,
310,
1077,
1196,
284,
220,
16,
280,
310,
2060,
10714,
10297,
94316,
486,
541,
620,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_add_weight_delta_to() {
let a_lst = Tensor::<f64>::new(&Shape::new([2, 3]), vec![
1., 7., 8.,
-2., 3., 5.,
]);
let l = Dense::<f64> {
input_shape: Shape::new([2, 3]),
output_shape: Shape::new([2]),
weight: vec![
2., 1., -1., 3., 2., 1.,
1., 0., 0., -2., 1., 0.,
],
bias: vec![-5., -1.],
activation: Activation::<f64>::No,
};
let delta = Tensor::<f64>::new(&Shape::new([2]), vec![1., 7.]);
let mut cum_dw = vec![0.; 12];
let mut cum_db = Tensor::<f64>::new(&Shape::new([2]), vec![0., 0.]);
l.add_weight_delta_to(&delta, &a_lst, &mut cum_dw, &mut cum_db).unwrap();
let ans_da_lst = vec![
1., 7., 8.,
-2., 3., 5.,
7., 49., 56.,
-14., 21., 35.,
];
assert_eq!(cum_dw, ans_da_lst);
assert_eq!(cum_db, delta);
} | rust_cleaned_test_functions.jsonl/39100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 508
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
15876,
26710,
2346,
368,
341,
262,
1077,
264,
31983,
284,
26036,
27638,
69,
21,
19,
6831,
931,
2099,
12301,
486,
931,
2561,
17,
11,
220,
18,
9719,
7486,
90515,
286,
220,
16,
2572,
220,
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_signal_return_expected_type() {
let obj = Object::with_type(SimpleObject::static_type(), &[]).expect("Object::new failed");
obj.connect("create-string", false, move |_args| {
Some("return value".to_value())
})
.expect("Failed to connect on 'create-string'");
let signal_id = imp::SimpleObject::signals()[2].signal_id();
let value = obj
.emit(signal_id, &[])
.expect("Failed to emit")
.expect("Failed to get value from emit");
assert_eq!(value.get::<String>(), Ok(Some("return value".to_string())));
} | rust_cleaned_test_functions.jsonl/27402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21137,
12511,
32190,
1819,
368,
341,
286,
1077,
2839,
284,
3002,
486,
4197,
1819,
3759,
6456,
1190,
486,
1978,
1819,
1507,
609,
1294,
568,
17119,
445,
1190,
486,
931,
4641,
3071,
286,
2839,
10800,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_groupby_categorical() {
let mut df = df! {"foo" => ["a", "a", "b", "b", "c"],
"ham" => ["a", "a", "b", "b", "c"],
"bar" => [1, 1, 1, 1, 1]
}
.unwrap();
df.apply("foo", |s| s.cast::<CategoricalType>().unwrap())
.unwrap();
// check multiple keys and categorical
let res = df
.groupby_stable(&["foo", "ham"])
.unwrap()
.select("bar")
.sum()
.unwrap();
assert_eq!(
Vec::from(res.column("bar_sum").unwrap().i32().unwrap()),
&[Some(2), Some(2), Some(1)]
);
} | rust_cleaned_test_functions.jsonl/124229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
1694,
87455,
368,
341,
286,
1077,
5206,
6764,
284,
6764,
0,
5212,
7975,
1,
589,
4383,
64,
497,
330,
64,
497,
330,
65,
497,
330,
65,
497,
330,
66,
8097,
503,
330,
5604,
1,
589,
4383,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq_add_one() {
let f1 = Fq::from_str(
"4946875394261337176810256604189376311946643975348516311606738923340201185904",
)
.unwrap();
let f2 = Fq::from_str(
"4946875394261337176810256604189376311946643975348516311606738923340201185905",
)
.unwrap();
assert!(!f1.is_zero());
assert!(!f2.is_zero());
assert_eq!(f1 + &Fq::one(), f2);
} | rust_cleaned_test_functions.jsonl/81819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
2891,
11667,
368,
341,
262,
1077,
282,
16,
284,
434,
80,
486,
1499,
2895,
1006,
286,
330,
19,
24,
19,
21,
23,
22,
20,
18,
24,
19,
17,
21,
16,
18,
18,
22,
16,
22,
21,
23,
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_list() {
init();
let s = (0..=59).map(|v| v.to_string()).collect::<Vec<_>>().join(",");
let input = s.chars().collect::<Vec<_>>();
let result = (list(min_digit()) - end()).parse(&input).to_result().unwrap();
let values = (0..=59).map(|v| ValueExpr(v)).collect::<Vec<_>>();
assert_eq!(result, ListExpr(values));
} | rust_cleaned_test_functions.jsonl/106889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
368,
341,
262,
2930,
543,
262,
1077,
274,
284,
320,
15,
496,
28,
20,
24,
568,
2186,
22428,
85,
91,
348,
2389,
3904,
6011,
17384,
27638,
10050,
32399,
2452,
1005,
5987,
46649,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_runtime_get_function_info_invalid_has_fn_info() {
let driver = TestDriver::new(
r#"
pub fn main() -> i32 { 3 }
"#,
);
let fn_name = CString::new("main").expect("Invalid function name");
let handle = unsafe {
mun_runtime_get_function_definition(
driver.runtime,
fn_name.as_ptr(),
ptr::null_mut(),
ptr::null_mut(),
)
};
let message = unsafe { CStr::from_ptr(mun_error_message(handle)) };
assert_eq!(
message.to_str().unwrap(),
"Invalid argument: 'has_fn_info' is null pointer."
);
unsafe { mun_destroy_string(message.as_ptr()) };
} | rust_cleaned_test_functions.jsonl/120554 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33232,
3062,
9174,
3109,
31433,
21778,
15246,
3109,
368,
341,
262,
1077,
5579,
284,
3393,
11349,
486,
931,
1006,
286,
435,
2,
698,
286,
6675,
5168,
1887,
368,
1464,
600,
18,
17,
314,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handlebars_json_helper() {
let content = "{{toJson x}}".to_string();
let mut data = BTreeMap::new();
data.insert("test".into(), "something".into());
let mut renderer = TemplateRenderer::new();
renderer.register_template_string("t", content).unwrap();
let mut m: BTreeMap<String, BTreeMap<String, String>> = BTreeMap::new();
m.insert("x".into(), data);
let r = renderer.render("t", &m);
assert_eq!(
r.ok().unwrap(),
r#"{
"test": "something"
}"#.to_string()
);
} | rust_cleaned_test_functions.jsonl/86982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
24950,
9455,
10418,
368,
341,
286,
1077,
2213,
284,
47219,
73985,
856,
3417,
3263,
983,
3904,
543,
286,
1077,
5206,
821,
284,
425,
6533,
2227,
486,
931,
543,
286,
821,
7030,
445,
1944,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cdata() {
let mut r = Reader::from_str("<![CDATA[test]]>");
r.trim_text(true);
next_eq!(r, CData, b"test");
} | rust_cleaned_test_functions.jsonl/42074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
691,
368,
341,
262,
1077,
5206,
435,
284,
25166,
486,
1499,
2895,
9639,
20703,
54002,
72626,
5053,
15084,
262,
435,
16419,
4326,
3715,
317,
262,
1790,
10714,
10297,
81,
11,
356,
1043,
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 |
#[test]
fn test_f32_event() {
let base_data = vec![0x82, 0x2d, 0x01, 0x00, 0x0d, 0x00];
let f32_data = [
[0x17, 0x00, 0x00, 0x00],
[0x29, 0x00, 0x00, 0x00],
[0x12, 0x00, 0x00, 0x00],
[0x1e, 0x02, 0x00, 0x00],
[0xe8, 0x03, 0x00, 0x00],
[0xc0, 0xc6, 0x2d, 0x00],
];
let f32_results = [0.023, 0.041, 0.018, 0.542, 1.000, 3000.000];
for (bin, result) in f32_data.iter().zip(f32_results.iter()) {
let full_data = [base_data.clone(), bin.to_vec()].concat();
assert_eq!(
parse(&full_data[..]).unwrap().token_tape,
vec![BinaryToken::Token(0x2d82), BinaryToken::F32(*result),]
);
}
} | rust_cleaned_test_functions.jsonl/109406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
18,
17,
6748,
368,
341,
286,
1077,
2331,
1769,
284,
7486,
20703,
15,
87,
23,
17,
11,
220,
15,
87,
17,
67,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fib_conversion_into_ali() {
use ff::Field;
use crate::Fr;
use crate::air::Fibonacci;
use crate::air::TestTraceSystem;
use crate::air::IntoAIR;
use crate::arp::IntoARP;
use crate::fft::multicore::Worker;
use crate::transcript::Transcript;
let fib = Fibonacci::<Fr> {
final_b: Some(5),
at_step: Some(3),
_marker: std::marker::PhantomData
};
let mut test_tracer = TestTraceSystem::<Fr>::new();
fib.trace(&mut test_tracer).expect("should work");
test_tracer.calculate_witness(1, 1, 3);
let (witness, props) = test_tracer.into_arp();
let witness = witness.expect("some witness");
let worker = Worker::new();
let arp = ARPInstance::<Fr, PerRegisterARP>::from_instance(props, &worker).expect("must work");
let witness_polys = arp.calculate_witness_polys(witness, &worker).expect("must work");
let ali = ALIInstance::from_arp(arp, &worker).expect("is some");
let mut transcript = crate::transcript::Blake2sTranscript::new();
let alpha = Fr::from_str("123").unwrap();
transcript.commit_field_element(&alpha);
let g_poly_interpolant = ali.calculate_g(&mut transcript, witness_polys, &worker).expect("is some");
println!("G coefficients = {:?}", g_poly_interpolant);
assert!(g_poly_interpolant.as_ref()[3].is_zero());
let g_values = g_poly_interpolant.fft(&worker);
println!("G values = {:?}", g_values);
} | rust_cleaned_test_functions.jsonl/66876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
579,
64132,
45514,
62,
7956,
368,
341,
262,
990,
25539,
486,
1877,
280,
262,
990,
17717,
486,
22560,
280,
262,
990,
17717,
486,
1310,
486,
37,
579,
39345,
280,
262,
990,
17717,
486,
1310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_handle() {
let (s1, _s2) = zx::Socket::create(zx::SocketOpts::STREAM).unwrap();
let (bytes, handles) = TestInterfaceEvent::Handle { arg: s1.into_handle() }
.into_message(SENDER_ID)
.unwrap()
.take();
assert_eq!(bytes, HANDLE_MESSAGE_BYTES);
assert_eq!(handles.len(), 1);
assert!(!handles[0].is_invalid());
} | rust_cleaned_test_functions.jsonl/55807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
10630,
368,
341,
286,
1077,
320,
82,
16,
11,
716,
82,
17,
8,
284,
71322,
486,
10286,
486,
3182,
13174,
87,
486,
10286,
43451,
486,
54326,
568,
15454,
543,
286,
1077,
320,
9651,
11,
1346... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_weightedindex_serde1() {
let weighted_index = WeightedIndex::new(vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).unwrap();
let ser_weighted_index = bincode::serialize(&weighted_index).unwrap();
let de_weighted_index: WeightedIndex<i32> =
bincode::deserialize(&ser_weighted_index).unwrap();
assert_eq!(
de_weighted_index.cumulative_weights,
weighted_index.cumulative_weights
);
assert_eq!(de_weighted_index.total_weight, weighted_index.total_weight);
} | rust_cleaned_test_functions.jsonl/86247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
291,
1252,
75861,
450,
16,
368,
341,
286,
1077,
36824,
3560,
284,
16516,
291,
1552,
486,
931,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_on_null() {
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S(#[serde_as(as = "DefaultOnNull<DisplayFromStr>")] u32);
// Normal
is_equal(S(123), expect![[r#""123""#]]);
is_equal(S(0), expect![[r#""0""#]]);
// Null case
check_deserialization(S(0), r#"null"#);
// Error cases
check_error_deserialization::<S>(
r#""12+3""#,
expect![[r#"invalid digit found in string at line 1 column 6"#]],
);
check_error_deserialization::<S>(
r#""abc""#,
expect![[r#"invalid digit found in string at line 1 column 5"#]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S2(#[serde_as(as = "Vec<DefaultOnNull>")] Vec<u32>);
// Normal
is_equal(
S2(vec![1, 2, 0, 3]),
expect![[r#"
[
1,
2,
0,
3
]"#]],
);
is_equal(S2(vec![]), expect![[r#"[]"#]]);
// Null cases
check_deserialization(S2(vec![1, 0, 2]), r#"[1, null, 2]"#);
check_error_deserialization::<S2>(
r#"["not_a_number"]"#,
expect![[r#"invalid type: string "not_a_number", expected u32 at line 1 column 15"#]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S3(#[serde_as(as = "Vec<DefaultOnNull<DisplayFromStr>>")] Vec<u32>);
// Normal
is_equal(
S3(vec![1, 2, 3]),
expect![[r#"
[
"1",
"2",
"3"
]"#]],
);
// Null case
check_deserialization(S3(vec![0, 3, 0]), r#"[null,"3",null]"#);
check_error_deserialization::<S3>(
r#"[null,3,null]"#,
expect![[r#"invalid type: integer `3`, expected a string at line 1 column 7"#]],
);
} | rust_cleaned_test_functions.jsonl/105404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 980
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
4470,
15162,
368,
341,
262,
11506,
47024,
11898,
921,
262,
11506,
27098,
42618,
11,
39900,
11,
48440,
11,
55039,
5563,
262,
2036,
328,
7,
13353,
47024,
11898,
36951,
284,
330,
3675,
1925,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_expr() {
test_walk(
"[1,2,3]",
vec![
"File",
"ExprStmt",
"ArrayExpr",
"IntegerLit",
"IntegerLit",
"IntegerLit",
],
)
} | rust_cleaned_test_functions.jsonl/3315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
21915,
368,
341,
310,
1273,
56131,
1006,
394,
10545,
16,
11,
17,
11,
18,
45016,
394,
7486,
90515,
503,
330,
1703,
756,
503,
330,
16041,
31063,
756,
503,
330,
1857,
16041,
756,
503,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mul_vector_and_scalar() {
let vector = Vector {
x: 1.0,
y: 1.5,
z: 2.0,
};
let scalar = 2.0;
let expected_result = Vector {
x: 2.0,
y: 3.0,
z: 4.0,
};
assert_eq!(vector * scalar, expected_result);
assert_eq!(vector * scalar, expected_result);
assert_eq!(scalar * vector, expected_result);
assert_eq!(scalar * vector, expected_result);
} | rust_cleaned_test_functions.jsonl/134056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
12247,
8378,
41652,
368,
341,
286,
1077,
4621,
284,
4196,
341,
310,
856,
25,
220,
16,
13,
15,
345,
310,
379,
25,
220,
16,
13,
20,
345,
310,
1147,
25,
220,
17,
13,
15,
345,
286,
2605... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_client_state_with_initreboot_returns_initreboot() {
let mut msg = new_test_request();
msg.options.remove(2);
let got = get_client_state(&msg);
assert_eq!(got, ClientState::InitReboot);
} | rust_cleaned_test_functions.jsonl/61731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8179,
4387,
6615,
6137,
265,
4619,
58900,
6137,
265,
4619,
368,
341,
286,
1077,
5206,
3750,
284,
501,
4452,
7893,
543,
286,
3750,
10912,
4850,
7,
17,
626,
286,
1077,
2684,
284,
633,
8179,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bits() {
assert!(Flags::from_bits(0) == Some(Flags::empty()));
assert!(Flags::from_bits(0b1) == Some(FlagA));
assert!(Flags::from_bits(0b10) == Some(FlagB));
assert!(Flags::from_bits(0b11) == Some(FlagA | FlagB));
assert!(Flags::from_bits(0b1000) == None);
assert!(AnotherSetOfFlags::from_bits(!0_i8) == Some(AnotherFlag));
} | rust_cleaned_test_functions.jsonl/13423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
20034,
368,
341,
286,
2060,
10297,
9195,
486,
1499,
20034,
7,
15,
8,
621,
4329,
7,
9195,
486,
3194,
7392,
286,
2060,
10297,
9195,
486,
1499,
20034,
7,
15,
65,
16,
8,
621,
4329,
7,
1213... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_for_of_statement() {
expect_printed("for (const a of items) {}", "for (const a of items) {}");
expect_printed("for (var a of items) {}", "for (var a of items) {}");
expect_printed("for (let a of items) {}", "for (let a of items) {}");
expect_printed(
"for (let a of items) { return 3 + 3; }",
"for (let a of items) { return 3 + 3;\n }",
);
} | rust_cleaned_test_functions.jsonl/93426 | {
"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,
5478,
3575,
37404,
368,
341,
262,
1720,
10064,
291,
445,
1958,
320,
1024,
264,
315,
3589,
8,
24689,
330,
1958,
320,
1024,
264,
315,
3589,
8,
4687,
797,
262,
1720,
10064,
291,
445,
1958,
320,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop_tail() {
let mut ll = LinkedList::<u8>::new();
let node = ll.push_tail(11);
assert_node!(ll, node, ONLY, 11, 1);
//now pop the tail
assert_eq!(ll.pop_tail(), Some(11));
assert_empty!(ll);
//now push two nodes
ll.push_head(11);
let second = ll.push_head(12);
assert_eq!(ll.len(), 2);
//now pop the tail
assert_eq!(ll.pop_tail(), Some(11));
assert_node!(ll, second, ONLY, 12, 1);
//now pop the head again
assert_eq!(ll.pop_tail(), Some(12));
assert_empty!(ll);
//now push 3 nodes node
ll.push_head(11);
let second = ll.push_head(12);
let third = ll.push_head(13);
assert_eq!(ll.len(), 3);
//pop the tail
assert_eq!(ll.pop_tail(), Some(11));
assert_node!(ll, second, LAST, 12, 2);
assert_node!(ll, third, FIRST, 13, 2);
//pop the head again
assert_eq!(ll.pop_tail(), Some(12));
assert_node!(ll, third, ONLY, 13, 1);
//pop the head for the last time
assert_eq!(ll.pop_tail(), Some(13));
assert_empty!(ll);
} | rust_cleaned_test_functions.jsonl/59885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
35471,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
931,
543,
286,
1077,
2436,
284,
9323,
2552,
35471,
7,
16,
16,
317,
286,
2060,
5084,
10297,
654,
11,
2436,
11,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_true() {
let gil = Python::acquire_gil();
let py = gil.python();
assert!(PyBool::new(py, true).is_true());
let t: &PyObjectRef = PyBool::new(py, true).into();
assert_eq!(true, t.extract().unwrap());
assert!(true.to_object(py) == PyBool::new(py, true).into());
} | rust_cleaned_test_functions.jsonl/112698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16082,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
2060,
10297,
13828,
11233,
486,
931,
46827,
11,
830,
568,
285,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_chunk_response_waypoint() {
// Create a coordinator for a validator node with waypoint version of 10
let waypoint_ledger_info = create_ledger_info_at_version(10);
let waypoint = Waypoint::new_any(waypoint_ledger_info.ledger_info());
let mut validator_coordinator =
create_coordinator_with_config_and_waypoint(NodeConfig::default(), waypoint);
// Create a peer for the node and add the peer as a known peer
let peer_network_id = PeerNetworkId::random_validator();
process_new_peer_event(&mut validator_coordinator, &peer_network_id);
// Verify wrong chunk type for non-waypoint messages
let chunk_responses = create_non_empty_chunk_responses(1);
verify_all_chunk_responses_are_the_wrong_type(
&mut validator_coordinator,
&peer_network_id,
&chunk_responses[1..=2], // Ignore the waypoint chunk response
);
// Verify end of epoch version is less than waypoint version
let response_ledger_info = ResponseLedgerInfo::LedgerInfoForWaypoint {
waypoint_li: create_ledger_info_at_version(10),
end_of_epoch_li: Some(create_ledger_info_at_version(100)),
};
let waypoint_response = create_chunk_response_message(
response_ledger_info,
create_dummy_transaction_list_with_proof(1),
);
verify_all_chunk_responses_are_invalid(
&mut validator_coordinator,
&peer_network_id,
&[waypoint_response],
);
// Verify that invalid waypoint ledger infos are rejected
let response_ledger_info = ResponseLedgerInfo::LedgerInfoForWaypoint {
waypoint_li: create_ledger_info_at_version(10),
end_of_epoch_li: Some(create_ledger_info_at_version(10)),
};
let waypoint_response = create_chunk_response_message(
response_ledger_info,
create_dummy_transaction_list_with_proof(1),
);
verify_all_chunk_responses_are_invalid(
&mut validator_coordinator,
&peer_network_id,
&[waypoint_response],
);
} | rust_cleaned_test_functions.jsonl/84051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 977
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
30539,
9655,
48936,
2768,
368,
341,
286,
442,
4230,
264,
30284,
369,
264,
22935,
2436,
448,
65176,
2319,
315,
220,
16,
15,
198,
286,
1077,
65176,
38367,
1389,
3109,
284,
1855,
38367,
1389,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_optopt() {
let long_args = vec!["--test=20".to_string()];
let mut opts = Options::new();
opts.optopt("t", "test", "testing", "TEST");
match opts.parse(&long_args) {
Ok(ref m) => {
assert!(m.opt_present("test"));
assert_eq!(m.opt_str("test").unwrap(), "20");
assert!((m.opt_present("t")));
assert_eq!(m.opt_str("t").unwrap(), "20");
}
_ => panic!(),
}
let short_args = vec!["-t".to_string(), "20".to_string()];
match opts.parse(&short_args) {
Ok(ref m) => {
assert!((m.opt_present("test")));
assert_eq!(m.opt_str("test").unwrap(), "20");
assert!((m.opt_present("t")));
assert_eq!(m.opt_str("t").unwrap(), "20");
}
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/52358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
2912,
368,
341,
262,
1077,
1293,
8384,
284,
7486,
0,
1183,
313,
1944,
28,
17,
15,
3263,
983,
3904,
33800,
262,
1077,
5206,
12185,
284,
14566,
486,
931,
543,
262,
12185,
28102,
2912,
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... | 3 |
#[test]
fn test_boolean_equal_nulls() {
let a = BooleanArray::from(vec![Some(false), None, None, Some(true)]);
let a = a.data();
let b = BooleanArray::from(vec![Some(false), None, None, Some(true)]);
let b = b.data();
test_equal(&a, &b, true);
let b = BooleanArray::from(vec![None, None, None, Some(true)]);
let b = b.data();
test_equal(&a, &b, false);
let b = BooleanArray::from(vec![Some(true), None, None, Some(true)]);
let b = b.data();
test_equal(&a, &b, false);
} | rust_cleaned_test_functions.jsonl/24205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
11478,
15162,
82,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
25592,
20703,
8373,
3576,
701,
2240,
11,
2240,
11,
4329,
3715,
41958,
286,
1077,
264,
284,
264,
2196,
543,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_count_trailing_whitespace() {
assert_eq!(count_trailing_whitespace(" 1 "), 1);
assert_eq!(count_trailing_whitespace(" 2 "), 2);
assert_eq!(count_trailing_whitespace(" 3 \n"), 3);
} | rust_cleaned_test_functions.jsonl/98565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
3547,
14277,
86175,
368,
341,
286,
2060,
10714,
10297,
1830,
3547,
14277,
86175,
445,
220,
16,
59312,
220,
16,
317,
286,
2060,
10714,
10297,
1830,
3547,
14277,
86175,
445,
220,
17,
220,
5931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_vch_jada() {
#[cfg(feature = "v3")]
init_psa_crypto();
let vch = Voucher::try_from(VCH_JADA).unwrap();
assert!(vch.get_signer_cert().is_some());
assert!(vch.validate(None).is_ok());
} | rust_cleaned_test_functions.jsonl/81736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
2273,
331,
5374,
2584,
368,
341,
262,
11506,
14072,
27062,
284,
330,
85,
18,
5422,
262,
2930,
620,
9081,
78298,
1428,
262,
1077,
348,
331,
284,
647,
23937,
486,
1539,
5673,
12410,
2149,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_snippet() {
let snippet = "fn main() { println!(\"hello, world\"); }";
#[cfg(not(windows))]
let expected = "fn main() {\n \
println!(\"hello, world\");\n\
}\n";
#[cfg(windows)]
let expected = "fn main() {\r\n \
println!(\"hello, world\");\r\n\
}\r\n";
assert!(test_format_inner(format_snippet, snippet, expected));
} | rust_cleaned_test_functions.jsonl/6863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
28022,
21581,
368,
341,
286,
1077,
43065,
284,
330,
8822,
1887,
368,
314,
13751,
10297,
2105,
14990,
11,
1879,
59,
5038,
335,
876,
286,
11506,
14072,
24772,
3622,
1491,
22297,
286,
1077,
360... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_first_available_block() {
let mint_total = 1_000_000_000_000;
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(mint_total);
let (ledger_path, _blockhash) = create_new_tmp_ledger_auto_delete!(&genesis_config);
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
assert_eq!(blockstore.get_first_available_block().unwrap(), 0);
assert_eq!(blockstore.lowest_slot_with_genesis(), 0);
assert_eq!(blockstore.lowest_slot(), 0);
for slot in 1..4 {
let entries = make_slot_entries_with_transactions(100);
let shreds = entries_to_test_shreds(&entries, slot, slot - 1, true, 0);
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.set_roots(vec![slot].iter()).unwrap();
}
assert_eq!(blockstore.get_first_available_block().unwrap(), 0);
assert_eq!(blockstore.lowest_slot_with_genesis(), 0);
assert_eq!(blockstore.lowest_slot(), 1);
blockstore.purge_slots(0, 1, PurgeType::CompactionFilter);
assert_eq!(blockstore.get_first_available_block().unwrap(), 3);
assert_eq!(blockstore.lowest_slot_with_genesis(), 2);
assert_eq!(blockstore.lowest_slot(), 2);
} | rust_cleaned_test_functions.jsonl/11709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12978,
26962,
7113,
368,
341,
286,
1077,
28337,
10784,
284,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
280,
286,
1077,
40788,
2648,
1731,
314,
59366,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_date_subassignment() {
let ymd = NaiveDate::from_ymd;
let mut date = ymd(2016, 10, 11);
date -= Duration::days(10);
assert_eq!(date, ymd(2016, 10, 1));
date -= Duration::days(2);
assert_eq!(date, ymd(2016, 9, 29));
} | rust_cleaned_test_functions.jsonl/4771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
5228,
29951,
368,
341,
286,
1077,
379,
2277,
284,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
280,
286,
1077,
5206,
2400,
284,
379,
2277,
7,
17,
15,
16,
21,
11,
220,
16,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_code_from_conversion() {
let val: i16 = 6;
let erro_code: ErrorCode = val.try_into().expect("convert");
assert_eq!(erro_code, ErrorCode::NotLeaderForPartition);
} | rust_cleaned_test_functions.jsonl/14 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
4136,
5673,
64132,
368,
341,
286,
1077,
1044,
25,
600,
16,
21,
284,
220,
21,
280,
286,
1077,
36310,
4136,
25,
60084,
284,
1044,
48779,
45514,
1005,
17119,
445,
14166,
797,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_insert_vote() {
::libra_logger::Logger::new().environment_only(true).init();
// Set up enough different authors to support different votes for the same block.
let (signers, validator_verifier) = random_validator_verifier(11, Some(10), false);
let my_signer = signers[10].clone();
let mut inserter = TreeInserter::new(my_signer);
let block_store = inserter.block_store();
let genesis = block_store.root();
let block = inserter.insert_block_with_qc(certificate_for_genesis(), &genesis, 1);
let mut pending_votes = PendingVotes::new();
assert!(block_store.get_quorum_cert_for_block(block.id()).is_none());
for (i, voter) in signers.iter().enumerate().take(10).skip(1) {
let executed_state = &block.compute_result().executed_state;
let vote = Vote::new(
VoteData::new(
block.block().gen_block_info(
executed_state.state_id,
executed_state.version,
executed_state.validators.clone(),
),
block.quorum_cert().certified_block().clone(),
),
voter.author(),
placeholder_ledger_info(),
voter,
);
let vote_res = pending_votes.insert_vote(&vote, &validator_verifier);
// first vote of an author is accepted
assert_eq!(vote_res, VoteReceptionResult::VoteAdded(i as u64));
// filter out duplicates
assert_eq!(
pending_votes.insert_vote(&vote, &validator_verifier),
VoteReceptionResult::DuplicateVote,
);
// qc is still not there
assert!(block_store.get_quorum_cert_for_block(block.id()).is_none());
}
// Add the final vote to form a QC
let executed_state = &block.compute_result().executed_state;
let final_voter = &signers[0];
let vote = Vote::new(
VoteData::new(
block.block().gen_block_info(
executed_state.state_id,
executed_state.version,
executed_state.validators.clone(),
),
block.quorum_cert().certified_block().clone(),
),
final_voter.author(),
placeholder_ledger_info(),
final_voter,
);
match pending_votes.insert_vote(&vote, &validator_verifier) {
VoteReceptionResult::NewQuorumCertificate(qc) => {
assert_eq!(qc.certified_block().id(), block.id());
block_store
.insert_single_quorum_cert(qc.as_ref().clone())
.unwrap();
}
_ => {
panic!("QC not formed!");
}
}
let block_qc = block_store.get_quorum_cert_for_block(block.id()).unwrap();
assert_eq!(block_qc.certified_block().id(), block.id());
} | rust_cleaned_test_functions.jsonl/50987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
54360,
368,
341,
262,
3504,
2740,
956,
27413,
486,
7395,
486,
931,
1005,
23294,
18410,
3715,
568,
2327,
543,
262,
442,
2573,
705,
3322,
2155,
12014,
311,
1824,
2155,
12684,
369,
279,
1852,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_net_device() {
let mut vm_resources = default_vm_resources();
// Clone the existing net config in order to obtain a new one.
let mut new_net_device_cfg = vm_resources
.network_interface
.iter()
.next()
.unwrap()
.clone();
new_net_device_cfg.iface_id = "new_net_if".to_string();
new_net_device_cfg.guest_mac = Some(MacAddr::parse_str("01:23:45:67:89:0c").unwrap());
new_net_device_cfg.host_dev_name = "dummy_path2".to_string();
assert_eq!(vm_resources.network_interface.len(), 1);
vm_resources.set_net_device(new_net_device_cfg).unwrap();
assert_eq!(vm_resources.network_interface.len(), 2);
} | rust_cleaned_test_functions.jsonl/51474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
19722,
9204,
368,
341,
286,
1077,
5206,
10995,
35569,
284,
1638,
39008,
35569,
1428,
286,
442,
27913,
279,
6350,
4179,
2193,
304,
1973,
311,
6851,
264,
501,
825,
624,
286,
1077,
5206,
501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ice_protocol_string() {
let tests = vec![
(RTCIceProtocol::Unspecified, "Unspecified"),
(RTCIceProtocol::Udp, "udp"),
(RTCIceProtocol::Tcp, "tcp"),
];
for (proto, expected_string) in tests {
assert_eq!(expected_string, proto.to_string());
}
} | rust_cleaned_test_functions.jsonl/133806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
558,
34880,
3904,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
5350,
11237,
346,
20689,
486,
1806,
53434,
11,
330,
1806,
53434,
4461,
310,
320,
5350,
11237,
346,
20689,
486,
52,
97... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_make_gaussian_vec_mechanism() -> Fallible<()> {
let measurement = make_base_gaussian::<VectorDomain<_>>(1.0)?;
let arg = vec![0.0, 1.0];
let _ret = measurement.invoke(&arg)?;
assert!(measurement.check(&0.1, &(0.5, 0.00001))?);
Ok(())
} | rust_cleaned_test_functions.jsonl/55701 | {
"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,
28230,
1889,
46972,
13251,
717,
4737,
67813,
368,
1464,
14785,
1238,
71698,
341,
286,
1077,
18662,
284,
1281,
7651,
1889,
46972,
27638,
3781,
13636,
32399,
25526,
16,
13,
15,
40007,
286,
1077,
1392,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_scalar_repr_display() {
assert_eq!(
format!(
"{}",
ScalarRepr::new([
0x2829c242fa826143,
0x1f32cf4dd4330917,
0x932e4e479d168cd9,
0x513c77587f563f64
])
),
"0x513c77587f563f64932e4e479d168cd91f32cf4dd43309172829c242fa826143".to_string()
);
assert_eq!(
format!(
"{}",
ScalarRepr::new([
0x25ebe3a3ad3c0c6a,
0x6990e39d092e817c,
0x941f900d42f5658e,
0x44f8a103b38a71e0
])
),
"0x44f8a103b38a71e0941f900d42f5658e6990e39d092e817c25ebe3a3ad3c0c6a".to_string()
);
assert_eq!(
format!(
"{}",
ScalarRepr::new([
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff
])
),
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff".to_string()
);
assert_eq!(
format!("{}", ScalarRepr::new([0, 0, 0, 0])),
"0x0000000000000000000000000000000000000000000000000000000000000000".to_string()
);
} | rust_cleaned_test_functions.jsonl/56406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 958
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
68535,
14825,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
33673,
394,
35503,
756,
394,
35176,
693,
649,
486,
931,
8956,
503,
220,
15,
87,
17,
23,
17,
24,
66,
17,
19,
17,
3632,
23,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fvm_truncated_header() {
let header_invalid_magic = FvmHeader {
magic: FVM_MAGIC,
version: FVM_VERSION,
pslice_count: 1,
slice_size: FVM_BLOCK_SIZE,
fvm_partition_size: FVM_BLOCK_SIZE,
vpartition_table_size: FVM_BLOCK_SIZE,
allocation_table_size: FVM_BLOCK_SIZE,
generation: 0,
hash: vec![0u8; GPT_GUID_LEN],
};
let mut fvm_bytes = bincode::serialize(&header_invalid_magic).unwrap();
fvm_bytes.pop();
let mut reader = FvmReader::new(fvm_bytes);
let result = reader.parse();
assert_eq!(result.is_err(), true);
} | rust_cleaned_test_functions.jsonl/67407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
7338,
3547,
38007,
8757,
368,
341,
286,
1077,
4247,
31433,
54612,
284,
434,
7338,
4047,
341,
310,
10963,
25,
434,
11187,
49194,
345,
310,
2319,
25,
434,
11187,
10678,
345,
310,
4726,
4754,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_counter() {
let mut c = 0u32;
let (c_get, c_set) = counter_pair(&mut c);
assert_eq!(c_get.get(), 0);
assert_eq!(c_set.get(), 0);
c_set.set(1);
assert_eq!(c_get.get(), 1);
assert_eq!(c_set.get(), 1);
} | rust_cleaned_test_functions.jsonl/106118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15730,
368,
341,
286,
1077,
5206,
272,
284,
220,
15,
84,
18,
17,
280,
286,
1077,
320,
66,
3062,
11,
272,
2602,
8,
284,
5546,
14445,
2099,
6984,
272,
317,
286,
2060,
10714,
10297,
66,
3062,
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_lower_case_name_icon_match() {
let dir = tempdir();
dir.child(".trash").touch().unwrap();
let test_file = dir.path().join(".trash");
cmd()
.arg("--icon")
.arg("always")
.arg("--ignore-config")
.arg(test_file)
.assert()
.stdout(predicate::str::contains("\u{f1f8}"));
} | rust_cleaned_test_functions.jsonl/647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30425,
19096,
1269,
15648,
10708,
368,
341,
262,
1077,
5419,
284,
2730,
3741,
543,
262,
5419,
17531,
5680,
68826,
1827,
22020,
1005,
15454,
543,
262,
1077,
1273,
2458,
284,
5419,
3875,
1005,
5987,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_radio_mock_set_state() {
let mut radio = MockRadio::new(&[Transaction::set_state(MockState::Idle, None)]);
radio.set_state(MockState::Idle).unwrap();
radio.done();
} | rust_cleaned_test_functions.jsonl/35584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49740,
34134,
2602,
4387,
368,
341,
286,
1077,
5206,
8887,
284,
14563,
28203,
486,
931,
2099,
58,
8070,
486,
746,
4387,
66436,
1397,
486,
41370,
11,
2240,
7252,
626,
286,
8887,
980,
4387,
66436,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_line() {
let empty = Rope::default();
assert_eq!((empty.slice(..), empty.slice(..)), line(&empty.slice(..)));
let newline = Rope::from("\n");
assert_eq!(
(empty.slice(..), newline.slice(..)),
line(&newline.slice(..))
);
let term = Rope::from("* Hello\n");
assert_eq!(
(term.slice(..term.len_chars() - 1), newline.slice(..)),
line(&term.slice(..))
);
let multi = Rope::from("* Hello\nWorld");
assert_eq!(
(
Rope::from("* Hello").slice(..),
Rope::from("\nWorld").slice(..)
),
line(&multi.slice(..))
);
} | rust_cleaned_test_functions.jsonl/129954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
368,
341,
286,
1077,
4287,
284,
97896,
486,
2258,
543,
286,
2060,
10714,
0,
1188,
3194,
14530,
56422,
701,
4287,
14530,
56422,
5731,
1555,
2099,
3194,
14530,
56422,
22525,
286,
1077,
39027,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_perfect_matching() {
let haystack = "111 a 111b".to_string();
let needle = "111 a 111b".to_string();
search_test!(&haystack, &needle, Some(0));
} | rust_cleaned_test_functions.jsonl/19407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5678,
3751,
70763,
368,
341,
286,
1077,
88447,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
3263,
983,
3904,
543,
286,
1077,
30309,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
3263,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_PoK_multiple_sigs_with_same_msg() {
// Prove knowledge of multiple signatures and the equality of a specific message under both signatures.
// Knowledge of 2 signatures and their corresponding messages is being proven.
// 2nd message in the 1st signature and 5th message in the 2nd signature are to be proven equal without revealing them
let count_msgs = 5;
let params = Params::new("test".as_bytes());
let (vk, sk) = keygen(count_msgs, ¶ms);
let same_msg = FieldElement::random();
let mut msgs_1 = FieldElementVector::random(count_msgs - 1);
msgs_1.insert(1, same_msg.clone());
let sig_1 = Signature::new(msgs_1.as_slice(), &sk, ¶ms).unwrap();
assert!(sig_1.verify(msgs_1.as_slice(), &vk, ¶ms).unwrap());
let mut msgs_2 = FieldElementVector::random(count_msgs - 1);
msgs_2.insert(4, same_msg.clone());
let sig_2 = Signature::new(msgs_2.as_slice(), &sk, ¶ms).unwrap();
assert!(sig_2.verify(msgs_2.as_slice(), &vk, ¶ms).unwrap());
// A particular message is same
assert_eq!(msgs_1[1], msgs_2[4]);
let same_blinding = FieldElement::random();
let mut blindings_1 = FieldElementVector::random(count_msgs - 1);
blindings_1.insert(1, same_blinding.clone());
let mut blindings_2 = FieldElementVector::random(count_msgs - 1);
blindings_2.insert(4, same_blinding.clone());
// Blinding for the same message is kept same
assert_eq!(blindings_1[1], blindings_2[4]);
let pok_1 = PoKOfSignature::init(
&sig_1,
&vk,
¶ms,
msgs_1.as_slice(),
Some(blindings_1.as_slice()),
HashSet::new(),
)
.unwrap();
let pok_2 = PoKOfSignature::init(
&sig_2,
&vk,
¶ms,
msgs_2.as_slice(),
Some(blindings_2.as_slice()),
HashSet::new(),
)
.unwrap();
let mut chal_bytes = vec![];
chal_bytes.append(&mut pok_1.to_bytes());
chal_bytes.append(&mut pok_2.to_bytes());
let chal_prover = FieldElement::from_msg_hash(&chal_bytes);
let proof_1 = pok_1.gen_proof(&chal_prover).unwrap();
let proof_2 = pok_2.gen_proof(&chal_prover).unwrap();
// The verifier generates the challenge on its own.
let mut chal_bytes = vec![];
chal_bytes.append(&mut proof_1.get_bytes_for_challenge(HashSet::new(), &vk, ¶ms));
chal_bytes.append(&mut proof_2.get_bytes_for_challenge(HashSet::new(), &vk, ¶ms));
let chal_verifier = FieldElement::from_msg_hash(&chal_bytes);
assert_eq!(
proof_1.get_resp_for_message(1).unwrap(),
proof_2.get_resp_for_message(4).unwrap()
);
assert!(proof_1
.verify(&vk, ¶ms, HashMap::new(), &chal_verifier)
.unwrap());
assert!(proof_2
.verify(&vk, ¶ms, HashMap::new(), &chal_verifier)
.unwrap());
} | rust_cleaned_test_functions.jsonl/62473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1088,
78,
42,
45233,
643,
14462,
6615,
33574,
6483,
368,
341,
286,
442,
1298,
586,
6540,
315,
5248,
32628,
323,
279,
21777,
315,
264,
3151,
1943,
1212,
2176,
32628,
624,
286,
442,
31925,
315,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() {
assert_eq!(
parse("on x=-20..26,y=-36..17,z=-47..7"),
(
true,
(Cube {
x0: -20,
x1: 26,
y0: -36,
y1: 17,
z0: -47,
z1: 7
})
)
);
} | rust_cleaned_test_functions.jsonl/8202 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
445,
263,
856,
10829,
17,
15,
496,
17,
21,
7358,
10829,
18,
21,
496,
16,
22,
22669,
10829,
19,
22,
496,
22,
4461,
310,
2399,
394,
830,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bind_and_run() {
let mut tmp_socket = TempFile::new().unwrap();
tmp_socket.remove().unwrap();
let path_to_socket = tmp_socket.as_path().to_str().unwrap().to_owned();
let api_thread_path_to_socket = path_to_socket.clone();
let vmm_shared_info = Arc::new(RwLock::new(InstanceInfo {
started: false,
id: "test_handle_request".to_string(),
vmm_version: "version 0.1.0".to_string(),
app_name: "app name".to_string(),
}));
let to_vmm_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap();
let (api_request_sender, _from_api) = channel();
let (_to_api, vmm_response_receiver) = channel();
let mmds_info = MMDS.clone();
thread::Builder::new()
.name("fc_api_test".to_owned())
.spawn(move || {
ApiServer::new(
mmds_info,
vmm_shared_info,
api_request_sender,
vmm_response_receiver,
to_vmm_fd,
)
.expect("Cannot create API server")
.bind_and_run(
PathBuf::from(api_thread_path_to_socket),
Some(1),
Some(1),
SeccompFilter::empty().try_into().unwrap(),
)
.unwrap();
})
.unwrap();
// Wait for the server to set itself up.
thread::sleep(Duration::new(0, 10_000_000));
let mut sock = UnixStream::connect(PathBuf::from(path_to_socket)).unwrap();
// Send a GET instance-info request.
assert!(sock.write_all(b"GET / HTTP/1.1\r\n\r\n").is_ok());
let mut buf: [u8; 100] = [0; 100];
assert!(sock.read(&mut buf[..]).unwrap() > 0);
// Send an erroneous request.
assert!(sock.write_all(b"OPTIONS / HTTP/1.1\r\n\r\n").is_ok());
let mut buf: [u8; 100] = [0; 100];
assert!(sock.read(&mut buf[..]).unwrap() > 0);
} | rust_cleaned_test_functions.jsonl/23179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27461,
8378,
14007,
368,
341,
286,
1077,
5206,
4174,
19555,
284,
19944,
1703,
486,
931,
1005,
15454,
543,
286,
4174,
19555,
4850,
1005,
15454,
543,
286,
1077,
1815,
2346,
19555,
284,
4174,
19555,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_minimum_too_high() {
let array = [0u8; 2048];
FastCDC::new(&array, 67_108_867, 256, 1024);
} | rust_cleaned_test_functions.jsonl/32052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84855,
2346,
78,
22680,
368,
341,
286,
1077,
1334,
284,
508,
15,
84,
23,
26,
220,
17,
15,
19,
23,
935,
286,
17288,
73458,
486,
931,
2099,
1653,
11,
220,
21,
22,
62,
16,
15,
23,
62,
23,
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 |
#[test]
fn test_new_key_cmac_with_invalid_input() {
tink_mac::init();
let km = tink_core::registry::get_key_manager(tink_tests::AES_CMAC_TYPE_URL)
.expect("AES CMAC key manager not found");
// invalid key formats
let test_formats = gen_invalid_cmac_key_formats();
for (i, serialized_format) in test_formats.iter().enumerate() {
assert!(
km.new_key(serialized_format).is_err(),
"expect an error in test case {}",
i
);
}
// empty input
assert!(
km.new_key(&[]).is_err(),
"expect an error when input is empty"
);
} | rust_cleaned_test_functions.jsonl/37674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
3097,
666,
11948,
6615,
31433,
5898,
368,
341,
262,
90584,
22802,
486,
2327,
543,
262,
1077,
13136,
284,
90584,
15467,
486,
29172,
486,
455,
3097,
12144,
1155,
766,
32509,
486,
69168,
920,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sql_lexer_numbers() {
use super::Token::*;
assert_eq!(parse("12345"), vec![number("12345")]);
assert_eq!(parse("0.25"), vec![number("0.25")]);
assert_eq!(parse("0.25 + -0.25"), vec![number("0.25"), Plus, Minus, number("0.25")]);
assert_eq!(parse("-0.25 + 0.25"), vec![Minus, number("0.25"), Plus, number("0.25")]);
assert_eq!(parse("- 0.25 - -0.25"), vec![Minus, number("0.25"), Minus, Minus, number("0.25")]);
assert_eq!(parse("- 0.25 --0.25"), vec![Minus, number("0.25")]);
assert_eq!(parse("0.25 -0.25"), vec![number("0.25"), Minus, number("0.25")]);
} | rust_cleaned_test_functions.jsonl/94436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18063,
62,
38815,
32964,
368,
341,
286,
990,
2256,
486,
3323,
79304,
286,
2060,
10714,
10297,
6400,
445,
16,
17,
18,
19,
20,
3975,
7486,
20703,
4082,
445,
16,
17,
18,
19,
20,
899,
2558,
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_aff_sidh() {
fn aux(a_sk: MyASc, b_sk: MyBSc) {
let a_sk = a_sk.0;
let b_sk = b_sk.0;
let e = (a(), b());
let ab = (paxy(), qaxy());
let bb = (pbxy(), qbxy());
let a_steps = 2; // EA;
let b_steps = 2; // EB;
let (a_e, a_bb) = a_sidh_isogen(a_sk, e, ab, bb, a_steps);
let (b_e, b_ab) = b_sidh_isogen(b_sk, e, bb, ab, b_steps);
let a_shared_secret = a_sidh_isoex(a_sk, b_e, b_ab, b_steps);
let b_shared_secret = b_sidh_isoex(b_sk, a_e, a_bb, a_steps);
assert_eq!(a_shared_secret,b_shared_secret);
}
QuickCheck::new()
.tests(1)
.quickcheck(aux as fn(MyASc, MyBSc));
} | rust_cleaned_test_functions.jsonl/11562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
53044,
71,
368,
341,
262,
5168,
10047,
2877,
33811,
25,
3017,
1911,
66,
11,
293,
33811,
25,
3017,
33,
3326,
8,
341,
10217,
264,
33811,
284,
264,
33811,
13,
15,
280,
10217,
293,
33811,
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_raw_node_step() {
setup_for_test();
for msg_t in 0..18 {
let msg_t = MessageType::from_i32(msg_t).unwrap();
if vec![
// Vote messages with term 0 will cause panics.
MessageType::MsgRequestVote,
MessageType::MsgRequestPreVote,
// MsgAppend and MsgSnapshot with log term 0 will cause test code panics.
MessageType::MsgAppend,
MessageType::MsgSnapshot,
]
.contains(&msg_t)
{
continue;
}
let mut raw_node = new_raw_node(1, vec![1], 10, 1, new_storage());
let res = raw_node.step(new_message(0, 0, msg_t, 0));
// local msg should be ignored.
if vec![
MessageType::MsgBeat,
MessageType::MsgHup,
MessageType::MsgUnreachable,
MessageType::MsgSnapStatus,
]
.contains(&msg_t)
{
assert_eq!(res, Err(Error::StepLocalMsg));
}
}
} | rust_cleaned_test_functions.jsonl/50332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
11946,
368,
341,
262,
6505,
5478,
4452,
543,
262,
369,
3750,
528,
304,
220,
15,
496,
16,
23,
341,
286,
1077,
3750,
528,
284,
62336,
486,
1499,
5318,
18,
17,
8119,
528,
568,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_interval_day_time_column_reader() {
let converter = IntervalDayTimeArrayConverter {};
run_single_column_reader_tests::<
FixedLenByteArrayType,
IntervalDayTimeArray,
IntervalDayTimeArrayConverter,
RandFixedLenGen,
>(
12,
ConvertedType::INTERVAL,
None,
&converter,
&[Encoding::PLAIN, Encoding::RLE_DICTIONARY],
);
} | rust_cleaned_test_functions.jsonl/83375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20541,
16763,
3009,
8744,
22306,
368,
341,
286,
1077,
27058,
284,
40584,
10159,
1462,
1857,
14920,
9321,
286,
1598,
19487,
8744,
22306,
32509,
27638,
198,
310,
20149,
11271,
18394,
929,
345,
310,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fast_scale_and_translate() {
let point = Point2::new(42i8, -34i8);
let transform = Similarity2::from_isometry(
Isometry2::translation(100f32, 150f32),
50f32,
);
let transform = ISimilarity2::from(transform);
assert_eq!(
transform.transform_point_i8(point),
Point2::new(108i32, 143i32)
);
} | rust_cleaned_test_functions.jsonl/21376 | {
"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,
35743,
16727,
8378,
66381,
368,
341,
286,
1077,
1459,
284,
5126,
17,
486,
931,
7,
19,
17,
72,
23,
11,
481,
18,
19,
72,
23,
317,
286,
1077,
5165,
284,
21476,
487,
17,
486,
1499,
6892,
6988,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_tuple() {
let bser_v2 =
b"\x00\x02\x00\x00\x00\x00\x05\x11\x00\x00\x00\x00\x03\x02\x02\x03\x03Tom\x02\x03\x05Jerry";
let decoded = from_slice::<TwoBytestrings>(bser_v2).unwrap();
assert_eq!(decoded.0, &b"Tom"[..]);
assert_eq!(decoded.1, &b"Jerry"[..]);
} | rust_cleaned_test_functions.jsonl/34065 | {
"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,
34729,
21773,
368,
341,
262,
1077,
293,
799,
2273,
17,
4035,
286,
293,
11934,
87,
15,
15,
3462,
15,
17,
3462,
15,
15,
3462,
15,
15,
3462,
15,
15,
3462,
15,
15,
3462,
15,
20,
3462,
16,
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_flags_from_vec_35() {
let (flags, subcommand, argv) =
flags_from_vec(svec!["deno", "--current-thread", "script.ts"]);
assert_eq!(
flags,
DenoFlags {
current_thread: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(argv, svec!["deno", "script.ts"])
} | rust_cleaned_test_functions.jsonl/112864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5673,
13251,
62,
18,
20,
368,
341,
262,
1077,
320,
11161,
11,
1186,
5631,
11,
10213,
8,
4035,
414,
8042,
5673,
13251,
1141,
4083,
0,
1183,
5183,
78,
497,
14482,
3231,
60804,
497,
330,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_request() {
let mut r = Reader::new();
r.state = State::Len;
let v = vec![0u8, 0, 0, 13, 6, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1];
let mut data = Cursor::new(&v);
// Test one shot
match r.readable(&mut data).unwrap().unwrap() {
Message::Request {
index,
begin,
length,
} => {
assert_eq!(index, 1);
assert_eq!(begin, 1);
assert_eq!(length, 1);
}
_ => {
unreachable!();
}
}
} | rust_cleaned_test_functions.jsonl/46450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
7893,
368,
341,
286,
1077,
5206,
435,
284,
25166,
486,
931,
543,
286,
435,
3467,
284,
3234,
486,
11271,
280,
286,
1077,
348,
284,
7486,
20703,
15,
84,
23,
11,
220,
15,
11,
220,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rsplitn() {
let data = "\nMäry häd ä little lämb\nLittle lämb\n";
let split: Vec<&str> = data.rsplitn(2, ' ').collect();
assert_eq!(split, ["lämb\n", "\nMäry häd ä little lämb\nLittle"]);
let split: Vec<&str> = data.rsplitn(2, "lämb").collect();
assert_eq!(split, ["\n", "\nMäry häd ä little lämb\nLittle "]);
let split: Vec<&str> = data.rsplitn(2, |c: char| c == 'ä').collect();
assert_eq!(split, ["mb\n", "\nMäry häd ä little lämb\nLittle l"]);
} | rust_cleaned_test_functions.jsonl/17645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
6960,
77,
368,
341,
262,
1077,
821,
284,
2917,
77,
44,
2305,
884,
305,
30875,
12709,
2632,
30005,
3096,
1699,
38103,
30005,
3096,
1699,
3302,
262,
1077,
6718,
25,
11312,
52244,
495,
29,
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_format_duration_unit_basic() {
let (out_str, out_unit) = format_duration_unit(1.3, None);
assert_eq!("1.300 s", out_str);
assert_eq!(Unit::Second, out_unit);
let (out_str, out_unit) = format_duration_unit(1.0, None);
assert_eq!("1.000 s", out_str);
assert_eq!(Unit::Second, out_unit);
let (out_str, out_unit) = format_duration_unit(0.999, None);
assert_eq!("999.0 ms", out_str);
assert_eq!(Unit::MilliSecond, out_unit);
let (out_str, out_unit) = format_duration_unit(0.0, None);
assert_eq!("0.0 ms", out_str);
assert_eq!(Unit::MilliSecond, out_unit);
let (out_str, out_unit) = format_duration_unit(1000.0, None);
assert_eq!("1000.000 s", out_str);
assert_eq!(Unit::Second, out_unit);
} | rust_cleaned_test_functions.jsonl/30732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
25454,
14832,
34729,
368,
341,
262,
1077,
320,
411,
2895,
11,
700,
14832,
8,
284,
3561,
25454,
14832,
7,
16,
13,
18,
11,
2240,
626,
262,
2060,
10714,
17223,
16,
13,
18,
15,
15,
274,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vrf_group_hash_gen() {
let personalization = constants::VRF_GROUP_HASH_GENERATORS_PERSONALIZATION;
//Gen1
let tag = b"Magnesium Mg 12";
let htc_g1_out = hash_to_curve::<FieldElement, G2>(tag, personalization)
.unwrap()
.into_projective();
//Gen2
let tag = b"Gold Au 79";
let htc_g2_out = hash_to_curve::<FieldElement, G2>(tag, personalization)
.unwrap()
.into_projective();
//Check GH generators
let gh_generators = VRFParams::compute_group_hash_table([htc_g1_out, htc_g2_out].to_vec());
println!("{:#?}", htc_g1_out);
println!("{:#?}", htc_g2_out);
assert_eq!(gh_generators, VRFParams::new().group_hash_generators);
} | rust_cleaned_test_functions.jsonl/13383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
8052,
6288,
8950,
16322,
368,
341,
286,
1077,
4345,
2022,
284,
18021,
486,
53,
17612,
20130,
32309,
18693,
60345,
73428,
969,
49025,
401,
286,
442,
9967,
16,
198,
286,
1077,
4772,
284,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_len_bytes_with_string() {
let mut output = String::new();
let method = StringMethod {
method: "len_bytes",
variable: "\"oh là là\"",
pattern: "",
selection: Select::All,
};
method.handle(&mut output, &VariableExpander);
assert_eq!(output, "10");
} | rust_cleaned_test_functions.jsonl/85293 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
12524,
6615,
3904,
368,
341,
286,
1077,
5206,
2550,
284,
923,
486,
931,
543,
286,
1077,
1714,
284,
923,
3523,
341,
310,
1714,
25,
262,
330,
2892,
12524,
756,
310,
3890,
25,
220,
15898,
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_failing_write() {
use std::io::Write;
let buf = PartialWrite::new(
Vec::new(),
iter::repeat(PartialOp::Err(io::ErrorKind::WouldBlock)),
);
let mut z = Encoder::new(buf, 1).unwrap();
// Fill in enough data to make sure the buffer gets written out.
let input = vec![b'b'; 128 * 1024];
// This should work even though the inner writer rejects writes.
assert_eq!(
z.write(&input).unwrap(),
128 * 1024,
"did not write all input buffer"
);
assert_eq!(
z.write(b"abc").unwrap_err().kind(),
io::ErrorKind::WouldBlock,
"expected WouldBlock error"
);
z.get_mut().set_ops(iter::repeat(PartialOp::Unlimited));
// This shouldn't have led to any corruption.
let buf = z.finish().unwrap().into_inner();
assert_eq!(
&decode_all(&buf[..]).unwrap(),
&input,
"WouldBlock errors should not corrupt stream"
);
} | rust_cleaned_test_functions.jsonl/134369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
14277,
9165,
368,
341,
262,
990,
1460,
486,
815,
486,
7985,
401,
262,
1077,
6607,
284,
24552,
7985,
486,
931,
1006,
286,
11312,
486,
931,
3148,
286,
5367,
486,
30624,
5304,
20894,
7125,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_product_matrix() {
assert_eq!(A * B * C, [A, B, C].iter().product());
assert_eq!(A * B * C, [A, B, C].iter().cloned().product());
} | rust_cleaned_test_functions.jsonl/105429 | {
"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,
9840,
10193,
368,
341,
286,
2060,
10714,
10297,
32,
353,
425,
353,
356,
11,
508,
32,
11,
425,
11,
356,
936,
2015,
1005,
3031,
1423,
286,
2060,
10714,
10297,
32,
353,
425,
353,
356,
11,
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 |
#[test]
fn test_image_buffer_copy_within_tl() {
let data = &[
00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15,
];
let expected = [
00, 01, 02, 03, 04, 00, 01, 02, 08, 04, 05, 06, 12, 08, 09, 10,
];
let mut image: GrayImage = ImageBuffer::from_raw(4, 4, Vec::from(&data[..])).unwrap();
assert!(image.copy_within(
Rect {
x: 0,
y: 0,
width: 3,
height: 3
},
1,
1
));
assert_eq!(&image.into_raw(), &expected);
} | rust_cleaned_test_functions.jsonl/25549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
7776,
16096,
72385,
82970,
368,
341,
286,
1077,
821,
284,
609,
9640,
310,
220,
15,
15,
11,
220,
15,
16,
11,
220,
15,
17,
11,
220,
15,
18,
11,
220,
15,
19,
11,
220,
15,
20,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peer() {
let mut region = metapb::Region::default();
region.set_id(1);
region.mut_peers().push(new_peer(1, 1));
region.mut_peers().push(new_learner_peer(2, 2));
assert!(!find_peer(®ion, 1).unwrap().get_is_learner());
assert!(find_peer(®ion, 2).unwrap().get_is_learner());
assert!(remove_peer(&mut region, 1).is_some());
assert!(remove_peer(&mut region, 1).is_none());
assert!(find_peer(®ion, 1).is_none());
} | rust_cleaned_test_functions.jsonl/6849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
368,
341,
286,
1077,
5206,
5537,
284,
2270,
391,
65,
486,
14091,
486,
2258,
543,
286,
5537,
980,
842,
7,
16,
317,
286,
5537,
744,
332,
36367,
388,
1005,
9077,
1755,
45159,
7,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canonicalize_header() {
use super::*;
let dt = chrono::DateTime::parse_from_rfc2822("Fri, 28 Nov 2014 21:00:09 +0900").unwrap();
let time = format!("{}", dt.format("%a, %d %h %Y %T GMT%Z"));
debug!("time == {}", time);
let mut h = hyper::header::HeaderMap::new();
h.insert(HEADER_DATE, format_header_value(time).unwrap());
h.insert(
HEADER_VERSION,
header::HeaderValue::from_static("2015-04-05"),
);
assert_eq!(
super::canonicalize_header(&h),
"x-ms-date:Fri, 28 Nov 2014 21:00:09 GMT+09:00\nx-ms-version:2015-04-05\n"
);
} | rust_cleaned_test_functions.jsonl/5197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
551,
8757,
368,
341,
286,
990,
2256,
79304,
286,
1077,
7594,
284,
80372,
486,
7689,
486,
6400,
5673,
1710,
8316,
17,
23,
17,
17,
445,
53884,
11,
220,
17,
23,
4620,
220,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_accounts_no_loaders() {
let mut accounts: Vec<(Pubkey, Account)> = Vec::new();
let mut error_counters = ErrorCounters::default();
let keypair = Keypair::new();
let key0 = keypair.pubkey();
let key1 = Pubkey::new(&[5u8; 32]);
let mut account = Account::new(1, 1, &Pubkey::default());
account.rent_epoch = 1;
accounts.push((key0, account));
let mut account = Account::new(2, 1, &Pubkey::default());
account.rent_epoch = 1;
accounts.push((key1, account));
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[key1],
Hash::default(),
vec![native_loader::id()],
instructions,
);
let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters);
assert_eq!(error_counters.account_not_found, 0);
assert_eq!(loaded_accounts.len(), 1);
match &loaded_accounts[0] {
(
Ok((transaction_accounts, transaction_loaders, _transaction_rents)),
_hash_age_kind,
) => {
assert_eq!(transaction_accounts.len(), 2);
assert_eq!(transaction_accounts[0], accounts[0].1);
assert_eq!(transaction_loaders.len(), 1);
assert_eq!(transaction_loaders[0].len(), 0);
}
(Err(e), _hash_age_kind) => Err(e).unwrap(),
}
} | rust_cleaned_test_functions.jsonl/50612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 779
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
55665,
6536,
12411,
388,
368,
341,
286,
1077,
5206,
9618,
25,
11312,
28706,
29162,
792,
11,
8615,
16018,
284,
11312,
486,
931,
543,
286,
1077,
5206,
1465,
85632,
284,
4600,
2507,
388,
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_plan_rewriter_1() -> Result<()> {
use common_planners::*;
use pretty_assertions::assert_eq;
let source = Test::create().generate_source_plan_for_test(10000)?;
let plan = PlanBuilder::from(&source)
.filter(col("number").eq(lit(1i64)))?
.aggregate_partial(&[col("number")], &[col("number")])?
.aggregate_final(source.schema(), &[col("number")], &[col("number")])?
.project(&[col("number").alias("x"), col("number").alias("y")])?
.build()?;
let mut rewriter = DefaultRewriter {};
let before_rewrite = format!("{:?}", &plan);
let after_rewrite = format!("{:?}", rewriter.rewrite_plan_node(&plan)?);
assert_eq!(before_rewrite, after_rewrite);
Ok(())
} | rust_cleaned_test_functions.jsonl/36071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26564,
1288,
18189,
62,
16,
368,
1464,
5714,
71698,
341,
262,
990,
4185,
6317,
24003,
56162,
262,
990,
5020,
16553,
908,
486,
2207,
10714,
401,
262,
1077,
2530,
284,
3393,
486,
3182,
1005,
19366,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_parse_and_serialize() {
let a = WireGuard::try_from(TEXT).unwrap();
let s = a.render_with_names(None, false, true);
println!("{}", s);
} | rust_cleaned_test_functions.jsonl/13452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8378,
88686,
368,
341,
286,
1077,
264,
284,
19378,
20806,
486,
1539,
5673,
46356,
568,
15454,
543,
286,
1077,
274,
284,
264,
8740,
6615,
9187,
26717,
11,
895,
11,
830,
317,
286,
13751,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_marklig_deser() {
let binary_marklig = vec![
// MarkLigPosFormat1
// MarkLigAttachSubTable MarkLigPos subtable definition
0x00, 0x01, // 1 posFormat
0x00, 0x0C, // MarkGlyphsCoverage offset to markCoverage table
0x00, 0x14, // LigGlyphsCoverage offset to ligatureCoverage table
0x00, 0x02, // 2 markClassCount
0x00, 0x1A, // MarkGlyphsArray offset to MarkArray table
0x00, 0x30, // LigGlyphsArray offset to LigatureArray table
// CoverageFormat1
// MarkGlyphsCoverage Coverage table definition
0x00, 0x01, // 1 coverageFormat: lists
0x00, 0x02, // 2 glyphCount
0x03, 0x3C, // sukunMarkGlyphID glyphArray[0]
0x03, 0x3F, // kasratanMarkGlyphID glyphArray[1]
// CoverageFormat1
// LigGlyphsCoverage Coverage table definition
0x00, 0x01, // 1 coverageFormat: lists
0x00, 0x01, // 1 glyphCount
0x02, 0x34, // LamWithMeemWithJeem
// LigatureGlyphID glyphArray[0]
// MarkArray
// MarkGlyphsArray MarkArray table definition
0x00, 0x02, // 2 markCount
// markRecords[0] MarkRecords in Coverage index order
0x00, 0x00,
0x00, 0x0A, // sukunMarkAnchor markAnchorOffset
// markRecords[1]
0x00, 0x01,
0x00, 0x10, // kasratanMarkAnchor markAnchorOffset
// AnchorFormat1
// sukunMarkAnchor Anchor table definition
0x00, 0x01, // 1 anchorFormat: design units only
0x01, 0x5A, // 346 xCoordinate
0xFF, 0x9E, // -98 yCoordinate
// AnchorFormat1
// kasratanMarkAnchor Anchor table definition
0x00, 0x01, // 1 anchorFormat: design units only
0x01, 0x05, // 261 xCoordinate
0x01, 0xE8, // 488 yCoordinate
// LigatureArray
// LigGlyphsArray LigatureArray table definition
0x00, 0x01, // 1 ligatureCount
0x00, 0x04, // LamWithMeemWithJeemLigAttach ligatureAttachOffsets[0]
// LigatureAttach
// LamWithMeemWithJeemLigAttach LigatureAttach table definition
0x00, 0x03, // 3 componentCount
0x00,
0x0E, // AboveLamAnchor ligatureAnchorOffsets[0] — offsets ordered by mark class
0x00,
0x00, // NULL ligatureAnchorOffsets[1] — no attachment points for Class1 marks
// componentRecords[1]
0x00,
0x00, // NULL ligatureAnchorOffsets[0] — no attachment points for Class 0 marks
0x00,
0x14, // B // componentRecords[2]
0x00,
0x00, // NULL ligatureAnchorOffsets — no attachment points for Class 0 marks
0x00,
0x00, // NULL ligatureAnchorOffsets[1] — no attachment points for Class 1 marks
// AnchorFormat1
// AboveLamAnchor Anchor table definition
0x00, 0x01, // 1 anchorFormat: design units only
0x02, 0x71, // 625 xCoordinate
0x07, 0x08, // 1800 yCoordinate
// AnchorFormat1
// BelowMeemAnchor Anchor table definition
0x00, 0x01, // 1 anchorFormat: design units only
0x01, 0x78, // 376 xCoordinate
0xFE, 0x90, // -368 yCoordinate
];
let markbase: MarkLigPosFormat1 = otspec::de::from_bytes(&binary_marklig).unwrap();
let expected = MarkLigPosFormat1 {
posFormat: 1,
markCoverage: Offset16::to(Coverage {
glyphs: vec![0x33c, 0x33f],
}),
ligatureCoverage: Offset16::to(Coverage {
glyphs: vec![0x234],
}),
markClassCount: 2,
markArray: Offset16::to(MarkArray {
markRecords: vec![
MarkRecord {
markClass: 0,
markAnchor: Offset16::to(Anchor {
xCoordinate: 346,
yCoordinate: -98,
anchorPoint: None,
}),
},
MarkRecord {
markClass: 1,
markAnchor: Offset16::to(Anchor {
xCoordinate: 261,
yCoordinate: 488,
anchorPoint: None,
}),
},
],
}),
ligatureArray: Offset16::to(LigatureArray {
ligatureAttach: vec![Offset16::to(LigatureAttach {
componentRecords: vec![
ComponentRecord {
ligatureAnchors: vec![
Offset16::to(Anchor {
xCoordinate: 625,
yCoordinate: 1800,
anchorPoint: None,
}),
Offset16::to_nothing(),
],
},
ComponentRecord {
ligatureAnchors: vec![
Offset16::to_nothing(),
Offset16::to(Anchor {
xCoordinate: 376,
yCoordinate: -368,
anchorPoint: None,
}),
],
},
ComponentRecord {
ligatureAnchors: vec![Offset16::to_nothing(), Offset16::to_nothing()],
},
],
})]
.into(),
}),
};
assert_eq!(markbase, expected);
let output: Vec<u8> = otspec::ser::to_bytes(&markbase).unwrap();
assert_eq!(output, binary_marklig);
} | rust_cleaned_test_functions.jsonl/112240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3749
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
7708,
15768,
261,
368,
341,
286,
1077,
7868,
18924,
7708,
284,
7486,
90515,
310,
442,
4389,
43,
343,
4859,
4061,
16,
198,
310,
442,
4389,
43,
343,
30485,
3136,
2556,
220,
4389,
43,
343,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bench_1920_1080_get_color() {
let mut buf = vec![0; 4];
let iter: u32 = 1920 * 1080;
let start = Instant::now();
for i in 0..iter {
get_color(i as u16, iter as u16, &mut buf);
}
let duration = start.elapsed();
println!("get_color() x{:?} times took {:?}", &iter, &duration,);
} | rust_cleaned_test_functions.jsonl/30889 | {
"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,
880,
19762,
62,
16,
24,
17,
15,
62,
16,
15,
23,
15,
3062,
6714,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
20703,
15,
26,
220,
19,
935,
286,
1077,
5367,
25,
575,
18,
17,
284,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_titlecase() {
let context = Context::new(String::from("us"), None, Tokens::new(HashMap::new()));
assert_eq!(titlecase(&String::from("Väike-Sõjamäe"), &context), String::from("Väike-Sõjamäe"));
assert_eq!(titlecase(&String::from("Väike-sõjamäe"), &context), String::from("Väike-Sõjamäe"));
assert_eq!(titlecase(&String::from("väike-sõjamäe"), &context), String::from("Väike-Sõjamäe"));
assert_eq!(titlecase(&String::from("väike sõjamäe"), &context), String::from("Väike Sõjamäe"));
assert_eq!(titlecase(&String::from("väike sõjamäe"), &context), String::from("Väike Sõjamäe"));
assert_eq!(titlecase(&String::from("Väike Sõjamäe"), &context), String::from("Väike Sõjamäe"));
assert_eq!(titlecase(&String::from("VäikeSõjamäe"), &context), String::from("Väikesõjamäe"));
assert_eq!(titlecase(&String::from("ámbar"), &context), String::from("Ámbar"));
assert_eq!(titlecase(&String::from("y̆ámbary̆"), &context), String::from("Y̆ámbary̆"));
assert_eq!(titlecase(&String::from("y\u{306}ámbary\u{306}"), &context), String::from("Y\u{306}ámbary\u{306}"));
assert_eq!(titlecase(&String::from("ç"), &context), String::from("Ç"));
assert_eq!(titlecase(&String::from("Здравствуйте"), &context), String::from("Здравствуйте"));
assert_eq!(titlecase(&String::from("नमस्त"), &context), String::from("नमस्त"));
assert_eq!(titlecase(&String::from("abra CAda -bra"), &context), String::from("Abra Cada -Bra"));
assert_eq!(titlecase(&String::from("abra-CAda-bra"), &context), String::from("Abra-Cada-Bra"));
assert_eq!(titlecase(&String::from("our lady of whatever"), &context), String::from("Our Lady of Whatever"));
assert_eq!(titlecase(&String::from("our lady OF whatever"), &context), String::from("Our Lady of Whatever"));
assert_eq!(titlecase(&String::from("St Martin\"s Neck Road"), &context), String::from("St Martin\"S Neck Road"));
assert_eq!(titlecase(&String::from("St Martin's Neck Road"), &context), String::from("St Martin's Neck Road"));
assert_eq!(titlecase(&String::from("MT. MOOSILAUKE HWY"), &context), String::from("Mt. Moosilauke Hwy"));
assert_eq!(titlecase(&String::from("some miscellaneous rd (what happens to parentheses?)"), &context), String::from("Some Miscellaneous Rd (What Happens to Parentheses?)"));
assert_eq!(titlecase(&String::from("main st NE"), &context), String::from("Main St NE"));
assert_eq!(titlecase(&String::from("main St NW"), &context), String::from("Main St NW"));
assert_eq!(titlecase(&String::from("SW Main St."), &context), String::from("SW Main St."));
assert_eq!(titlecase(&String::from("Main S.E. St"), &context), String::from("Main SE St"));
assert_eq!(titlecase(&String::from("main st ne"), &context), String::from("Main St NE"));
assert_eq!(titlecase(&String::from("nE. Main St"), &context), String::from("Ne. Main St"));
assert_eq!(titlecase(&String::from("us hwy 1"), &context), String::from("US Hwy 1"));
assert_eq!(titlecase(&String::from(" -a nice road- "), &context), String::from("-A Nice Road-"));
assert_eq!(titlecase(&String::from("-x"), &context), String::from("-X"));
assert_eq!(titlecase(&String::from("x-"), &context), String::from("X-"));
assert_eq!(titlecase(&String::from(" *$&#()__ "), &context), String::from("*$&#()__"));
assert_eq!(titlecase(&String::from("BrandywiNE Street Northwest"), &context), String::from("Brandywine Street Northwest"));
let context = Context::new(String::from("de"), None, Tokens::new(HashMap::new()));
assert_eq!(titlecase(&String::from(" hast Du recht"), &context), String::from("Hast du Recht"));
assert_eq!(titlecase(&String::from("a 9, 80939 münchen, germany"), &context), String::from("A 9, 80939 München, Germany"));
} | rust_cleaned_test_functions.jsonl/51459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6112,
5638,
368,
341,
286,
1077,
2266,
284,
9608,
486,
931,
2242,
486,
1499,
445,
355,
3975,
2240,
11,
58166,
486,
931,
7,
18497,
486,
931,
25138,
286,
2060,
10714,
10297,
2102,
5638,
2099,
703,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sourcemap_merged() {
use juno::gen_js::*;
let mut context = Context::new();
let ctx = &mut context;
// original TS source:
// type A = number;
let input_src = r#"function foo() { 1; }"#;
let input_map = sourcemap::SourceMap::from_slice(
br#"{
"version":3,
"file":"test.js",
"sourceRoot":"",
"sources":["test.ts"],
"names":[],
"mappings":"AACA,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC"
}"#,
)
.unwrap();
let mut out: Vec<u8> = vec![];
let node = hparser::parse_with_flags(Default::default(), input_src, ctx).unwrap();
let output_map = generate(&mut out, ctx, &node, Pretty::Yes).unwrap();
let output = String::from_utf8(out).expect("Invalid UTF-8 output in test");
assert_eq!(output, "function foo() {\n 1;\n}\n",);
let merged = merge_sourcemaps(&input_map, &output_map);
let input_token: sourcemap::Token = merged.lookup_token(1, 2).unwrap();
assert_eq!(input_token.get_source().unwrap(), "test.ts");
assert_eq!(input_token.get_src(), (1, 17));
} | rust_cleaned_test_functions.jsonl/102610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 523
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
413,
66,
42040,
90702,
368,
341,
262,
990,
502,
16311,
486,
4370,
26250,
56162,
262,
1077,
5206,
2266,
284,
9608,
486,
931,
543,
262,
1077,
5635,
284,
609,
6984,
2266,
280,
262,
442,
4024,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.