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_encryption_decryption_detached() -> anyhow::Result<()> {
let mut cs_rng = CsRng::default();
let key = cs_rng.generate_key();
let bytes = cs_rng.generate_random_bytes(8192);
let iv = cs_rng.generate_nonce();
// no additional data
let mut data = bytes.clone();
let tag = encrypt_in_place_detached(&key, &mut data, &iv, None)?;
assert_ne!(bytes, data);
assert_eq!(bytes.len(), data.len());
assert_eq!(MAC_LENGTH, tag.len());
decrypt_in_place_detached(&key, &mut data, &tag, &iv, None)?;
assert_eq!(bytes, data);
// // additional data
let ad = cs_rng.generate_random_bytes(42);
let mut data = bytes.clone();
let tag = encrypt_in_place_detached(&key, &mut data, &iv, Some(&ad))?;
assert_ne!(bytes, data);
assert_eq!(bytes.len(), data.len());
assert_eq!(MAC_LENGTH, tag.len());
decrypt_in_place_detached(&key, &mut data, &tag, &iv, Some(&ad))?;
assert_eq!(bytes, data);
Ok(())
} | rust_cleaned_test_functions.jsonl/132752 | {
"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,
13781,
15597,
13783,
15597,
24409,
3854,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
5206,
10532,
66849,
284,
67332,
49,
968,
486,
2258,
543,
286,
1077,
1376,
284,
10532,
66849,
22019,
3097,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reset_into_cbor() {
let response_cbor: Option<cbor::Value> = ResponseData::AuthenticatorReset.into();
assert_eq!(response_cbor, None);
} | rust_cleaned_test_functions.jsonl/91273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18983,
45514,
666,
9368,
368,
341,
286,
1077,
2033,
666,
9368,
25,
6959,
27,
7221,
269,
486,
1130,
29,
284,
5949,
1043,
486,
5087,
61393,
14828,
39860,
543,
286,
2060,
10714,
10297,
2322,
666,
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 |
#[test]
fn test_restore_phala_launched() {
#[derive(Serialize, Deserialize)]
struct MiningEconomics0 {
tokenomic_params: u32,
}
#[derive(Serialize, Deserialize)]
struct MiningEconomics1 {
tokenomic_params: u32,
#[serde(default)]
phala_launched: bool,
}
let checkpoint = serde_cbor::to_vec(&MiningEconomics0 {
tokenomic_params: 1,
})
.unwrap();
let state: MiningEconomics1 = serde_cbor::from_slice(&checkpoint).unwrap();
assert!(!state.phala_launched);
} | rust_cleaned_test_functions.jsonl/38766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62677,
9782,
6053,
79633,
10653,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
5563,
262,
2036,
25832,
36,
80092,
15,
341,
286,
3950,
3075,
6745,
25,
575,
18,
17,
345,
262,
555,
262,
11506... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fidl_socket_addr() {
assert_eq!(
fidl::SocketAddress::Ipv4(fidl::Ipv4SocketAddress {
address: fidl::Ipv4Address { addr: [192, 168, 0, 1] },
port: 8080
}),
fidl_socket_addr!("192.168.0.1:8080")
);
assert_eq!(
fidl::SocketAddress::Ipv6(fidl::Ipv6SocketAddress {
address: fidl::Ipv6Address {
addr: [0xFF, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0x02]
},
port: 8080,
zone_index: 0,
}),
fidl_socket_addr!("[ff01::0102]:8080")
);
} | rust_cleaned_test_functions.jsonl/12531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
55464,
19555,
7387,
368,
341,
286,
2060,
10714,
33673,
310,
32104,
75,
486,
69455,
486,
80656,
19,
40556,
75,
486,
80656,
19,
69455,
341,
394,
2621,
25,
32104,
75,
486,
80656,
19,
4286,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_alpn() {
assert_eq!(serialize_alpn(&[b"h2".to_vec()]).unwrap(), b"\x02h2");
assert_eq!(
serialize_alpn(&[b"h2".to_vec(), b"http/1.1".to_vec()]).unwrap(),
b"\x02h2\x08http/1.1"
);
assert_eq!(
serialize_alpn(&[b"h2".to_vec(), b"http/1.1".to_vec()]).unwrap(),
b"\x02h2\x08http/1.1"
);
assert_eq!(
serialize_alpn(&[b"h2".to_vec(), vec![], b"http/1.1".to_vec()]).unwrap(),
b"\x02h2\x08http/1.1"
);
assert!(serialize_alpn(&[(0..255).collect()]).is_ok());
assert!(serialize_alpn(&[(0..=255).collect()]).is_err());
} | rust_cleaned_test_functions.jsonl/12543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
8418,
19958,
368,
341,
262,
2060,
10714,
10297,
24166,
8418,
19958,
2099,
58,
65,
78522,
17,
3263,
983,
13251,
368,
10697,
15454,
1507,
293,
11934,
87,
15,
17,
71,
17,
797,
262,
2060,
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_source_no_permissions() {
let tmp_dir = TempDir::new().expect("failed to make tempdir");
let src = tmp_dir.path().to_path_buf().join("source.md");
let dest = tmp_dir.path().to_path_buf().join("dest.md");
let mut file = File::create(&src).unwrap();
file.write_all("Foo".as_bytes()).unwrap();
set_permissions(&src, Permissions::from_mode(0o000)).unwrap();
match Exporter::new(src, dest).run().unwrap_err() {
ExportError::FileExportError { path: _, source } => match *source {
ExportError::ReadError { path: _, source: _ } => {}
_ => panic!("Wrong error variant for source, got: {:?}", source),
},
err => panic!("Wrong error variant: {:?}", err),
}
} | rust_cleaned_test_functions.jsonl/116600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10347,
6536,
44767,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,
445,
16091,
311,
1281,
2730,
3741,
797,
262,
1077,
2286,
284,
4174,
4334,
3875,
1005,
983,
2638,
10363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_isize() {
let test_cases: &[(&str, isize, &CustomFormat)] = &[
("0", 0, &POLICIES[0]),
("0", 0, &POLICIES[1]),
("0", 0, &POLICIES[2]),
("0", 0, &POLICIES[3]),
("0", 0, &POLICIES[4]),
("9,223,372,036,854,775,807", std::isize::MAX, &POLICIES[0]),
(
"9𠜱223𠜱372𠜱036𠜱854𠜱775𠜱807",
std::isize::MAX,
&POLICIES[1],
),
(
"92𠜱23𠜱37𠜱20𠜱36𠜱85𠜱47𠜱75𠜱807",
std::isize::MAX,
&POLICIES[2],
),
("9223372036854775807", std::isize::MAX, &POLICIES[3]),
("9223372036854775807", std::isize::MAX, &POLICIES[4]),
("-9,223,372,036,854,775,808", std::isize::MIN, &POLICIES[0]),
(
"\u{200e}-\u{200e}9𠜱223𠜱372𠜱036𠜱854𠜱775𠜱808",
std::isize::MIN,
&POLICIES[1],
),
(
"\u{200e}-\u{200e}92𠜱23𠜱37𠜱20𠜱36𠜱85𠜱47𠜱75𠜱808",
std::isize::MIN,
&POLICIES[2],
),
(
"\u{200e}-\u{200e}9223372036854775808",
std::isize::MIN,
&POLICIES[3],
),
(
"\u{200e}-\u{200e}9223372036854775808",
std::isize::MIN,
&POLICIES[4],
),
];
for (expected, input, format) in test_cases {
// Buffer
let mut buf = Buffer::default();
buf.write_formatted(input);
assert_eq!(*expected, buf.as_str());
#[cfg(feature = "std")]
{
// ToFormattedString
assert_eq!(expected.to_string(), input.to_formatted // WriteFormatted
let mut s = String::new();
s.write_formatt).unwrap();
assert_eq!(expected.to_string(), s);
}
}
} | rust_cleaned_test_functions.jsonl/13602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
551,
368,
341,
262,
1077,
1273,
41427,
25,
44590,
2099,
495,
11,
91373,
11,
609,
10268,
4061,
7252,
284,
609,
9640,
286,
3489,
15,
497,
220,
15,
11,
609,
49303,
1317,
5369,
58,
15,
17036... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_square() {
let main = r#"
class Main {
function void main() {
var SquareGame game;
let game = SquareGame.new();
do game.run();
do game.dispose();
return;
}
}
"#;
let square = r#"
class Square {
field int x, y; // screen location of the square's top-left corner
field int size; // length of this square, in pixels
/** Constructs a new square with a given location and size. */
constructor Square new(int Ax, int Ay, int Asize) {
let x = Ax;
let y = Ay;
let size = Asize;
do draw();
return this;
}
/** Disposes this square. */
method void dispose() {
do Memory.deAlloc(this);
return;
}
/** Draws the square on the screen. */
method void draw() {
do Screen.setColor(true);
do Screen.drawRectangle(x, y, x + size, y + size);
return;
}
/** Erases the square from the screen. */
method void erase() {
do Screen.setColor(false);
do Screen.drawRectangle(x, y, x + size, y + size);
return;
}
/** Increments the square size by 2 pixels. */
method void incSize() {
if (((y + size) < 254) & ((x + size) < 510)) {
do erase();
let size = size + 2;
do draw();
}
return;
}
/** Decrements the square size by 2 pixels. */
method void decSize() {
if (size > 2) {
do erase();
let size = size - 2;
do draw();
}
return;
}
/** Moves the square up by 2 pixels. */
method void moveUp() {
if (y > 1) {
do Screen.setColor(false);
do Screen.drawRectangle(x, (y + size) - 1, x + size, y + size);
let y = y - 2;
do Screen.setColor(true);
do Screen.drawRectangle(x, y, x + size, y + 1);
}
return;
}
/** Moves the square down by 2 pixels. */
method void moveDown() {
if ((y + size) < 254) {
do Screen.setColor(false);
do Screen.drawRectangle(x, y, x + size, y + 1);
let y = y + 2;
do Screen.setColor(true);
do Screen.drawRectangle(x, (y + size) - 1, x + size, y + size);
}
return;
}
/** Moves the square left by 2 pixels. */
method void moveLeft() {
if (x > 1) {
do Screen.setColor(false);
do Screen.drawRectangle((x + size) - 1, y, x + size, y + size);
let x = x - 2;
do Screen.setColor(true);
do Screen.drawRectangle(x, y, x + 1, y + size);
}
return;
}
/** Moves the square right by 2 pixels. */
method void moveRight() {
if ((x + size) < 510) {
do Screen.setColor(false);
do Screen.drawRectangle(x, y, x + 1, y + size);
let x = x + 2;
do Screen.setColor(true);
do Screen.drawRectangle((x + size) - 1, y, x + size, y + size);
}
return;
}
}
"#;
let game = r#"
class SquareGame {
field Square square; // the square of this game
field int direction; // the square's current direction:
// 0=none, 1=up, 2=down, 3=left, 4=right
/** Constructs a new Square Game. */
constructor SquareGame new() {
// Creates a 30 by 30 pixels square and positions it at the top-left
// of the screen.
let square = Square.new(0, 0, 30);
let direction = 0; // initial state is no movement
return this;
}
/** Disposes this game. */
method void dispose() {
do square.dispose();
do Memory.deAlloc(this);
return;
}
/** Moves the square in the current direction. */
method void moveSquare() {
if (direction = 1) { do square.moveUp(); }
if (direction = 2) { do square.moveDown(); }
if (direction = 3) { do square.moveLeft(); }
if (direction = 4) { do square.moveRight(); }
do Sys.wait(5); // delays the next movement
return;
}
/** Runs the game: handles the user's inputs and moves the square accordingly */
method void run() {
var char key; // the key currently pressed by the user
var boolean exit;
let exit = false;
while (~exit) {
// waits for a key to be pressed
while (key = 0) {
let key = Keyboard.keyPressed();
do moveSquare();
}
if (key = 81) { let exit = true; } // q key
if (key = 90) { do square.decSize(); } // z key
if (key = 88) { do square.incSize(); } // x key
if (key = 131) { let direction = 1; } // up arrow
if (key = 133) { let direction = 2; } // down arrow
if (key = 130) { let direction = 3; } // left arrow
if (key = 132) { let direction = 4; } // right arrow
// waits for the key to be released
while (~(key = 0)) {
let key = Keyboard.keyPressed();
do moveSquare();
}
} // while
return;
}
}
"#;
compile(main, "Square", "Main".to_string());
compile(square, "Square", "Square".to_string());
compile(game, "SquareGame", "SquareGame".to_string());
} | rust_cleaned_test_functions.jsonl/17733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39794,
368,
341,
286,
1077,
1887,
284,
435,
2,
698,
1040,
4697,
341,
262,
729,
737,
1887,
368,
341,
286,
762,
15619,
4868,
1809,
280,
286,
1077,
1809,
284,
15619,
4868,
4618,
543,
286,
653,
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_no_spin() {
let ex = LocalExecutor::default();
let task_queue = ex.create_task_queue(
Shares::default(),
Latency::Matters(Duration::from_millis(10)),
"my_tq",
);
let start = getrusage_utime();
ex.run(async {
crate::spawn_local_into(
async { timer::sleep(Duration::from_secs(1)).await },
task_queue,
)
.expect("failed to spawn task")
.await;
});
assert!(
getrusage_utime() - start < Duration::from_millis(2),
"expected user time on LE is less than 2 millisecond"
);
} | rust_cleaned_test_functions.jsonl/1232 | {
"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,
6536,
47965,
368,
341,
286,
1077,
505,
284,
8774,
25255,
486,
2258,
543,
286,
1077,
3383,
10841,
284,
505,
2520,
12184,
10841,
1006,
310,
44185,
486,
2258,
3148,
310,
9926,
2251,
486,
44,
10175,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_array_invalid_child_array_len() {
let value_offsets = Buffer::from(&[0, 2, 5, 7].to_byte_slice());
let list_data_type = DataType::List(Box::new(DataType::Int32));
let list_data = ArrayData::builder(list_data_type)
.len(3)
.add_buffer(value_offsets)
.build();
ListArray::from(list_data);
} | rust_cleaned_test_functions.jsonl/11614 | {
"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,
2019,
3858,
31433,
17268,
3858,
6043,
368,
341,
286,
1077,
897,
56924,
284,
10312,
486,
1499,
2099,
58,
15,
11,
220,
17,
11,
220,
20,
11,
220,
22,
936,
983,
19737,
26488,
1423,
286,
1077,
1140... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_duplicate_public_key_fails() {
let (tx_out_store, env) = init_tx_out_store();
let mut tx_outs = get_tx_outs(10);
{
// Push a number of TxOuts to the store.
let mut rw_transaction: RwTransaction = env.begin_rw_txn().unwrap();
for tx_out in &tx_outs[1..] {
tx_out_store.push(tx_out, &mut rw_transaction).unwrap();
}
rw_transaction.commit().unwrap();
}
tx_outs[0].public_key = tx_outs[1].public_key;
let mut rw_transaction: RwTransaction = env.begin_rw_txn().unwrap();
match tx_out_store.push(&tx_outs[0], &mut rw_transaction) {
Err(Error::Lmdb(lmdb::Error::KeyExist)) => {}
Ok(_) => panic!("unexpected success"),
Err(_) => panic!("unexpected error"),
};
} | rust_cleaned_test_functions.jsonl/5270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 439
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
70434,
27074,
3097,
761,
6209,
368,
341,
286,
1077,
320,
3998,
6068,
14809,
11,
6105,
8,
284,
2930,
17805,
6068,
14809,
543,
286,
1077,
5206,
9854,
6068,
82,
284,
633,
17805,
6068,
82,
7,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_process_new_vote_too_many_votes() {
let mut vote_state1 = VoteState::default();
let bad_votes: VecDeque<Lockout> = (0..=MAX_LOCKOUT_HISTORY)
.map(|slot| Lockout {
slot: slot as Slot,
confirmation_count: (MAX_LOCKOUT_HISTORY - slot + 1) as u32,
})
.collect();
assert_eq!(
vote_state1.process_new_vote_state(
bad_votes,
None,
None,
vote_state1.current_epoch(),
None,
),
Err(VoteError::TooManyVotes)
);
} | rust_cleaned_test_functions.jsonl/6115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
5921,
54360,
2346,
78,
22101,
65116,
368,
341,
286,
1077,
5206,
6910,
4387,
16,
284,
34034,
1397,
486,
2258,
543,
286,
1077,
3873,
65116,
25,
11312,
73891,
27,
11989,
411,
29,
284,
320,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version() {
// We don't make assertions about the build SHA because caching in CI can
// cause the test binary and `environmentd` to have different embedded SHAs.
let expected_version = mz_environmentd::BUILD_INFO.version;
assert!(!expected_version.is_empty());
cmd()
.arg("-V")
.assert()
.success()
.stdout(predicates::str::starts_with(format!(
"environmentd v{}",
expected_version
)));
} | rust_cleaned_test_functions.jsonl/29328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
368,
341,
262,
442,
1205,
1513,
944,
1281,
54836,
911,
279,
1936,
21721,
1576,
47430,
304,
20694,
646,
198,
262,
442,
5240,
279,
1273,
7868,
323,
1565,
23294,
67,
63,
311,
614,
2155,
22864... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_maybe_owned_traits() {
let s = Slice("abcde");
assert_eq!(s.len(), 5);
assert_eq!(s.as_slice(), "abcde");
assert_eq!(String::from_str(s.as_slice()).as_slice(), "abcde");
assert_eq!(format!("{}", s).as_slice(), "abcde");
assert!(s.lt(&Owned(String::from_str("bcdef"))));
assert_eq!(Slice(""), Default::default());
let o = Owned(String::from_str("abcde"));
assert_eq!(o.len(), 5);
assert_eq!(o.as_slice(), "abcde");
assert_eq!(String::from_str(o.as_slice()).as_slice(), "abcde");
assert_eq!(format!("{}", o).as_slice(), "abcde");
assert!(o.lt(&Slice("bcdef")));
assert_eq!(Owned(String::from_str("")), Default::default());
assert!(s.cmp(&o) == Equal);
assert!(s.equiv(&o));
assert!(o.cmp(&s) == Equal);
assert!(o.equiv(&s));
} | rust_cleaned_test_functions.jsonl/56865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
49791,
51973,
39693,
368,
341,
286,
1077,
274,
284,
56476,
445,
13683,
450,
797,
286,
2060,
10714,
10297,
82,
19406,
1507,
220,
20,
317,
286,
2060,
10714,
10297,
82,
5357,
26488,
1507,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_string_empty() -> IonResult<()> {
let mut cursor = ion_cursor_for(&[0x80]);
assert_eq!(cursor.next()?, Some(Value(IonType::String, false)));
assert_eq!(cursor.read_string()?, Some(String::from("")));
Ok(())
} | rust_cleaned_test_functions.jsonl/82742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
3904,
15124,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
5206,
8128,
284,
27672,
28601,
5478,
2099,
58,
15,
87,
23,
15,
2558,
286,
2060,
10714,
10297,
17437,
4529,
368,
12622,
4329,
25346... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_call_hierarchy_outgoing() {
check_hierarchy(
r#"
//- /lib.rs
fn callee() {}
fn call$0er() {
callee();
callee();
}
"#,
"caller Function FileId(0) 15..58 18..24",
&[],
&["callee Function FileId(0) 0..14 3..9 : [33..39, 47..53]"],
);
} | rust_cleaned_test_functions.jsonl/737 | {
"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,
13429,
95043,
6068,
9546,
368,
341,
286,
1779,
95043,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
8822,
94800,
368,
5613,
8822,
1618,
3,
15,
261,
368,
341,
262,
94800,
543,
262,
94800,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lua_library() {
let userdata = r#"
local serialize = load(accounts[2].userdata)().serialize
accounts[3].userdata = serialize({a=1, b=2, c=3}, nil, "s")
"#
.as_bytes()
.to_vec();
let owner = Pubkey::default();
let program_account = Account {
tokens: 1,
userdata,
owner,
executable: true,
loader: Pubkey::default(),
};
let alice_account = Account::new(100, 0, owner);
let serialize_account = Account {
tokens: 100,
userdata: read_test_file("serialize.lua"),
owner,
executable: false,
loader: Pubkey::default(),
};
let mut accounts = [
(Pubkey::default(), program_account),
(Pubkey::default(), alice_account),
(Pubkey::default(), serialize_account),
(Pubkey::default(), Account::new(1, 0, owner)),
];
let mut keyed_accounts = create_keyed_accounts(&mut accounts);
process(&owner, &mut keyed_accounts, &[], 0).unwrap();
// Verify deterministic ordering of a serialized Lua table.
assert_eq!(
str::from_utf8(&keyed_accounts[3].account.userdata).unwrap(),
"{a=1,b=2,c=3}"
);
} | rust_cleaned_test_functions.jsonl/113683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 679
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
76013,
39461,
368,
341,
286,
1077,
66874,
284,
435,
2,
698,
310,
2205,
24235,
284,
2795,
91868,
58,
17,
936,
23496,
8,
1005,
24166,
198,
310,
9618,
58,
18,
936,
23496,
284,
24235,
2306,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_owner() {
let program_id = crate::id();
let owner_key = Pubkey::new_unique();
let account_to_validate = Pubkey::new_unique();
let mut signer_keys = [Pubkey::default(); MAX_SIGNERS];
for signer_key in signer_keys.iter_mut().take(MAX_SIGNERS) {
*signer_key = Pubkey::new_unique();
}
let mut signer_lamports = 0;
let mut signer_data = vec![];
let mut signers = vec![
AccountInfo::new(
&owner_key,
true,
false,
&mut signer_lamports,
&mut signer_data,
&program_id,
false,
Epoch::default(),
);
MAX_SIGNERS + 1
];
for (signer, key) in signers.iter_mut().zip(&signer_keys) {
signer.key = key;
}
let mut lamports = 0;
let mut data = vec![0; Multisig::get_packed_len()];
let mut multisig = Multisig::unpack_unchecked(&data).unwrap();
multisig.m = MAX_SIGNERS as u8;
multisig.n = MAX_SIGNERS as u8;
multisig.signers = signer_keys;
multisig.is_initialized = true;
Multisig::pack(multisig, &mut data).unwrap();
let owner_account_info = AccountInfo::new(
&owner_key,
false,
false,
&mut lamports,
&mut data,
&program_id,
false,
Epoch::default(),
);
{
let mut lamports = 0;
let mut data = vec![0; Account::get_packed_len()];
let mut account = Account::unpack_unchecked(&data).unwrap();
account.owner = account_to_validate;
Account::pack(account, &mut data).unwrap();
let account_info = AccountInfo::new(
&account_to_validate,
true,
false,
&mut lamports,
&mut data,
&program_id,
false,
Epoch::default(),
);
let account_info_data_len = account_info.data_len();
let mut borrowed_data = account_info.try_borrow_mut_data().unwrap();
Processor::validate_owner(
&program_id,
&account_to_validate,
&account_info,
account_info_data_len,
&[],
)
.unwrap();
// modify the data to be sure that it wasn't silently dropped by the compiler
borrowed_data[0] = 1;
}
// full 11 of 11
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&signers,
)
.unwrap();
// 1 of 11
{
let mut multisig =
Multisig::unpack_unchecked(&owner_account_info.data.borrow()).unwrap();
multisig.m = 1;
Multisig::pack(multisig, &mut owner_account_info.data.borrow_mut()).unwrap();
}
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&signers,
)
.unwrap();
{
let mut multisig =
Multisig::unpack_unchecked(&owner_account_info.data.borrow()).unwrap();
multisig.m = 2;
multisig.n = 1;
Multisig::pack(multisig, &mut owner_account_info.data.borrow_mut()).unwrap();
}
assert_eq!(
Err(ProgramError::MissingRequiredSignature),
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&signers
)
);
{
let mut multisig =
Multisig::unpack_unchecked(&owner_account_info.data.borrow()).unwrap();
multisig.m = 0;
multisig.n = 11;
Multisig::pack(multisig, &mut owner_account_info.data.borrow_mut()).unwrap();
}
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&signers,
)
.unwrap();
// 2:11 but 0 provided
{
let mut multisig =
Multisig::unpack_unchecked(&owner_account_info.data.borrow()).unwrap();
multisig.m = 2;
multisig.n = 11;
Multisig::pack(multisig, &mut owner_account_info.data.borrow_mut()).unwrap();
}
assert_eq!(
Err(ProgramError::MissingRequiredSignature),
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&[]
)
);
// 2:11 but 1 provided
{
let mut multisig =
Multisig::unpack_unchecked(&owner_account_info.data.borrow()).unwrap();
multisig.m = 2;
multisig.n = 11;
Multisig::pack(multisig, &mut owner_account_info.data.borrow_mut()).unwrap();
}
assert_eq!(
Err(ProgramError::MissingRequiredSignature),
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&signers[0..1]
)
);
{
let mut multisig =
Multisig::unpack_unchecked(&owner_account_info.data.borrow()).unwrap();
multisig.m = 2;
multisig.n = 11;
Multisig::pack(multisig, &mut owner_account_info.data.borrow_mut()).unwrap();
}
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&signers[5..7],
)
.unwrap();
{
let mut multisig =
Multisig::unpack_unchecked(&owner_account_info.data.borrow()).unwrap();
multisig.m = 11;
multisig.n = 11;
Multisig::pack(multisig, &mut owner_account_info.data.borrow_mut()).unwrap();
}
signers[5].is_signer = false;
assert_eq!(
Err(ProgramError::MissingRequiredSignature),
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&signers
)
);
signers[5].is_signer = true;
{
let mut signer_lamports = 0;
let mut signer_data = vec![];
let signers = vec![
AccountInfo::new(
&signer_keys[5],
true,
false,
&mut signer_lamports,
&mut signer_data,
&program_id,
false,
Epoch::default(),
);
MAX_SIGNERS + 1
];
let mut multisig =
Multisig::unpack_unchecked(&owner_account_info.data.borrow()).unwrap();
multisig.m = 11;
multisig.n = 11;
Multisig::pack(multisig, &mut owner_account_info.data.borrow_mut()).unwrap();
assert_eq!(
Err(ProgramError::MissingRequiredSignature),
Processor::validate_owner(
&program_id,
&owner_key,
&owner_account_info,
owner_account_info.data_len(),
&signers
)
);
}
} | rust_cleaned_test_functions.jsonl/64300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4667
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
29027,
368,
341,
286,
1077,
2025,
842,
284,
17717,
486,
307,
543,
286,
1077,
6372,
3097,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
2692,
2346,
42681,
284,
22611,
792,
486,
931,
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... | 3 |
#[test]
fn test_ADC_positive_overflow() {
let code = vec![0xA9, 0x64, 0x69, 0x64];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.next(&mut memory).unwrap();
nes.next(&mut memory).unwrap();
assert_eq!(0xC8, nes.A);
assert_eq!(0, nes.C);
assert_eq!(1, nes.V);
} | rust_cleaned_test_functions.jsonl/38690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41630,
54160,
79073,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
14673,
24,
11,
220,
15,
87,
21,
19,
11,
220,
15,
87,
21,
24,
11,
220,
15,
87,
21,
19,
4821,
1789,
286,
1077,
5206,
308... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_one_parameter() {
use test_capnp::brand_once;
let mut message_for_brand = message::Builder::new_default();
let mut branded = message_for_brand.init_root::<brand_once::Builder>();
{
let branded_field = branded.reborrow().init_branded_field();
let mut foo = branded_field.init_generic_field();
foo.set_text_field("blah");
}
let reader = branded.into_reader();
assert_eq!("blah", reader.get_branded_field().unwrap().get_generic_field().unwrap().get_text_field().unwrap());
} | rust_cleaned_test_functions.jsonl/55853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
11667,
24899,
368,
341,
286,
990,
1273,
16388,
6199,
486,
13473,
7630,
401,
286,
1077,
5206,
1943,
5478,
54858,
284,
1943,
486,
3297,
486,
931,
9993,
543,
286,
1077,
5206,
45835,
284,
1943,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hours() {
assert_eq!(hours("1 year"), Ok(8760));
assert_eq!(hours("1 month"), Ok(720));
assert_eq!(hours("1 week"), Ok(168));
assert_eq!(hours("1 day"), Ok(24));
assert_eq!(hours("0 hours"), Ok(0));
assert_eq!(hours("0 hour"), Ok(0));
assert_eq!(hours("0 h"), Ok(0));
assert_eq!(hours("0hours"), Ok(0));
assert_eq!(hours("0hour"), Ok(0));
assert_eq!(hours("0h"), Ok(0));
assert_eq!(hours("1 hour"), Ok(1));
assert_eq!(hours("1 h"), Ok(1));
assert_eq!(hours("1hour"), Ok(1));
assert_eq!(hours("1h"), Ok(1));
assert_eq!(hours("2 hours"), Ok(2));
assert_eq!(hours("2 hour"), Ok(2));
assert_eq!(hours("2 h"), Ok(2));
assert_eq!(hours("2hours"), Ok(2));
assert_eq!(hours("2hour"), Ok(2));
assert_eq!(hours("2h"), Ok(2));
} | rust_cleaned_test_functions.jsonl/71125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 463
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41371,
368,
341,
286,
2060,
10714,
10297,
30382,
445,
16,
1042,
3975,
7622,
7,
23,
22,
21,
15,
1106,
286,
2060,
10714,
10297,
30382,
445,
16,
2254,
3975,
7622,
7,
22,
17,
15,
1106,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_take_fixed_size_list() {
do_take_fixed_size_list_test::<Int32Type>(
3,
vec![
Some(vec![None, Some(1), Some(2)]),
Some(vec![Some(3), Some(4), None]),
Some(vec![Some(6), Some(7), Some(8)]),
],
vec![2, 1, 0],
vec![
Some(vec![Some(6), Some(7), Some(8)]),
Some(vec![Some(3), Some(4), None]),
Some(vec![None, Some(1), Some(2)]),
],
);
do_take_fixed_size_list_test::<UInt8Type>(
1,
vec![
Some(vec![Some(1)]),
Some(vec![Some(2)]),
Some(vec![Some(3)]),
Some(vec![Some(4)]),
Some(vec![Some(5)]),
Some(vec![Some(6)]),
Some(vec![Some(7)]),
Some(vec![Some(8)]),
],
vec![2, 7, 0],
vec![
Some(vec![Some(3)]),
Some(vec![Some(8)]),
Some(vec![Some(1)]),
],
);
do_take_fixed_size_list_test::<UInt64Type>(
3,
vec![
Some(vec![Some(10), Some(11), Some(12)]),
Some(vec![Some(13), Some(14), Some(15)]),
None,
Some(vec![Some(16), Some(17), Some(18)]),
],
vec![3, 2, 1, 2, 0],
vec![
Some(vec![Some(16), Some(17), Some(18)]),
None,
Some(vec![Some(13), Some(14), Some(15)]),
None,
Some(vec![Some(10), Some(11), Some(12)]),
],
);
} | rust_cleaned_test_functions.jsonl/27059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
37839,
2368,
2019,
368,
341,
286,
653,
73261,
37839,
2368,
2019,
4452,
27638,
1072,
18,
17,
929,
17055,
310,
220,
18,
345,
310,
7486,
90515,
394,
4329,
25592,
20703,
4064,
11,
4329,
7,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ecb_encrypt() {
let key = "yellow submarine";
let msg = "Hello world how are you?";
match encrypt_aes_ecb_pkcs(msg.as_bytes(),key.as_bytes()) {
Ok(cipher) => {
match decrypt_aes_ecb_pkcs(&cipher,key.as_bytes()) {
Ok(plain) => assert_eq!(plain,msg.as_bytes()),
Err(_) => assert!(false),
}
},
Err(_) => assert!(false),
}
} | rust_cleaned_test_functions.jsonl/105363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
65,
66593,
368,
341,
262,
1077,
1376,
284,
330,
27869,
57529,
876,
262,
1077,
3750,
284,
330,
9707,
1879,
1246,
525,
498,
75558,
262,
2432,
29625,
90958,
36844,
65,
33321,
4837,
8119,
5357,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_approve_simple_propose_and_approval() {
// setup rt
let msig = Address::new_id(100);
let anne = Address::new_id(101);
let bob = Address::new_id(102);
let chuck = Address::new_id(103);
let mut rt = construct_runtime(msig);
let h = util::ActorHarness::new();
// construct msig
let signers = vec![anne, bob];
h.construct_and_verify(&mut rt, 2, 0, 0, signers);
let fake_params = RawBytes::from(vec![1, 2, 3, 4]);
let fake_method = 42;
let fake_ret = RawBytes::from(vec![4, 3, 2, 1]);
let send_value = TokenAmount::from(10u8);
rt.set_caller(*ACCOUNT_ACTOR_CODE_ID, anne);
let proposal_hash =
h.propose_ok(&mut rt, chuck, send_value.clone(), fake_method, fake_params.clone());
// assert txn
let expect_txn = Transaction {
to: chuck,
value: send_value.clone(),
method: fake_method,
params: fake_params.clone(),
approved: vec![anne],
};
h.assert_transactions(&rt, vec![(TxnID(0), expect_txn)]);
// approval
rt.set_balance(send_value.clone());
rt.set_caller(*ACCOUNT_ACTOR_CODE_ID, bob);
rt.expect_send(chuck, fake_method, fake_params, send_value, fake_ret, ExitCode::Ok);
h.approve_ok(&mut rt, TxnID(0), proposal_hash);
h.assert_transactions(&rt, vec![]);
} | rust_cleaned_test_functions.jsonl/84349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36057,
586,
30015,
21663,
960,
8378,
95613,
368,
341,
262,
442,
6505,
16677,
198,
262,
1077,
9829,
343,
284,
9177,
486,
931,
842,
7,
16,
15,
15,
317,
262,
1077,
85897,
284,
9177,
486,
931,
842... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_handle() {
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
let handle = hklm.raw_handle();
assert_eq!(HKEY_LOCAL_MACHINE, handle);
} | rust_cleaned_test_functions.jsonl/128081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
10630,
368,
341,
262,
1077,
305,
10561,
76,
284,
3184,
1592,
486,
1726,
750,
10896,
4784,
28399,
66702,
317,
262,
1077,
3705,
284,
305,
10561,
76,
18152,
10630,
543,
262,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_poc050_mint_bad_owner_fail() {
let mut t = Token::deployed();
let amount = 5_000_000.into();
t.mint(t.futjin, amount, Sender(t.bro));
} | rust_cleaned_test_functions.jsonl/39703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
509,
15,
20,
15,
717,
396,
34199,
29027,
22121,
368,
341,
262,
1077,
5206,
259,
284,
9660,
486,
35794,
291,
543,
262,
1077,
3311,
284,
220,
20,
62,
15,
15,
15,
62,
15,
15,
15,
39860,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ensure_property() {
let codec = vec![
CodecOp::LZ4(EncodingType::U16, 20),
CodecOp::PushDataSection(1),
CodecOp::LZ4(EncodingType::U64, 1),
CodecOp::PushDataSection(2),
CodecOp::LZ4(EncodingType::U8, 3),
CodecOp::DictLookup(EncodingType::U16),
];
let (fixed_width, rest) = Codec::new(
codec,
vec![EncodingType::U8, EncodingType::U8, EncodingType::U8],
)
.ensure_property(CodecOp::is_elementwise_decodable);
assert_eq!(fixed_width, vec![CodecOp::LZ4(EncodingType::U16, 20),]);
assert_eq!(
rest,
vec![
CodecOp::PushDataSection(1),
CodecOp::LZ4(EncodingType::U64, 1),
CodecOp::PushDataSection(2),
CodecOp::LZ4(EncodingType::U8, 3),
CodecOp::DictLookup(EncodingType::U16),
]
);
} | rust_cleaned_test_functions.jsonl/57910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
27289,
16638,
368,
341,
286,
1077,
34647,
284,
7486,
90515,
310,
67077,
7125,
486,
43,
57,
19,
85177,
929,
486,
52,
16,
21,
11,
220,
17,
15,
1326,
310,
67077,
7125,
486,
16644,
1043,
9620,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_config() {
let config = get_config();
assert_eq!(config.updater.name, "Fuchsia");
let os = config.os;
assert_eq!(os.platform, "Fuchsia");
assert_eq!(os.arch, std::env::consts::ARCH);
assert_eq!(config.service_url, "https://clients2.google.com/service/update2/fuchsia/json");
} | rust_cleaned_test_functions.jsonl/82093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5332,
368,
341,
286,
1077,
2193,
284,
633,
5332,
543,
286,
2060,
10714,
10297,
1676,
17652,
27463,
2644,
11,
330,
37,
73391,
797,
286,
1077,
2643,
284,
2193,
9291,
280,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_readexactly() {
Runtime::new()
.unwrap()
.block_on(lazy(|| {
let (mut sender, payload) = Payload::new(false);
let mut payload = PayloadBuffer::new(payload);
assert_eq!(Async::NotReady, payload.read_exact(2).ok().unwrap());
sender.feed_data(Bytes::from("line1"));
sender.feed_data(Bytes::from("line2"));
assert_eq!(
Async::Ready(Some(Bytes::from_static(b"li"))),
payload.read_exact(2).ok().unwrap()
);
assert_eq!(payload.len, 3);
assert_eq!(
Async::Ready(Some(Bytes::from_static(b"ne1l"))),
payload.read_exact(4).ok().unwrap()
);
assert_eq!(payload.len, 4);
sender.set_error(PayloadError::Incomplete);
payload.read_exact(10).err().unwrap();
let res: Result<(), ()> = Ok(());
result(res)
}))
.unwrap();
} | rust_cleaned_test_functions.jsonl/1595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
327,
32739,
368,
341,
286,
10954,
486,
931,
741,
310,
659,
15454,
741,
310,
659,
4574,
4470,
2333,
13619,
79453,
341,
394,
1077,
320,
6984,
4646,
11,
7729,
8,
284,
52916,
486,
931,
3576,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mknod_fifo_invalid_extra_operand() {
new_ucmd!()
.arg("test_file")
.arg("p")
.arg("1")
.arg("2")
.fails()
.stderr_contains(&"Fifos do not have major and minor device numbers");
} | rust_cleaned_test_functions.jsonl/82669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
19095,
347,
56590,
31433,
31858,
69259,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
445,
1944,
2458,
1138,
286,
659,
858,
445,
79,
1138,
286,
659,
858,
445,
16,
1138,
286,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
crate::init().unwrap();
let mut tags = TagList::new();
assert_eq!(tags.to_string(), "taglist;");
{
let tags = tags.get_mut().unwrap();
tags.add::<Title>(&"a title", TagMergeMode::Append); // String
tags.add::<Title>(&"another title", TagMergeMode::Append); // String
tags.add::<Duration>(&(ClockTime::SECOND * 120), TagMergeMode::Append); // u64
tags.add::<Bitrate>(&96_000, TagMergeMode::Append); // u32
tags.add::<TrackGain>(&1f64, TagMergeMode::Append); // f64
tags.add::<Date>(
&glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap(),
TagMergeMode::Append,
);
tags.add::<DateTime>(
&crate::DateTime::new_ymd(2018, 5, 28).unwrap(),
TagMergeMode::Append,
);
let sample = {
let mut buffer = Buffer::from_slice(vec![1, 2, 3, 4]);
{
let buffer = buffer.get_mut().unwrap();
buffer.set_offset(0);
buffer.set_offset_end(0);
}
Sample::builder().buffer(&buffer).build()
};
tags.add::<Image>(&sample, TagMergeMode::Append); // Sample
}
let pretty_config = ron::ser::PrettyConfig::new().with_new_line("".to_string());
let res = ron::ser::to_string_pretty(&tags, pretty_config);
assert_eq!(
Ok(concat!(
r#"("#,
r#" scope: Stream,"#,
r#" tags: ["#,
r#" ("title", ["#,
r#" "a title","#,
r#" "another title","#,
r#" ]),"#,
r#" ("duration", ["#,
r#" 120000000000,"#,
r#" ]),"#,
r#" ("bitrate", ["#,
r#" 96000,"#,
r#" ]),"#,
r#" ("replaygain-track-gain", ["#,
r#" 1,"#,
r#" ]),"#,
r#" ("date", ["#,
r#" YMD(2018, 5, 28),"#,
r#" ]),"#,
r#" ("datetime", ["#,
r#" Some(YMD(2018, 5, 28)),"#,
r#" ]),"#,
r#" ("image", ["#,
r#" Some(("#,
r#" buffer: Some(("#,
r#" pts: None,"#,
r#" dts: None,"#,
r#" duration: None,"#,
r#" offset: 0,"#,
r#" offset_end: 0,"#,
r#" flags: ("#,
r#" bits: 0,"#,
r#" ),"#,
r#" buffer: "AQIDBA==","#,
r#" )),"#,
r#" buffer_list: None,"#,
r#" caps: None,"#,
r#" segment: Some(("#,
r#" flags: ("#,
r#" bits: 0,"#,
r#" ),"#,
r#" rate: 1,"#,
r#" applied_rate: 1,"#,
r#" format: Time,"#,
r#" base: 0,"#,
r#" offset: 0,"#,
r#" start: 0,"#,
r#" stop: -1,"#,
r#" time: 0,"#,
r#" position: 0,"#,
r#" duration: -1,"#,
r#" )),"#,
r#" info: None,"#,
r#" )),"#,
r#" ]),"#,
r#" ],"#,
r#")"#,
)
.to_owned()),
res,
);
} | rust_cleaned_test_functions.jsonl/61372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3049
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
368,
341,
286,
17717,
486,
2327,
1005,
15454,
1428,
286,
1077,
5206,
9492,
284,
12353,
852,
486,
931,
543,
286,
2060,
10714,
10297,
14082,
2389,
3904,
1507,
330,
4578,
1607,
34649,
286,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apple_tps() {
let enc = Encoder::from_hex("0049000100011e00020010449aeef472626f18a5bba2d51ae473be0003000244b0000400048015f9000005000480015f900006000480015f90000700048004000000080001080009000108");
let tps2 = TransportParameters::decode(&mut enc.as_decoder()).unwrap();
} | rust_cleaned_test_functions.jsonl/55323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8191,
273,
528,
1690,
368,
341,
286,
1077,
3209,
284,
55115,
486,
1499,
32655,
445,
15,
15,
19,
24,
15,
15,
15,
16,
15,
15,
15,
16,
16,
68,
15,
15,
15,
17,
15,
15,
16,
15,
19,
19,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_load() -> Result<(), Box<dyn Error>> {
let dir = temp_dir();
let cf = dir.join("config.toml");
let mut config = File::create(cf)?;
config.write_all(
toml::to_string(&Root {
config: Config {
name: "test".to_string(),
slug: "test".to_string(),
open_posting: None,
tag_subject: None,
},
})?
.as_bytes(),
)?;
let list = List::load(dir)?;
assert_eq!(list.config.name, "test");
Ok(())
} | rust_cleaned_test_functions.jsonl/52894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
12411,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
5419,
284,
2730,
4334,
543,
286,
1077,
24111,
284,
5419,
5446,
445,
1676,
73494,
75,
797,
286,
1077,
5206,
2193,
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... | 5 |
#[test]
fn test_days_to_ordinal() {
for days in 0..4096 * 20 {
let year = days_to_year(days);
let ordinal = days_to_ordinal(days);
let date = NaiveDate::from_yo(year as i32, ordinal as u32);
assert_eq!(year, date.year() as u16);
assert_eq!(ordinal, date.ordinal() as u16);
}
} | rust_cleaned_test_functions.jsonl/122948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28353,
2346,
62,
45151,
368,
341,
286,
369,
2849,
304,
220,
15,
496,
19,
15,
24,
21,
353,
220,
17,
15,
341,
310,
1077,
1042,
284,
2849,
2346,
14645,
42595,
317,
310,
1077,
67948,
284,
2849,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_interval_compare() {
use std::cmp::Ordering;
{
let iv = Interval::<i32>::bounded(1, 10, Vec::new());
use std::cmp::Ordering;
assert!(iv.compare_elem(&0) == Ordering::Greater);
assert!(iv.compare_elem(&2) == Ordering::Equal);
assert!(iv.compare_elem(&11) == Ordering::Less);
}
{
let iv = Interval::<i32>::with_lower_bound(1, Vec::new());
assert!(iv.compare_elem(&0) == Ordering::Greater);
// Not sure this should be equal
assert!(iv.compare_elem(&1) == Ordering::Equal);
assert!(iv.compare_elem(&2) == Ordering::Less);
}
} | rust_cleaned_test_functions.jsonl/112647 | {
"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,
20541,
32235,
368,
341,
310,
990,
1460,
486,
7293,
486,
4431,
287,
280,
310,
341,
394,
1077,
17509,
284,
40584,
27638,
72,
18,
17,
6831,
65686,
7,
16,
11,
220,
16,
15,
11,
11312,
486,
931,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connect_validation() {
let mut s = socket();
assert_eq!(s.connect((IpAddress::Unspecified, 80), LOCAL_END),
Err(Error::Unaddressable));
assert_eq!(s.connect(REMOTE_END, (MOCK_UNSPECIFIED, 0)),
Err(Error::Unaddressable));
assert_eq!(s.connect((MOCK_UNSPECIFIED, 0), LOCAL_END),
Err(Error::Unaddressable));
assert_eq!(s.connect((IpAddress::Unspecified, 80), LOCAL_END),
Err(Error::Unaddressable));
} | rust_cleaned_test_functions.jsonl/1709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
19416,
368,
341,
286,
1077,
5206,
274,
284,
7575,
543,
286,
2060,
10714,
10297,
82,
10800,
1188,
98567,
486,
1806,
53434,
11,
220,
23,
15,
701,
42501,
10898,
1326,
4293,
15495,
37396,
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_hash_internal_state_genesis() {
let bank0 = Bank::new(&create_genesis_config(10).0);
let bank1 = Bank::new(&create_genesis_config(20).0);
assert_ne!(bank0.hash_internal_state(), bank1.hash_internal_state());
} | rust_cleaned_test_functions.jsonl/2585 | {
"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,
8950,
23472,
4387,
16322,
13774,
368,
341,
286,
1077,
6073,
15,
284,
8547,
486,
931,
2099,
3182,
16322,
13774,
5332,
7,
16,
15,
568,
15,
317,
286,
1077,
6073,
16,
284,
8547,
486,
931,
2099,
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_create_program_spec_invalid_values() {
let mut context_builder = ContextBuilder::new();
context_builder.log_in(&[RoleType::SpecCreator]);
let conn = context_builder.db_conn();
let hw_spec = HardwareSpecFactory::default().name("HW 1").insert(conn);
let values_list: InputValue = InputValue::list(
[1, 2, 3].iter().map(|v| InputValue::scalar(*v)).collect(),
);
let runner = QueryRunner::new(context_builder);
assert_eq!(
runner.query(
QUERY,
hashmap! {
"hardwareSpecId" => InputValue::scalar(hw_spec.id.to_string()),
"name" => InputValue::scalar(""),
"description" => InputValue::scalar("description!"),
// TODO use invalid values here once the DB validation is working
"input" => values_list.clone(),
"expectedOutput" => values_list,
}
),
(
serde_json::Value::Null,
vec![json!({
"locations": [{"line": 9, "column": 9}],
"message": "Input validation error(s)",
"path": ["createProgramSpec"],
"extensions": {
"name": [{"min": "1", "value": "\"\""}],
}
})]
)
);
} | rust_cleaned_test_functions.jsonl/90808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 662
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25096,
13594,
31433,
9146,
368,
341,
262,
1077,
5206,
2266,
28532,
284,
9608,
3297,
486,
931,
543,
262,
2266,
28532,
1665,
1243,
2099,
58,
9030,
929,
486,
8327,
31865,
2558,
262,
1077,
4534,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let data = std::fs::read("tests/test_circuit.r1cs").unwrap();
let parsed_file = R1csFile::<32>::read(data.as_slice()).unwrap();
let mut serialized_file = Vec::new();
parsed_file.write(&mut serialized_file).unwrap();
assert_eq!(data.len(), serialized_file.len());
assert_eq!(data, serialized_file);
} | rust_cleaned_test_functions.jsonl/69988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
368,
341,
286,
1077,
821,
284,
1460,
486,
3848,
486,
878,
445,
23841,
12697,
666,
37268,
1746,
16,
4837,
1827,
15454,
543,
286,
1077,
15676,
2458,
284,
431,
16,
4837,
1703,
27638,
18,
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_get() {
let mut histogram = Histogram::default();
assert_eq!(histogram.get(Base::A, Base::C), 0);
histogram.hit(Base::A, Base::C);
assert_eq!(histogram.get(Base::A, Base::C), 1);
} | rust_cleaned_test_functions.jsonl/86255 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
286,
1077,
5206,
30281,
284,
82138,
486,
2258,
543,
286,
2060,
10714,
10297,
21158,
12958,
670,
22225,
486,
32,
11,
5351,
486,
34,
701,
220,
15,
317,
286,
30281,
55066,
22225,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_image_too_large() {
/ let img = [0; 65_536];
// Try to encode an image that is too large
let mut encoded = Vec::new();
let encoder = JpegEncoder::new_with_quality(&mut encoded, 100);
let result = encoder.write_image(&img, 65_536, 1, ColorType::L8);
match result {
Err(ImageError::Parameter(err)) => {
assert_eq!(err.kind(), DimensionMismatch)
}
other => {
assert!(false, "Encoding an image that is too large should return a DimensionError \
it returned {:?} instead", other)
}
}
} | rust_cleaned_test_functions.jsonl/4287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
2346,
78,
45228,
368,
341,
394,
608,
981,
1077,
4964,
284,
508,
15,
26,
220,
21,
20,
62,
20,
18,
21,
935,
286,
442,
9735,
311,
16164,
458,
2168,
429,
374,
2238,
3460,
198,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_resource_block_declaration_keywords() {
let p = Polar::new();
expect_error(
&p,
r#"resource Org{roles={};}"#,
r#"Expected 'roles' declaration to be a list of strings; found a dictionary:"#,
);
expect_error(
&p,
r#"resource Org{relations=[];}"#,
r#"Expected 'relations' declaration to be a dictionary; found a list:"#,
);
expect_error(
&p,
r#"resource Org{foo=[];}"#,
r#"Unexpected declaration 'foo'. Did you mean for this to be 'roles = [ ... ];' or 'permissions = [ ... ];'?"#,
);
expect_error(
&p,
r#"resource Org{foo={};}"#,
r#"Unexpected declaration 'foo'. Did you mean for this to be 'relations = { ... };'?"#,
);
expect_error(
&p,
r#"resource Org{"foo" if "bar" onn "baz";}"#,
r#"Unexpected relation keyword 'onn'. Did you mean 'on'?"#,
);
} | rust_cleaned_test_functions.jsonl/31749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 545
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17962,
7113,
77926,
51354,
368,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
1720,
4096,
1006,
310,
609,
79,
345,
310,
435,
55543,
9233,
33706,
90,
14643,
1165,
11061,
9863,
2,
345,
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_long_to_short() {
let mut short = Opt {
name: Name::Long("banana".to_string()),
hasarg: HasArg::Yes,
occur: Occur::Req,
aliases: Vec::new(),
};
short.aliases = vec!(Opt { name: Name::Short('b'),
hasarg: HasArg::Yes,
occur: Occur::Req,
aliases: Vec::new() });
let verbose = reqopt("b", "banana", "some bananas", "VAL");
assert!(verbose.long_to_short() == short);
} | rust_cleaned_test_functions.jsonl/11203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
2346,
16673,
368,
341,
286,
1077,
5206,
2805,
284,
16554,
341,
310,
829,
25,
3988,
486,
6583,
445,
87747,
3263,
983,
3904,
14702,
310,
702,
858,
25,
11443,
2735,
486,
9454,
345,
310,
1217... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_leader_start_replication() {
setup_for_test();
let s = new_storage();
let mut r = new_test_raft(1, vec![1, 2, 3], 10, 1, s.clone());
r.become_candidate();
r.become_leader();
commit_noop_entry(&mut r, &s);
let li = r.raft_log.last_index();
r.step(new_message(1, 1, MessageType::MsgPropose, 1))
.expect("");
assert_eq!(r.raft_log.last_index(), li + 1);
assert_eq!(r.raft_log.committed, li);
let mut msgs = r.read_messages();
msgs.sort_by_key(|m| format!("{:?}", m));
let wents = vec![new_entry(1, li + 1, SOME_DATA)];
let new_message_ext = |f, to, ents| {
let mut m = new_message(f, to, MessageType::MsgAppend, 0);
m.set_term(1);
m.set_index(li);
m.set_log_term(1);
m.set_commit(li);
m.set_entries(RepeatedField::from_vec(ents));
m
};
let expect_msgs = vec![
new_message_ext(1, 2, wents.clone()),
new_message_ext(1, 3, wents.clone()),
];
assert_eq!(msgs, expect_msgs);
assert_eq!(r.raft_log.unstable_entries(), Some(&*wents));
} | rust_cleaned_test_functions.jsonl/54473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79991,
4906,
25533,
1693,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
274,
284,
501,
23310,
543,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reader() {
let _ = env_logger::try_init();
let sizes = [24usize, 28, 32];
for record_size in sizes.iter() {
let versions = [4usize, 6];
for ip_version in versions.iter() {
let filename = format!(
"test-data/test-data/MaxMind-DB-test-ipv{}-{}.mmdb",
ip_version, record_size
);
let reader = Reader::open_readfile(filename).ok().unwrap();
check_metadata(&reader, *ip_version, *record_size);
check_ip(&reader, *ip_version);
}
}
} | rust_cleaned_test_functions.jsonl/42008 | {
"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,
22306,
368,
341,
262,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
1428,
262,
1077,
12282,
284,
508,
17,
19,
51878,
11,
220,
17,
23,
11,
220,
18,
17,
935,
262,
369,
3255,
2368,
304,
12282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_max_depth() {
assert_eq!(Solution::max_depth(String::from("(1+(2*3)+((8)/4))+1")), 3);
assert_eq!(Solution::max_depth(String::from("(1)+((2))+(((3)))")), 3);
assert_eq!(Solution::max_depth(String::from("1+(2*3)/(2-1)")), 1);
assert_eq!(Solution::max_depth(String::from("1")), 0);
} | rust_cleaned_test_functions.jsonl/14915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
19061,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
2810,
19061,
2242,
486,
1499,
31732,
16,
13362,
17,
9,
18,
7257,
1188,
23,
5620,
19,
38592,
16,
35674,
220,
18,
317,
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,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_host_stateless_address_autoconfiguration() {
let config = Ipv6::DUMMY_CONFIG;
let mut ctx = DummyEventDispatcherBuilder::default().build::<DummyEventDispatcher>();
let device =
ctx.state_mut().add_ethernet_device(config.local_mac, Ipv6::MINIMUM_LINK_MTU.into());
crate::device::initialize_device(&mut ctx, device);
let src_mac = config.remote_mac;
let src_ip = src_mac.to_ipv6_link_local().addr().get();
let prefix = Ipv6Addr::new([1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0]);
let prefix_length = 64;
let addr_subnet = AddrSubnet::new(prefix, prefix_length).unwrap();
let mut expected_addr = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0];
expected_addr[8..].copy_from_slice(&config.local_mac.to_eui64()[..]);
let expected_addr = UnicastAddr::new(Ipv6Addr::new(expected_addr)).unwrap();
let expected_addr_sub = AddrSubnet::from_witness(expected_addr, prefix_length).unwrap();
// Enable DAD for future IPs.
let mut ndp_configs = NdpConfigurations::default();
ndp_configs.set_max_router_solicitations(None);
crate::device::set_ndp_configurations(&mut ctx, device, ndp_configs);
let mut icmpv6_packet_buf = slaac_packet_buf(
src_ip,
config.local_ip.get(),
prefix,
prefix_length,
true,
false,
100,
0,
);
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
ctx.receive_ndp_packet(
device,
src_ip.try_into().unwrap(),
config.local_ip,
icmpv6_packet.unwrap_ndp(),
);
let ndp_state =
StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with(
&mut ctx,
device.id().into(),
);
// Prefix should be in our list now.
assert!(ndp_state.has_prefix(&addr_subnet));
// No new address should be formed.
assert_eq!(
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.count(),
0
);
// Should get a new IP.
let valid_lifetime = 10000;
let preferred_lifetime = 9000;
let mut icmpv6_packet_buf = slaac_packet_buf(
src_ip,
config.local_ip.get(),
prefix,
prefix_length,
true,
true,
valid_lifetime,
preferred_lifetime,
);
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
ctx.receive_ndp_packet(
device,
src_ip.try_into().unwrap(),
config.local_ip,
icmpv6_packet.unwrap_ndp(),
);
let ndp_state =
StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with(
&mut ctx,
device.id().into(),
);
assert!(ndp_state.has_prefix(&addr_subnet));
// Should have gotten a new IP.
assert_eq!(
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.count(),
1
);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.last()
.unwrap();
assert_eq!(*entry.addr_sub(), expected_addr_sub);
assert_eq!(entry.state(), AddressState::Tentative);
assert_eq!(entry.config_type(), AddrConfigType::Slaac);
// Make sure deprecate and invalidation timers are set.
let now = ctx.now();
assert_eq!(
ctx.dispatcher()
.timer_events()
.filter(|x| (*x.0
== now.checked_add(Duration::from_secs(preferred_lifetime.into())).unwrap())
&& (*x.1
== NdpTimerId::new_deprecate_slaac_address(
device.id().into(),
expected_addr
)
.into()))
.count(),
1
);
assert_eq!(
ctx.dispatcher()
.timer_events()
.filter(|x| (*x.0
== now.checked_add(Duration::from_secs(valid_lifetime.into())).unwrap())
&& (*x.1
== NdpTimerId::new_invalidate_slaac_address(
device.id().into(),
expected_addr
)
.into()))
.count(),
1
);
// Complete DAD
assert_eq!(
run_for(&mut ctx, Duration::from_secs(1)),
vec!(NdpTimerId::new_dad_ns_transmission(device.id().into(), expected_addr).into())
);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.last()
.unwrap();
assert_eq!(*entry.addr_sub(), expected_addr_sub);
assert_eq!(entry.state(), AddressState::Assigned);
assert_eq!(entry.config_type(), AddrConfigType::Slaac);
// Receive the same RA.
let mut icmpv6_packet_buf = slaac_packet_buf(
src_ip,
config.local_ip.get(),
prefix,
prefix_length,
true,
true,
valid_lifetime,
preferred_lifetime,
);
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
ctx.receive_ndp_packet(
device,
src_ip.try_into().unwrap(),
config.local_ip,
icmpv6_packet.unwrap_ndp(),
);
let ndp_state =
StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with(
&mut ctx,
device.id().into(),
);
assert!(ndp_state.has_prefix(&addr_subnet));
// Should not have changed.
assert_eq!(
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.count(),
1
);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.last()
.unwrap();
assert_eq!(*entry.addr_sub(), expected_addr_sub);
assert_eq!(entry.state(), AddressState::Assigned);
assert_eq!(entry.config_type(), AddrConfigType::Slaac);
// Timers should have been reset.
let now = ctx.now();
assert_eq!(
ctx.dispatcher()
.timer_events()
.filter(|x| (*x.0
== now.checked_add(Duration::from_secs(preferred_lifetime.into())).unwrap())
&& (*x.1
== NdpTimerId::new_deprecate_slaac_address(
device.id().into(),
expected_addr
)
.into()))
.count(),
1
);
assert_eq!(
ctx.dispatcher()
.timer_events()
.filter(|x| (*x.0
== now.checked_add(Duration::from_secs(valid_lifetime.into())).unwrap())
&& (*x.1
== NdpTimerId::new_invalidate_slaac_address(
device.id().into(),
expected_addr
)
.into()))
.count(),
1
);
// Preferred lifetime expiration.
// Should be marked as deprecated.
assert_eq!(
run_for(&mut ctx, Duration::from_secs(preferred_lifetime.into())),
vec!(NdpTimerId::new_deprecate_slaac_address(device.id().into(), expected_addr).into())
);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.last()
.unwrap();
assert_eq!(entry.state(), AddressState::Deprecated);
assert_eq!(entry.config_type(), AddrConfigType::Slaac);
// Valid lifetime expiration.
// Should be deleted.
assert_eq!(
run_for(&mut ctx, Duration::from_secs((valid_lifetime - preferred_lifetime).into())),
vec!(
NdpTimerId::new_prefix_invalidation(device.id().into(), addr_subnet).into(),
NdpTimerId::new_invalidate_slaac_address(device.id().into(), expected_addr).into()
)
);
assert_eq!(
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.count(),
0
);
// No more timers.
assert!(trigger_next_timer(&mut ctx).is_none());
} | rust_cleaned_test_functions.jsonl/82825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
4387,
1717,
6744,
27740,
21138,
368,
341,
286,
1077,
2193,
284,
358,
30168,
21,
486,
35,
58673,
12568,
280,
286,
1077,
5206,
5635,
284,
50567,
1556,
21839,
3297,
486,
2258,
1005,
5834,
2763... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_events_empty() {
let mut events = Events::<TestEvent>::default();
assert!(events.is_empty());
events.send(TestEvent { i: 0 });
assert!(!events.is_empty());
events.update();
assert!(!events.is_empty());
// events are only empty after the second call to update
// due to double buffering.
events.update();
assert!(events.is_empty());
} | rust_cleaned_test_functions.jsonl/122931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19691,
15124,
368,
341,
286,
1077,
5206,
4357,
284,
17627,
27638,
2271,
1556,
6831,
2258,
543,
286,
2060,
10297,
12389,
2079,
15124,
5231,
286,
4357,
5219,
31159,
1556,
314,
600,
25,
220,
15,
1625... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cookie_get_ohno() {
let client = Client::debug(rocket()).unwrap();
let response = client
.get("/oh-no")
.cookie(Cookie::new("a", "Cookie"))
.private_cookie(Cookie::new("b", " tastes "))
.cookie(Cookie::new("c", "good!"))
.dispatch();
assert_ne!(response.into_string().unwrap(), "Cookie tastes good!");
} | rust_cleaned_test_functions.jsonl/4799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38663,
3062,
62,
2267,
2152,
368,
341,
286,
1077,
2943,
284,
8423,
486,
8349,
7,
46790,
6011,
15454,
543,
286,
1077,
2033,
284,
2943,
198,
310,
659,
455,
4283,
2267,
28366,
1138,
310,
659,
16236... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_borrow() {
let mut map: AHashMap<String, String> = AHashMap::new();
map.insert("foo".to_string(), "Bar".to_string());
map.insert("Bar".to_string(), map.get("foo").unwrap().to_owned());
} | rust_cleaned_test_functions.jsonl/15213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
7768,
368,
341,
286,
1077,
5206,
2415,
25,
362,
18497,
3464,
11,
923,
29,
284,
362,
18497,
486,
931,
543,
286,
2415,
7030,
445,
7975,
3263,
983,
3904,
1507,
330,
3428,
3263,
983,
3904,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vmcall_print_opcode() {
let mut test_vm = VM::new();
test_vm.registers[0].content = 255; // print
test_vm.registers[1].content = 0; // print ref
test_vm.registers[2].content = 0; // arg1
test_vm.registers[3].content = 2; // arg1 ref
test_vm.registers[4].content = 1; // arg2
test_vm.registers[5].content = 4; // arg2 ref
test_vm.program = vec![8, 3, 5, 1];
test_vm.run();
} | rust_cleaned_test_functions.jsonl/60346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39008,
6659,
10064,
71319,
368,
341,
286,
1077,
5206,
1273,
39008,
284,
17792,
486,
931,
543,
286,
1273,
39008,
7031,
9303,
58,
15,
936,
1796,
284,
220,
17,
20,
20,
26,
442,
1173,
198,
286,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ansi_preserving_slice() {
assert_eq!(ansi_preserving_slice("", 0), "");
assert_eq!(ansi_preserving_slice("a", 0), "a");
assert_eq!(ansi_preserving_slice("a", 1), "");
assert_eq!(
ansi_preserving_slice("\x1b[1;35m-2222.2222.2222.2222\x1b[0m", 1),
"\x1b[1;35m2222.2222.2222.2222\x1b[0m"
);
assert_eq!(
ansi_preserving_slice("\x1b[1;35m-2222.2222.2222.2222\x1b[0m", 15),
"\x1b[1;35m.2222\x1b[0m"
);
assert_eq!(
ansi_preserving_slice("\x1b[1;36m-\x1b[m\x1b[1;36m2222·2222·2222·2222\x1b[m\n", 1),
"\x1b[1;36m\x1b[m\x1b[1;36m2222·2222·2222·2222\x1b[m\n"
)
} | rust_cleaned_test_functions.jsonl/49549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
52067,
32116,
19505,
26488,
368,
341,
286,
2060,
10714,
10297,
52067,
32116,
19505,
26488,
19814,
220,
15,
701,
14498,
286,
2060,
10714,
10297,
52067,
32116,
19505,
26488,
445,
64,
497,
220,
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_ty() {
check(
r#"
macro_rules! m {
($t:ty) => ( fn bar() -> $t {} )
}
m! { Baz<u8> }
"#,
expect![[r#"
macro_rules! m {
($t:ty) => ( fn bar() -> $t {} )
}
fn bar() -> Baz<u8> {}
"#]],
)
} | rust_cleaned_test_functions.jsonl/85227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53171,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
1711,
83,
25,
1881,
8,
589,
320,
5168,
3619,
368,
1464,
400,
83,
4687,
1727,
532,
76,
0,
314,
91711,
34837... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_state() {
let mut radio = MockRadio::new(&[Transaction::get_state(Ok(MockState::Idle))]);
let res = radio.get_state().unwrap();
assert_eq!(res, MockState::Idle);
radio.done();
} | rust_cleaned_test_functions.jsonl/35586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49740,
34134,
3062,
4387,
368,
341,
286,
1077,
5206,
8887,
284,
14563,
28203,
486,
931,
2099,
58,
8070,
486,
455,
4387,
7,
11578,
66436,
1397,
486,
41370,
593,
10149,
286,
1077,
592,
284,
8887,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decoder() {
let _ = env_logger::try_init();
#[allow(non_snake_case)]
#[derive(Deserialize, Debug, Eq, PartialEq)]
struct MapXType {
arrayX: Vec<u32>,
utf8_stringX: String,
};
#[allow(non_snake_case)]
#[derive(Deserialize, Debug, Eq, PartialEq)]
struct MapType {
mapX: MapXType,
};
#[derive(Deserialize, Debug)]
struct TestType<'a> {
array: Vec<u32>,
boolean: bool,
bytes: &'a [u8],
double: f64,
float: f32,
int32: i32,
map: MapType,
uint16: u16,
uint32: u32,
uint64: u64,
uint128: u128,
utf8_string: String,
}
let r = Reader::open_readfile("test-data/test-data/MaxMind-DB-test-decoder.mmdb");
if let Err(err) = r {
panic!(format!("error opening mmdb: {:?}", err));
}
let r = r.unwrap();
let ip: IpAddr = FromStr::from_str("1.1.1.0").unwrap();
let result: TestType = r.lookup(ip).unwrap();
assert_eq!(result.array, vec![1u32, 2u32, 3u32]);
assert_eq!(result.boolean, true);
assert_eq!(result.bytes, vec![0u8, 0u8, 0u8, 42u8]);
assert_eq!(result.double, 42.123_456);
assert_eq!(result.float, 1.1);
assert_eq!(result.int32, -268_435_456);
assert_eq!(
result.map,
MapType {
mapX: MapXType {
arrayX: vec![7, 8, 9],
utf8_stringX: "hello".to_string(),
},
}
);
assert_eq!(result.uint16, 100);
assert_eq!(result.uint32, 268_435_456);
assert_eq!(result.uint64, 1_152_921_504_606_846_976);
assert_eq!(
result.uint128,
1_329_227_995_784_915_872_903_807_060_280_344_576
);
assert_eq!(result.utf8_string, "unicode! ☯ - ♫".to_string());
} | rust_cleaned_test_functions.jsonl/42004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 954
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
368,
341,
262,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
1428,
262,
11506,
7183,
29191,
28022,
726,
19096,
5563,
262,
11506,
27098,
7,
64465,
11,
11091,
11,
33122,
11,
55039,
5563,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bin_incorrect_options() {
let args = [
String::from("command"),
String::from("-incorrect"),
String::from("query"),
String::from("./test-data/test.txt"),
];
let config = parse_config(&args);
assert!(config.is_err());
} | rust_cleaned_test_functions.jsonl/19380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21816,
1243,
19928,
8743,
368,
341,
262,
1077,
2827,
284,
2278,
286,
923,
486,
1499,
445,
5631,
4461,
286,
923,
486,
1499,
13645,
61954,
4461,
286,
923,
486,
1499,
445,
1631,
4461,
286,
923,
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_read_and_emit() {
let expect = Query {
name: Name::from_ascii("WWW.example.com").unwrap(),
query_type: RecordType::AAAA,
query_class: DNSClass::IN,
..Query::default()
};
let mut byte_vec: Vec<u8> = Vec::with_capacity(512);
{
let mut encoder = BinEncoder::new(&mut byte_vec);
expect.emit(&mut encoder).unwrap();
}
let mut decoder = BinDecoder::new(&byte_vec);
let got = Query::read(&mut decoder).unwrap();
assert_eq!(got, expect);
} | rust_cleaned_test_functions.jsonl/11228 | {
"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,
6443,
8378,
69082,
368,
341,
262,
1077,
1720,
284,
11361,
341,
286,
829,
25,
3988,
486,
1499,
50238,
445,
45508,
7724,
905,
1827,
15454,
3148,
286,
3239,
1819,
25,
13583,
929,
486,
25699,
345,
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_into_logical_type() {
let converted_type: Option<parquet::ConvertedType> = None;
assert_eq!(converted_type, LogicalType::None.into());
assert_eq!(Some(parquet::ConvertedType::Utf8), LogicalType::Utf8.into());
assert_eq!(Some(parquet::ConvertedType::Map), LogicalType::Map.into());
assert_eq!(
Some(parquet::ConvertedType::MapKeyValue),
LogicalType::MapKeyValue.into()
);
assert_eq!(Some(parquet::ConvertedType::List), LogicalType::List.into());
assert_eq!(Some(parquet::ConvertedType::Enum), LogicalType::Enum.into());
assert_eq!(
Some(parquet::ConvertedType::Decimal),
LogicalType::Decimal.into()
);
assert_eq!(Some(parquet::ConvertedType::Date), LogicalType::Date.into());
assert_eq!(
Some(parquet::ConvertedType::TimeMillis),
LogicalType::TimeMillis.into()
);
assert_eq!(
Some(parquet::ConvertedType::TimeMicros),
LogicalType::TimeMicros.into()
);
assert_eq!(
Some(parquet::ConvertedType::TimestampMillis),
LogicalType::TimestampMillis.into()
);
assert_eq!(
Some(parquet::ConvertedType::TimestampMicros),
LogicalType::TimestampMicros.into()
);
assert_eq!(
Some(parquet::ConvertedType::Uint8),
LogicalType::Uint8.into()
);
assert_eq!(
Some(parquet::ConvertedType::Uint16),
LogicalType::Uint16.into()
);
assert_eq!(
Some(parquet::ConvertedType::Uint32),
LogicalType::Uint32.into()
);
assert_eq!(
Some(parquet::ConvertedType::Uint64),
LogicalType::Uint64.into()
);
assert_eq!(Some(parquet::ConvertedType::Int8), LogicalType::Int8.into());
assert_eq!(
Some(parquet::ConvertedType::Int16),
LogicalType::Int16.into()
);
assert_eq!(
Some(parquet::ConvertedType::Int32),
LogicalType::Int32.into()
);
assert_eq!(
Some(parquet::ConvertedType::Int64),
LogicalType::Int64.into()
);
assert_eq!(Some(parquet::ConvertedType::Json), LogicalType::Json.into());
assert_eq!(Some(parquet::ConvertedType::Bson), LogicalType::Bson.into());
assert_eq!(
Some(parquet::ConvertedType::Interval),
LogicalType::Interval.into()
);
} | rust_cleaned_test_functions.jsonl/126065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 890
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
86484,
1819,
368,
341,
197,
10217,
16099,
1819,
25,
6959,
27,
1732,
23300,
486,
61941,
929,
29,
284,
2240,
280,
197,
6948,
10714,
10297,
76204,
1819,
11,
62069,
929,
486,
4064,
39860,
1423,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vectors_unknown_param() {
let rdata =
b"\x00\x01\
\x03\x66\x6f\x6f\x07\x65\x78\x61\x6d\x70\x6c\x65\x03\x63\x6f\x6d\x00\
\x02\x9b\
\x00\x05\
\x68\x65\x6c\x6c\x6f";
// parse test
let mut parser = Parser::from_ref(rdata.as_ref());
let svcb = Svcb::parse(&mut parser).unwrap();
assert_eq!(1, svcb.priority);
assert_eq!(
"foo.example.com".parse::<Dname<Octets512>>().unwrap(),
svcb.target
);
let mut param_iter = svcb.iter();
let r = param_iter.next();
match r {
Some(Ok(AllParams::Unknown(param))) => {
assert_eq!(0x029b, param.key());
assert_eq!(b"\x68\x65\x6c\x6c\x6f".as_ref(), *param.value(),);
}
_ => panic!("{:?}", r),
}
assert_eq!(None, param_iter.next());
// compose test
let mut svcb_builder =
Svcb::new(svcb.priority, svcb.target, Octets512::new());
svcb_builder
.push(param::Unknown::new(0x029b.into(), b"hello").into())
.unwrap();
let mut buf = Octets512::new();
svcb_builder.freeze().compose(&mut buf).unwrap();
assert_eq!(rdata.as_ref(), buf.as_ref());
} | rust_cleaned_test_functions.jsonl/132755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49158,
57507,
4090,
368,
341,
286,
1077,
435,
691,
4035,
310,
293,
11934,
87,
15,
15,
3462,
15,
16,
5661,
1060,
1124,
87,
15,
18,
3462,
21,
21,
3462,
21,
69,
3462,
21,
69,
3462,
15,
22,
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... | 2 |
#[test]
fn test_md5() {
let test_cases = vec![
(vec![], "d41d8cd98f00b204e9800998ecf8427e"),
(b"a".to_vec(), "0cc175b9c0f1b6a831c399e269772661"),
(b"ab".to_vec(), "187ef4436122d1cc2f40dc2b92f0eba0"),
(b"abc".to_vec(), "900150983cd24fb0d6963f7d28e17f72"),
(b"123".to_vec(), "202cb962ac59075b964b07152d234b70"),
(
"你好".as_bytes().to_vec(),
"7eca689f0d3389d9dea66ae112e5cfd7",
),
(
"分布式データベース".as_bytes().to_vec(),
"63c0354797bd261e2cbf8581147eeeda",
),
(vec![0xc0, 0x80], "b26555f33aedac7b2684438cc5d4d05e"),
(vec![0xED, 0xA0, 0x80], "546d3dc8de10fbf8b448f678a47901e4"),
];
for (arg, expect_output) in test_cases {
let expect_output = Some(Bytes::from(expect_output));
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate::<Bytes>(ScalarFuncSig::Md5)
.unwrap();
assert_eq!(output, expect_output);
}
test_unary_func_ok_none::<Bytes, Bytes>(ScalarFuncSig::Md5);
} | rust_cleaned_test_functions.jsonl/91310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 768
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32994,
20,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4083,
0,
12995,
330,
67,
19,
16,
67,
23,
4385,
24,
23,
69,
15,
15,
65,
17,
15,
19,
68,
24,
23,
15,
15,
24,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_property_sheet_with_imports() {
let repo_dir = TempDir::new().unwrap();
let properties_dir = repo_dir.path().join("properties");
let dependency_properties_dir = repo_dir
.path()
.join("node_modules")
.join("the-dependency")
.join("properties");
fs::create_dir_all(&properties_dir).unwrap();
fs::create_dir_all(&dependency_properties_dir).unwrap();
let sheet_path1 = properties_dir.join("sheet1.css");
let sheet_path2 = properties_dir.join("sheet2.css");
let dependency_sheet_path1 = dependency_properties_dir.join("dependency-sheet1.css");
let dependency_sheet_path2 = dependency_properties_dir.join("dependency-sheet2.css");
fs::write(
sheet_path2,
r#"
a { x: '1'; }
"#,
)
.unwrap();
fs::write(
dependency_sheet_path1,
r#"
@import "./dependency-sheet2.css";
a { y: '2'; }
"#,
)
.unwrap();
fs::write(
dependency_sheet_path2,
r#"
b { x: '3'; }
"#,
)
.unwrap();
let sheet = generate_property_sheet(
sheet_path1,
r#"
@import "./sheet2.css";
@import "the-dependency/properties/dependency-sheet1.css";
b { y: '4'; }
"#,
)
.unwrap();
let a = query_simple(&sheet, vec!["a"]);
assert_eq!(a["x"], string("1"),);
assert_eq!(a["y"], string("2"),);
let b = query_simple(&sheet, vec!["b"]);
assert_eq!(b["x"], string("3"),);
assert_eq!(b["y"], string("4"),);
} | rust_cleaned_test_functions.jsonl/45089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 939
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16638,
43112,
6615,
18434,
82,
368,
341,
286,
1077,
15867,
4334,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
5888,
4334,
284,
15867,
4334,
3875,
1005,
5987,
445,
13193,
797,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_color_only() {
let config = integration_test_utils::make_config_from_args(&["--color-only"]);
let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config);
ansi_test_utils::assert_line_has_syntax_highlighted_substring(
&output,
12,
1,
" for (i, x_i) in self.x.iter().enumerate() {",
"rs",
State::HunkZero,
&config,
);
} | rust_cleaned_test_functions.jsonl/70110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
18410,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
1183,
313,
3423,
15382,
15049,
286,
1077,
2550,
284,
17590,
4452,
17309,
486,
6108,
26710,
6699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let hdr: MapxOrdRawKeyVs<usize> = MapxOrdRawKeyVs::new();
pnk!(hdr.version_create(VersionName(b"manster0")));
let max = 500;
(0..max)
.map(|i: usize| (i, (max + i)))
.for_each(|(key, value)| {
let key = <usize as ValueEnDe>::encode(&key);
assert!(pnk!(hdr.insert(key, value)).is_none());
});
assert_eq!(500, hdr.len());
for key in 0..max {
let key = <usize as ValueEnDe>::encode(&key);
assert!(pnk!(hdr.remove(&key)).is_some());
}
assert_eq!(0, hdr.len());
} | rust_cleaned_test_functions.jsonl/53984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
368,
341,
262,
1077,
36615,
25,
5027,
87,
24621,
20015,
1592,
51737,
90244,
29,
284,
5027,
87,
24621,
20015,
1592,
51737,
486,
931,
543,
262,
43050,
74,
10297,
28785,
19484,
8657,
7,
5637,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_bytes_wide_maximum() {
assert_eq!(
Scalar([
0xc62c_1805_439b_73b1,
0xc2b9_551e_8ced_218e,
0xda44_ec81_daf9_a422,
0x5605_aa60_1c16_2e79,
]),
Scalar::from_bytes_wide(&[0xff; 64])
);
} | rust_cleaned_test_functions.jsonl/5576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
12524,
1670,
577,
93581,
368,
972,
262,
2060,
10714,
0,
7805,
286,
35176,
79018,
310,
220,
15,
8148,
21,
17,
66,
62,
16,
23,
15,
20,
62,
19,
18,
24,
65,
62,
22,
18,
65,
16,
1871,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unescape() {
let test_input = create_test_input();
let unescaped = unescape(&test_input);
assert_eq!(unescaped, "\na\nabc\naaa\"aaa\nbbb\\bbb\n'\n");
assert_eq!(count_chars(&unescaped), 19);
} | rust_cleaned_test_functions.jsonl/1887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
12998,
368,
341,
286,
1077,
1273,
5898,
284,
1855,
4452,
5898,
543,
286,
1077,
650,
65826,
284,
650,
12998,
2099,
1944,
5898,
626,
286,
2060,
10714,
10297,
359,
65826,
11,
2917,
3376,
1699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_advance_by() {
let v = &[0, 1, 2, 3, 4];
for i in 0..=v.len() {
let mut iter = v.iter();
iter.advance_by(i).unwrap();
assert_eq!(iter.as_slice(), &v[i..]);
}
let mut iter = v.iter();
assert_eq!(iter.advance_by(v.len() + 1), Err(v.len()));
assert_eq!(iter.as_slice(), &[]);
let mut iter = v.iter();
iter.advance_by(3).unwrap();
assert_eq!(iter.as_slice(), &v[3..]);
iter.advance_by(2).unwrap();
assert_eq!(iter.as_slice(), &[]);
iter.advance_by(0).unwrap();
} | rust_cleaned_test_functions.jsonl/9612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
98093,
3710,
368,
341,
262,
1077,
348,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
4821,
262,
369,
600,
304,
220,
15,
496,
28,
85,
19406,
368,
341,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ord() {
let uid0 = Uid::min();
let uid1 = Uid{position: big(0b1_00000000000000101001), site_id: 8, counter: 382};
let uid2 = Uid{position: big(0b1_00000000000101010010), site_id: 1, counter: 5};
let uid3 = Uid{position: big(0b1_00000000000101010010), site_id: 1, counter: 5};
let uid4 = Uid{position: big(0b1_00000000001011110010), site_id: 4, counter: 4};
let uid5 = Uid{position: big(0b1_00000000001011111101), site_id: 4, counter: 4};
let uid6 = Uid::max();
let mut uids: Vec<&Uid> = vec![&uid4, &uid1, &uid5, &uid6, &uid0, &uid2, &uid3];
uids.sort();
assert!(uids[0] == &uid0);
assert!(uids[1] == &uid1);
assert!(uids[2] == &uid2);
assert!(uids[3] == &uid2);
assert!(uids[4] == &uid4);
assert!(uids[5] == &uid5);
assert!(uids[6] == &uid6);
} | rust_cleaned_test_functions.jsonl/58313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67324,
368,
341,
286,
1077,
14617,
15,
284,
547,
307,
486,
1065,
543,
286,
1077,
14617,
16,
284,
547,
307,
90,
3487,
25,
2409,
7,
15,
65,
16,
62,
15,
15,
15,
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_txn_set_complete() {
let mut header = SrvHeader::new(0, 0, false);
assert_eq!(header.is_transaction(), false);
header.set_is_transaction();
assert_eq!(header.is_transaction(), true);
} | rust_cleaned_test_functions.jsonl/100368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
2602,
27675,
368,
341,
286,
1077,
5206,
4247,
284,
328,
10553,
4047,
486,
931,
7,
15,
11,
220,
15,
11,
895,
317,
286,
2060,
10714,
10297,
2708,
2079,
28884,
1507,
895,
317,
286,
4247,
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 |
#[test]
fn test_cycle() {
let mut context = OfflineAudioContext::new(1, RENDER_QUANTUM_SIZE, SampleRate(44_100));
{
let cycle1 = context.create_gain();
cycle1.connect(&context.destination());
let cycle2 = context.create_gain();
cycle2.connect(&cycle1);
// here we go
cycle1.connect(&cycle2);
let source_cycle = context.create_constant_source();
source_cycle.offset().set_value(1.);
source_cycle.connect(&cycle1);
let other = context.create_constant_source();
other.offset().set_value(2.);
other.connect(&context.destination());
source_cycle.start();
other.start();
}
let output = context.start_rendering();
assert_float_eq!(
output.get_channel_data(0),
&[2.; RENDER_QUANTUM_SIZE][..],
abs_all <= 0.
);
} | rust_cleaned_test_functions.jsonl/95488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39079,
368,
341,
262,
1077,
5206,
2266,
284,
66370,
14755,
1972,
486,
931,
7,
16,
11,
91788,
16332,
2821,
2794,
4098,
11,
19143,
11564,
7,
19,
19,
62,
16,
15,
15,
3237,
262,
341,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone_eq() {
let mut m = SortedVecSet::new();
m.insert(1);
m.insert(2);
assert!(m.clone() == m);
} | rust_cleaned_test_functions.jsonl/110148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
10714,
368,
341,
286,
1077,
5206,
296,
284,
52688,
10050,
1649,
486,
931,
1428,
286,
296,
7030,
7,
16,
317,
286,
296,
7030,
7,
17,
626,
286,
2060,
10297,
76,
15997,
368,
621,
296,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_select_list_order_with_aggr() {
setup_test_logger();
const QUEUE_NAME: &str = "q";
let source_input = gen_source_input();
let test_source = ForeignSource::new().unwrap();
let ddls = vec![
"
CREATE SOURCE STREAM source_trade (
ts TIMESTAMP NOT NULL ROWTIME,
ticker TEXT NOT NULL,
amount INTEGER NOT NULL
);
"
.to_string(),
"
CREATE SINK STREAM sink_sampled_trade_amount (
ts TIMESTAMP NOT NULL ROWTIME,
amount FLOAT NOT NULL
);
"
.to_string(),
"
CREATE PUMP pu_passthrough AS
INSERT INTO sink_sampled_trade_amount (amount, ts)
SELECT STREAM
AVG(source_trade.amount) AS avg_amount,
FLOOR_TIME(source_trade.ts, DURATION_SECS(10)) AS sampled_ts
FROM source_trade
GROUP BY sampled_ts
FIXED WINDOW DURATION_SECS(10), DURATION_SECS(0);
"
.to_string(),
format!(
"
CREATE SINK WRITER queue_sink_trade FOR sink_sampled_trade_amount
TYPE IN_MEMORY_QUEUE OPTIONS (
NAME '{queue_name}'
);
",
queue_name = QUEUE_NAME
),
format!(
"
CREATE SOURCE READER tcp_trade FOR source_trade
TYPE NET_CLIENT OPTIONS (
PROTOCOL 'TCP',
REMOTE_HOST '{remote_host}',
REMOTE_PORT '{remote_port}'
);
",
remote_host = test_source.host_ip(),
remote_port = test_source.port()
),
];
let pipeline = apply_ddls(&ddls, SpringConfig::default());
test_source.start(ForeignSourceInput::new_fifo_batch(source_input));
let row = pipeline.pop(QUEUE_NAME).unwrap();
assert_eq!(
row.get_not_null_by_index::<String>(0).unwrap(),
"2020-01-01 00:00:00.000000000"
);
assert_eq!(row.get_not_null_by_index::<i32>(1).unwrap(), 20);
} | rust_cleaned_test_functions.jsonl/24877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1032
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
2019,
7869,
6615,
20587,
901,
368,
341,
262,
6505,
4452,
27413,
1428,
262,
733,
97239,
4708,
25,
609,
495,
284,
330,
80,
3302,
262,
1077,
2530,
5898,
284,
4081,
10347,
5898,
1428,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_can_disable_autoescape_one_off_template() {
let mut context = Context::new();
context.insert("greeting", &"<p>");
let result = Tera::one_off("{{ greeting }} world", &context, false).unwrap();
assert_eq!(result, "<p> world");
} | rust_cleaned_test_functions.jsonl/87547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
33842,
27740,
12998,
11667,
13651,
8693,
368,
341,
286,
1077,
5206,
2266,
284,
9608,
486,
931,
543,
286,
2266,
7030,
445,
70,
43632,
497,
609,
22476,
79,
15084,
286,
1077,
1102,
284,
350,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_liquidity_pools_request_uri() {
let liquidity_pool_id =
"67260c4c1807b262ff851b0a3fe141194936bb0215b2f77447f1df11998eabb9".to_string();
let expected_uri = format!(
"https://horizon.stellar.org/liquidity_pools/{}",
liquidity_pool_id
);
let req = single(liquidity_pool_id.clone());
let uri = req.uri(&host()).unwrap();
assert_eq!(expected_uri, uri.to_string());
} | rust_cleaned_test_functions.jsonl/134526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
62,
39993,
18518,
620,
6178,
7893,
15572,
368,
341,
286,
1077,
52013,
15709,
842,
4035,
310,
330,
21,
22,
17,
21,
15,
66,
19,
66,
16,
23,
15,
22,
65,
17,
21,
17,
542,
23,
20,
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_is_digit() {
assert!('2'.is_numeric());
assert!('7'.is_numeric());
assert!(!'c'.is_numeric());
assert!(!'i'.is_numeric());
assert!(!'z'.is_numeric());
assert!(!'Q'.is_numeric());
} | rust_cleaned_test_functions.jsonl/109585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
48403,
368,
341,
256,
2060,
0,
492,
17,
4427,
285,
29418,
1423,
256,
2060,
0,
492,
22,
4427,
285,
29418,
1423,
256,
2060,
0,
3471,
6,
66,
4427,
285,
29418,
1423,
256,
2060,
0,
3471,
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_from_str_ipv6() {
assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 0)), FromStr::from_str("0:0:0:0:0:0:0:0"));
assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 1)), FromStr::from_str("0:0:0:0:0:0:0:1"));
assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 1)), FromStr::from_str("::1"));
assert_eq!(Some(Ipv6Addr(0, 0, 0, 0, 0, 0, 0, 0)), FromStr::from_str("::"));
assert_eq!(Some(Ipv6Addr(0x2a02, 0x6b8, 0, 0, 0, 0, 0x11, 0x11)),
FromStr::from_str("2a02:6b8::11:11"));
// too long group
let none: Option<IpAddr> = FromStr::from_str("::00000");
assert_eq!(None, none);
// too short
let none: Option<IpAddr> = FromStr::from_str("1:2:3:4:5:6:7");
assert_eq!(None, none);
// too long
let none: Option<IpAddr> = FromStr::from_str("1:2:3:4:5:6:7:8:9");
assert_eq!(None, none);
// triple colon
let none: Option<IpAddr> = FromStr::from_str("1:2:::6:7:8");
assert_eq!(None, none);
// two double colons
let none: Option<IpAddr> = FromStr::from_str("1:2::6::8");
assert_eq!(None, none);
} | rust_cleaned_test_functions.jsonl/816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 665
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
49378,
21,
368,
341,
286,
2060,
10714,
10297,
8373,
8972,
30168,
21,
13986,
7,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
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_primitive_array_gt_scalar_nulls() {
cmp_i64_scalar!(
gt_scalar,
vec![None, Some(1), Some(2), None, Some(1), Some(2), None, Some(1), Some(2)],
1,
vec![None, Some(false), Some(true), None, Some(false), Some(true), None, Some(false), Some(true)]
);
} | rust_cleaned_test_functions.jsonl/36029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
37479,
41652,
15162,
82,
368,
341,
286,
26089,
5318,
21,
19,
41652,
33673,
310,
25161,
41652,
345,
310,
7486,
20703,
4064,
11,
4329,
7,
16,
701,
4329,
7,
17,
701,
2240,
11,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_after_clone_from_tags() {
let config = a_config();
let logger = a_logger();
let resolved = config.resolve_after_clone(&logger, config.projects.get("test1").unwrap());
assert_that(&resolved).is_equal_to(vec!["clone1".to_string(), "clone2".to_string()]);
} | rust_cleaned_test_functions.jsonl/52623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19844,
54742,
5673,
16333,
368,
341,
262,
1077,
2193,
284,
264,
5332,
543,
262,
1077,
5925,
284,
264,
27413,
543,
262,
1077,
19673,
284,
2193,
14691,
19844,
54742,
2099,
9786,
11,
2193,
59356,
670... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_power_of() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(engine.eval::<INT>("2 ~ 3")?, 8);
assert_eq!(engine.eval::<INT>("(-2 ~ 3)")?, -8);
#[cfg(not(feature = "no_float"))]
{
assert!(
(engine.eval::<FLOAT>("2.2 ~ 3.3")? - 13.489_468_760_533_386 as FLOAT).abs() <= EPSILON
);
assert!((engine.eval::<FLOAT>("2.0~-2.0")? - 0.25 as FLOAT).abs() < EPSILON);
assert!((engine.eval::<FLOAT>("(-2.0~-2.0)")? - 0.25 as FLOAT).abs() < EPSILON);
assert!((engine.eval::<FLOAT>("(-2.0~-2)")? - 0.25 as FLOAT).abs() < EPSILON);
assert_eq!(engine.eval::<INT>("4~3")?, 64);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/114103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20421,
3575,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10714,
10297,
8512,
31710,
27638,
3221,
13211,
17,
3968,
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... | 8 |
#[test]
fn test_max_initial_porep_id() {
for rsp in ®ISTERED_SEAL_PROOFS {
let mut porep_id_type_bytes = [0u8; 8];
let porep_id = rsp.porep_id();
porep_id_type_bytes.copy_from_slice(&porep_id[..8]);
let porep_type = u64::from_le_bytes(porep_id_type_bytes);
let is_legacy = porep_type <= MAX_LEGACY_REGISTERED_SEAL_PROOF_ID;
match rsp {
RegisteredSealProof::StackedDrg2KiBV1
| RegisteredSealProof::StackedDrg8MiBV1
| RegisteredSealProof::StackedDrg512MiBV1
| RegisteredSealProof::StackedDrg32GiBV1
| RegisteredSealProof::StackedDrg64GiBV1 => assert!(is_legacy),
RegisteredSealProof::StackedDrg2KiBV1_1
| RegisteredSealProof::StackedDrg8MiBV1_1
| RegisteredSealProof::StackedDrg512MiBV1_1
| RegisteredSealProof::StackedDrg32GiBV1_1
| RegisteredSealProof::StackedDrg64GiBV1_1 => assert!(!is_legacy),
}
}
} | rust_cleaned_test_functions.jsonl/88713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 608
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
15809,
620,
460,
79,
842,
368,
341,
286,
369,
42160,
304,
609,
46302,
1479,
3620,
969,
5756,
46,
8485,
341,
310,
1077,
5206,
96451,
79,
842,
1819,
12524,
284,
508,
15,
84,
23,
26,
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... | 3 |
#[test]
fn test_invalid_argument_returns_status_1() {
new_ucmd!()
.args(&["--header=hello"])
.pipe_in("53478")
.ignore_stdin_write_error()
.fails()
.code_is(1);
} | rust_cleaned_test_functions.jsonl/93656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
9025,
58900,
4773,
62,
16,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
2708,
28,
14990,
14108,
286,
659,
13768,
1243,
445,
20,
18,
19,
22,
23,
1138,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_replace() {
let a = "a";
assert_eq!("".replace(a, "b"), "");
assert_eq!("a".replace(a, "b"), "b");
assert_eq!("ab".replace(a, "b"), "bb");
let test = "test";
assert_eq!(" test test ".replace(test, "toast"), " toast toast ");
assert_eq!(" test test ".replace(test, ""), " ");
} | rust_cleaned_test_functions.jsonl/17597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
368,
341,
262,
1077,
264,
284,
330,
64,
876,
262,
2060,
10714,
17223,
3263,
8156,
2877,
11,
330,
65,
3975,
14498,
262,
2060,
10714,
17223,
64,
3263,
8156,
2877,
11,
330,
65,
3975,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_width_calculations() {
let line_nums = [(Some(1.into()), Some(10.into()))];
let widths = Widths::new(
80,
&line_nums,
&split_on_newlines("foo\nbar\n"),
&split_on_newlines("x\nx\nx\nx\nx\nx\nx\nx\nx\nx\nx\n"),
);
assert_eq!(widths.lhs_line_nums, 2);
assert_eq!(widths.rhs_line_nums, 3);
} | rust_cleaned_test_functions.jsonl/79739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7927,
24005,
3314,
804,
368,
341,
286,
1077,
1555,
51875,
284,
17826,
8373,
7,
16,
39860,
11858,
4329,
7,
16,
15,
39860,
10131,
935,
286,
1077,
64411,
284,
24627,
82,
486,
931,
1006,
310,
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_adjust_thread_pool_size() {
let (_tmp, endpoint) = new_endpoint();
endpoint
.region_info
.set_regions(vec![(b"".to_vec(), b"".to_vec(), 1)]);
let mut req = BackupRequest::default();
req.set_start_key(vec![]);
req.set_end_key(vec![]);
req.set_start_version(1);
req.set_end_version(1);
req.set_storage_backend(make_noop_backend());
let (tx, rx) = unbounded();
// expand thread pool is needed
endpoint.get_config_manager().set_num_threads(15);
let (task, _) = Task::new(req.clone(), tx.clone()).unwrap();
endpoint.handle_backup_task(task);
assert!(endpoint.pool.borrow().size == 15);
// shrink thread pool only if there are too many idle threads
endpoint.get_config_manager().set_num_threads(10);
let (task, _) = Task::new(req.clone(), tx.clone()).unwrap();
endpoint.handle_backup_task(task);
assert!(endpoint.pool.borrow().size == 15);
endpoint.get_config_manager().set_num_threads(3);
let (task, _) = Task::new(req, tx).unwrap();
endpoint.handle_backup_task(task);
assert!(endpoint.pool.borrow().size == 3);
// make sure all tasks can finish properly.
let responses = block_on(rx.collect::<Vec<_>>());
assert_eq!(responses.len(), 3);
// for testing whether dropping the pool before all tasks finished causes panic.
let mut pool = ControlThreadPool::new();
pool.adjust_with(1);
pool.spawn(async { tokio::time::sleep(Duration::from_millis(100)).await });
pool.adjust_with(2);
drop(pool);
std::thread::sleep(Duration::from_millis(150));
} | rust_cleaned_test_functions.jsonl/14850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44153,
10814,
15709,
2368,
368,
341,
286,
1077,
5453,
5173,
11,
14887,
8,
284,
501,
36699,
543,
286,
14887,
198,
310,
659,
3943,
3109,
198,
310,
659,
746,
58035,
25592,
0,
9697,
65,
69355,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index() {
let client = Client::new(super::rocket()).unwrap();
let mut res = client.get("/").dispatch();
assert_eq!(res.body_string(), Some(super::index().to_string()));
} | rust_cleaned_test_functions.jsonl/30681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
368,
341,
262,
1077,
2943,
284,
8423,
486,
931,
56040,
486,
46790,
6011,
15454,
543,
262,
1077,
5206,
592,
284,
2943,
670,
4283,
1827,
18274,
543,
262,
2060,
10714,
10297,
416,
5079,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_next_sequence_recv_fail() {
let port_channel = (PortId::default(), ChannelId::new(0));
let context: Context<Test> = Context::new();
new_test_ext().execute_with(|| {
let result = context.get_next_sequence_recv(&port_channel.clone()).unwrap_err().to_string();
assert_eq!(result, ICS04Error::missing_next_recv_seq(port_channel).to_string());
})
} | rust_cleaned_test_functions.jsonl/60077 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
23735,
36118,
22121,
368,
341,
10217,
2635,
14571,
284,
320,
7084,
764,
486,
2258,
1507,
13434,
764,
486,
931,
7,
15,
1106,
10217,
2266,
25,
9608,
71273,
29,
284,
9608,
486,
931,
1428,
86... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dictionaries() {
for dict in DICTIONARIES.iter() {
assert!(dict.data.lines().count() > 1, "{} is too short", dict.name);
assert!(
dict.data.lines().all(|s| &s[..] == s.trim()),
"leading/trailing whitespace in {}",
dict.name
);
assert!(
!dict.data.lines().any(str::is_empty),
"blank line in {}",
dict.name
);
assert_eq!(
dict.data.lines().count(),
dict.data.lines().collect::<HashSet<_>>().len(),
"duplicate entry in {}",
dict.name
);
}
} | rust_cleaned_test_functions.jsonl/100537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
44192,
368,
341,
262,
369,
6451,
304,
16536,
3580,
934,
5369,
19471,
368,
341,
286,
2060,
10297,
8477,
2196,
44061,
1005,
1830,
368,
861,
220,
16,
11,
35503,
374,
2238,
2805,
497,
6451,
264... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fee_rate_governor_derived_default() {
solana_logger::setup();
let f0 = FeeRateGovernor::default();
assert_eq!(
f0.target_signatures_per_slot,
DEFAULT_TARGET_SIGNATURES_PER_SLOT
);
assert_eq!(
f0.target_lamports_per_signature,
DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE
);
assert_eq!(f0.lamports_per_signature, 0);
let f1 = FeeRateGovernor::new_derived(&f0, DEFAULT_TARGET_SIGNATURES_PER_SLOT);
assert_eq!(
f1.target_signatures_per_slot,
DEFAULT_TARGET_SIGNATURES_PER_SLOT
);
assert_eq!(
f1.target_lamports_per_signature,
DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE
);
assert_eq!(
f1.lamports_per_signature,
DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE / 2
); // min
} | rust_cleaned_test_functions.jsonl/3394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34305,
9246,
1889,
6706,
269,
35345,
2221,
9993,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
282,
15,
284,
40458,
11564,
77606,
269,
486,
2258,
543,
286,
2060,
10714,
33673,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inline_into_nested_non_hoisted_named_functions() {
test(
"f(); var x = false; if (false) function f() { alert(x); };",
"f(); if (false) function f() { alert(false); };",
);
} | rust_cleaned_test_functions.jsonl/27646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
45514,
66279,
21637,
1523,
78,
13236,
71834,
31708,
368,
341,
262,
1273,
1006,
286,
330,
69,
2129,
762,
856,
284,
895,
26,
421,
320,
3849,
8,
729,
282,
368,
314,
5115,
2075,
1215,
20066,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_func_duplicate_params() {
Function::new(
"function",
&vec!["a".to_string(), "a".to_string()],
&YolkExpr::Ident("a".to_string()),
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/131954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9596,
70434,
6745,
368,
341,
262,
5712,
486,
931,
1006,
286,
330,
1688,
756,
286,
609,
4083,
0,
1183,
64,
3263,
983,
3904,
1507,
330,
64,
3263,
983,
3904,
73845,
286,
609,
56,
22604,
16041,
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 |
#[test]
fn test_parse_expiry_time() {
use ::ExpiryTime;
use bech32::FromBase32;
let input = from_bech32("pu".as_bytes());
let expected = Ok(ExpiryTime::from_seconds(60));
assert_eq!(ExpiryTime::from_base32(&input), expected);
let input_too_large = from_bech32("sqqqqqqqqqqqq".as_bytes());
assert_eq!(ExpiryTime::from_base32(&input_too_large), Err(ParseError::IntegerOverflowError));
} | rust_cleaned_test_functions.jsonl/123247 | {
"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,
21039,
96509,
3009,
368,
341,
197,
41819,
3504,
840,
48209,
1462,
280,
197,
41819,
387,
331,
18,
17,
486,
3830,
3978,
18,
17,
401,
197,
10217,
1946,
284,
504,
880,
4737,
18,
17,
445,
5584,
326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nproc_all_omp() {
let result = new_ucmd!().arg("--all").succeeds();
let nproc: u8 = result.stdout_str().trim().parse().unwrap();
assert!(nproc > 0);
let result = TestScenario::new(util_name!())
.ucmd_keepenv()
.env("OMP_NUM_THREADS", "60")
.succeeds();
let nproc_omp: u8 = result.stdout_str().trim().parse().unwrap();
assert_eq!(nproc_omp, 60);
let result = TestScenario::new(util_name!())
.ucmd_keepenv()
.env("OMP_NUM_THREADS", "1") // Has no effect
.arg("--all")
.succeeds();
let nproc_omp: u8 = result.stdout_str().trim().parse().unwrap();
assert_eq!(nproc, nproc_omp);
let result = TestScenario::new(util_name!())
.ucmd_keepenv()
.env("OMP_NUM_THREADS", "incorrectnumber") // returns the number CPU
.succeeds();
let nproc_omp: u8 = result.stdout_str().trim().parse().unwrap();
assert_eq!(nproc, nproc_omp);
} | rust_cleaned_test_functions.jsonl/43690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
15782,
5705,
62,
14435,
368,
341,
262,
1077,
1102,
284,
501,
68887,
2277,
0,
1005,
858,
21549,
541,
1827,
82,
29264,
82,
1428,
262,
1077,
308,
15782,
25,
575,
23,
284,
1102,
24839,
2895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_does_not_contain() {
let mut buf = Buffer::new();
buf.insert(0, &['a', 'b', 'c', 'd', 'e', 'f', 'g']);
let mut buf2 = Buffer::new();
buf2.insert(0, &['x', 'b', 'c']);
assert_eq!(buf.contains(&buf2), false);
let mut buf2 = Buffer::new();
buf2.insert(0, &['a', 'b', 'd']);
assert_eq!(buf.contains(&buf2), false);
} | rust_cleaned_test_functions.jsonl/61899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96374,
7913,
10260,
466,
368,
341,
286,
1077,
5206,
6607,
284,
10312,
486,
931,
543,
286,
6607,
7030,
7,
15,
11,
609,
677,
64,
516,
364,
65,
516,
364,
66,
516,
364,
67,
516,
364,
68,
516,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamp_to_datetime() {
assert_eq!(
timestamp_to_datetime(1591894320000000000).to_rfc3339(),
"2020-06-11T16:52:00+00:00"
);
assert_eq!(
timestamp_to_datetime(159189432).to_rfc3339(),
"1970-01-01T00:00:00.159189432+00:00"
);
} | rust_cleaned_test_functions.jsonl/10528 | {
"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,
23073,
2346,
28943,
368,
341,
286,
2060,
10714,
33673,
310,
11441,
2346,
28943,
7,
16,
20,
24,
16,
23,
24,
19,
18,
17,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
568,
983,
1710,
8316,
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... | 1 |
#[test]
fn test_simple_sexpr() {
let tree = Neighborhood::with_paths(
vec![
path![Step::IfExpr, Step::Trace(0), Step::LtExpr, Step::Trace(0), Step::Value(Value::Int(420))],
path![Step::IfExpr, Step::Trace(0), Step::LtExpr, Step::Trace(1), Step::Value(Value::Int(130))],
path![Step::IfExpr, Step::Trace(1), Step::Value(Value::Str("a"))],
path![Step::IfExpr, Step::Trace(2), Step::Value(Value::Str("b"))],
]
);
tree.validate();
} | rust_cleaned_test_functions.jsonl/50644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
82113,
649,
368,
341,
262,
1077,
4916,
284,
61512,
486,
4197,
24152,
1006,
286,
7486,
90515,
310,
1815,
20703,
8304,
486,
2679,
16041,
11,
14822,
486,
6550,
7,
15,
701,
14822,
486,
87660,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_search_ipv6_name_parse_fails() {
let mut io_loop = Runtime::new().unwrap();
let mut config = ResolverConfig::default();
config.add_search(Name::from_str("example.com").unwrap());
let (resolver, bg) = AsyncResolver::new(
config,
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4Only,
ndots: 5,
..ResolverOpts::default()
},
);
io_loop.spawn(bg);
let response = io_loop
.block_on(resolver.lookup_ip("2001:db8::198.51.100.35"))
.expect("failed to run lookup");
let mut iter = response.iter();
assert_eq!(
iter.next().expect("no rdatas"),
IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0xc633, 0x6423))
);
} | rust_cleaned_test_functions.jsonl/36499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 463
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
49378,
21,
1269,
21039,
761,
6209,
368,
341,
286,
1077,
5206,
6399,
17198,
284,
10954,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
2193,
284,
81854,
2648,
486,
2258,
543,
286,
2193,
1364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expire_for_normal() -> anyhow::Result<()> {
let rt = tokio::runtime::Runtime::new()?;
rt.block_on(async {
let pool: Pool<FakeTag> = PoolOptions::default()
.expire_after(Duration::from_millis(100))
.create();
let res = pool.entry("one_tag").await;
assert!(res.is_ok());
assert_eq!(pool.len(), 1);
drop(res);
time::sleep(Duration::from_millis(150)).await;
assert_eq!(pool.len(), 0);
});
Ok(())
} | rust_cleaned_test_functions.jsonl/75282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83409,
5478,
13973,
368,
1464,
88964,
486,
2077,
71698,
972,
286,
1077,
16677,
284,
9628,
815,
486,
22255,
486,
15123,
486,
931,
93333,
463,
286,
16677,
15697,
4470,
18285,
972,
310,
1077,
7314,
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_create_entity_double_fails() {
ExternalityBuilder::build().execute_with(|| {
create_entity();
let name = "foobar".as_bytes().to_vec();
let country = "Belgium".as_bytes().to_vec();
let city = "Ghent".as_bytes().to_vec();
let signature = sign_create_entity(name.clone(), country.clone(), city.clone());
assert_noop!(
TfgridModule::create_entity(
Origin::signed(alice()),
test_ed25519(),
name,
country,
city,
signature
),
Error::<TestRuntime>::EntityWithNameExists
);
});
} | rust_cleaned_test_functions.jsonl/35343 | {
"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,
8657,
19169,
24598,
761,
6209,
368,
341,
262,
1374,
4160,
2719,
3297,
486,
5834,
1005,
10257,
6615,
79453,
341,
286,
1855,
19169,
1428,
286,
1077,
829,
284,
330,
50267,
3263,
300,
12524,
1005,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_http_frame_from_raw() {
fn to_raw<'a, F: FrameIR>(frame: F) -> RawFrame<'static> {
let mut buf = io::Cursor::new(Vec::new());
frame.serialize_into(&mut buf).unwrap();
RawFrame::from(buf.into_inner())
}
assert!(match HttpFrame::from_raw(&to_raw(DataFrame::new(1))) {
Ok(HttpFrame::DataFrame(_)) => true,
_ => false,
});
assert!(match HttpFrame::from_raw(&to_raw(HeadersFrame::new(vec![], 1))) {
Ok(HttpFrame::HeadersFrame(_)) => true,
_ => false,
});
assert!(match HttpFrame::from_raw(&to_raw(SettingsFrame::new())) {
Ok(HttpFrame::SettingsFrame(_)) => true,
_ => false,
});
let unknown_frame = RawFrame::from({
let mut buf: Vec<u8> = Vec::new();
// Frame type 10 with a payload of length 1 on stream 1
let header = (1u32, 10u8, 0u8, 1u32);
buf.extend(pack_header(&header).to_vec().into_iter());
buf.push(1);
buf
});
assert!(match HttpFrame::from_raw(&unknown_frame) {
Ok(HttpFrame::UnknownFrame(_)) => true,
_ => false,
});
// Invalid since it's headers on stream 0
let invalid_frame = HeadersFrame::new(vec![], 0);
assert!(HttpFrame::from_raw(&to_raw(invalid_frame)).is_err());
} | rust_cleaned_test_functions.jsonl/131331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25888,
8929,
5673,
16067,
368,
341,
286,
5168,
311,
16067,
18291,
64,
11,
434,
25,
16321,
2801,
2235,
6763,
25,
434,
8,
1464,
23022,
4369,
18291,
1978,
29,
341,
310,
1077,
5206,
6607,
284,
6399,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let slice: &[_] = &[None, Real::new(1.0).ok()];
let vec = slice.to_vec();
let column = VectorValue::from(vec);
assert_eq!(column.len(), 2);
assert_eq!(column.as_real_slice(), slice);
} | rust_cleaned_test_functions.jsonl/88510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
368,
341,
286,
1077,
15983,
25,
609,
13496,
60,
284,
44590,
4064,
11,
8800,
486,
931,
7,
16,
13,
15,
568,
562,
33800,
286,
1077,
7486,
284,
15983,
2389,
13251,
543,
286,
1077,
3250,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_idempotent() {
assert!(Method::OPTIONS.is_idempotent());
assert!(Method::GET.is_idempotent());
assert!(Method::PUT.is_idempotent());
assert!(Method::DELETE.is_idempotent());
assert!(Method::HEAD.is_idempotent());
assert!(Method::TRACE.is_idempotent());
assert!(!Method::POST.is_idempotent());
assert!(!Method::CONNECT.is_idempotent());
assert!(!Method::PATCH.is_idempotent());
} | rust_cleaned_test_functions.jsonl/67361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
842,
3262,
63532,
368,
341,
262,
2060,
10297,
3523,
486,
56929,
2079,
842,
3262,
63532,
1423,
262,
2060,
10297,
3523,
486,
3806,
2079,
842,
3262,
63532,
1423,
262,
2060,
10297,
3523,
486,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.