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_and_with_one_neq_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let json = format!(r#"{{"$and":[{{"~{}":{{"$neq":"{}"}}}}]}}"#, name1, value1);
let query = parse_from_json(&json).unwrap();
let expected = Operator::And(
vec![
Operator::Neq(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
)
]
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
6615,
11667,
13925,
80,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
2951,
284,
356... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_existing_file_too_large() {
let f = TestFixture::new();
// Create files explicitly in the past.
set_mtime_back(f.create_file("file1", 10), 10);
set_mtime_back(f.create_file("file2", 10), 5);
let c = LruDiskCache::new(f.tmp(), 15).unwrap();
assert_eq!(c.size(), 10);
assert_eq!(c.len(), 1);
assert!(!c.contains_key("file1"));
assert!(c.contains_key("file2"));
} | rust_cleaned_test_functions.jsonl/6717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62630,
2458,
2346,
78,
45228,
368,
341,
286,
1077,
282,
284,
3393,
18930,
486,
931,
543,
286,
442,
4230,
3542,
20975,
304,
279,
3267,
624,
286,
738,
93674,
3895,
955,
2520,
2458,
445,
1192,
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_from() {
let pose1 = na::Isometry3::identity();
let msg = my_msg::geometry_msgs::Pose::from(pose1);
assert_eq!(msg.position.y, 0.0);
} | rust_cleaned_test_functions.jsonl/74015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
368,
341,
286,
1077,
17040,
16,
284,
4317,
486,
3872,
6988,
18,
486,
16912,
543,
286,
1077,
3750,
284,
847,
6483,
486,
15281,
20777,
486,
46315,
486,
1499,
1295,
960,
16,
317,
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 |
#[test]
fn test_blake2s_constant_constraints() {
let mut cs = TestConstraintSystem::<Fr>::new();
let rng = &mut test_rng();
let input_bits: Vec<_> = (0..512)
.map(|_| Boolean::constant(rng.next_u32() % 2 != 0))
.collect();
blake2s(&mut cs, &input_bits, b"12345678").unwrap();
assert_eq!(cs.num_constraints(), 0);
} | rust_cleaned_test_functions.jsonl/102743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
726,
17,
82,
34967,
60267,
368,
341,
286,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
22560,
6831,
931,
543,
286,
1077,
28422,
284,
609,
6984,
1273,
66849,
543,
286,
1077,
1946,
20034... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_integer() {
let ii8 = -1i8;
let ii16 = -1i16;
let ii32 = -1i32;
let ii64 = -1i64;
let iisize = -1isize;
let uu8 = 1u8;
let uu16 = 1u16;
let uu32 = 1u32;
let uu64 = 1u64;
let uusize = 1usize;
let tokens = quote! {
#ii8 #ii16 #ii32 #ii64 #iisize
#uu8 #uu16 #uu32 #uu64 #uusize
};
let expected = "- 1i8 - 1i16 - 1i32 - 1i64 - 1isize 1u8 1u16 1u32 1u64 1usize";
assert_eq!(expected, tokens.to_string());
} | rust_cleaned_test_functions.jsonl/3595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31725,
368,
341,
262,
1077,
14460,
23,
284,
481,
16,
72,
23,
280,
262,
1077,
14460,
16,
21,
284,
481,
16,
72,
16,
21,
280,
262,
1077,
14460,
18,
17,
284,
481,
16,
72,
18,
17,
280,
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... | 1 |
#[test]
fn test_or_as_filename() {
let status = Command::new(EXE).arg("x").arg("-a").arg("-z").arg("-o").status();
assert!(status.unwrap().matches_exit_status(1));
} | rust_cleaned_test_functions.jsonl/130941 | {
"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,
8734,
11898,
13323,
368,
341,
262,
1077,
2639,
284,
7348,
486,
931,
25409,
36,
568,
858,
445,
87,
1827,
858,
13645,
64,
1827,
858,
13645,
89,
1827,
858,
13645,
78,
1827,
2829,
543,
262,
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 |
#[test]
fn test_test_failure_missing_path() {
let test = Patch::Test {
value: json!(123),
path: Path::new("/missing"),
};
let root = json!({
"a": {
"b": 123,
"c": 234,
},
"b": [1],
});
assert!(matches!(apply_single(root, test), Err(Error::PathDoesntExist)));
} | rust_cleaned_test_functions.jsonl/52521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4452,
43618,
40447,
2638,
368,
341,
286,
1077,
1273,
284,
30412,
486,
2271,
341,
310,
897,
25,
2951,
10297,
16,
17,
18,
1326,
310,
1815,
25,
7933,
486,
931,
4283,
30616,
4461,
286,
3634,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_outi() {
let (mut cpu, mut bus) = new_cpu(vec![0xed, 0xa3]);
cpu.registers.b = 0x10;
cpu.registers.c = 0x07;
cpu.registers.d = 0x5a;
cpu.registers.h = 0x10;
cpu.registers.l = 0x00;
bus.memory_write(0x1000, 0x59);
cpu.step(&mut bus, 0);
assert_eq!(0x0f, cpu.registers.b);
assert_eq!(0x10, cpu.registers.h);
assert_eq!(0x01, cpu.registers.l);
assert_eq!(0x59, bus.port_data[0x07]);
assert_eq!(4, bus.m_cycles);
assert_eq!(16, bus.t_states);
} | rust_cleaned_test_functions.jsonl/112667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6068,
72,
368,
341,
286,
1077,
320,
6984,
17319,
11,
5206,
5828,
8,
284,
501,
21795,
25592,
20703,
15,
51319,
11,
220,
15,
9591,
18,
10149,
286,
17319,
7031,
9303,
948,
284,
220,
15,
87,
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_entry_or_insert() {
let mut map = TypeMap::new();
map.entry::<KeyType>().or_insert(Value(20)).0 += 1;
assert_eq!(map.get::<KeyType>().unwrap(), &Value(21));
// on existing value
map.entry::<KeyType>().or_insert(Value(100)).0 += 1;
assert_eq!(map.get::<KeyType>().unwrap(), &Value(22));
} | rust_cleaned_test_functions.jsonl/33445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9078,
8734,
17678,
368,
341,
286,
1077,
5206,
2415,
284,
3990,
2227,
486,
931,
543,
286,
2415,
24116,
27638,
97964,
10483,
269,
17678,
25346,
7,
17,
15,
4579,
15,
1421,
220,
16,
280,
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_is_ascending_buffer(){
unsafe {
let v = vec!(1i32, 2, 3, 4);
assert!(is_ascending_buffer(v.as_ptr(), v.len()));
let v = vec!(1i32);
assert!(is_ascending_buffer(v.as_ptr(), v.len()));
let v : Vec<i32> = vec!();
assert!(is_ascending_buffer(v.as_ptr(), v.len()));
let v = vec!(2i32, 1);
assert!(!is_ascending_buffer(v.as_ptr(), v.len()));
let v = vec!(3i32, 2, 1);
assert!(!is_ascending_buffer(v.as_ptr(), v.len()));
let v = vec!(1i32, 3, 2);
assert!(!is_ascending_buffer(v.as_ptr(), v.len()));
let v = vec!(2i32, 1, 3);
assert!(!is_ascending_buffer(v.as_ptr(), v.len()));
}
} | rust_cleaned_test_functions.jsonl/133543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
62,
71900,
7776,
3032,
286,
19860,
341,
310,
1077,
348,
284,
7486,
10297,
16,
72,
18,
17,
11,
220,
17,
11,
220,
18,
11,
220,
19,
317,
310,
2060,
10297,
285,
62,
71900,
7776,
3747,
5357... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop() {
let mut m = VecDequeMap::new();
m.push_back(3);
assert_eq!(m[0], 3);
assert_eq!(m.start_index(), 0);
assert_eq!(m.push_index(), 1);
m.push_back(7);
assert_eq!(m[0], 3);
assert_eq!(m[1], 7);
assert_eq!(m.start_index(), 0);
assert_eq!(m.push_index(), 2);
m.push_back(9);
assert_eq!(m[0], 3);
assert_eq!(m[1], 7);
assert_eq!(m[2], 9);
assert_eq!(m.start_index(), 0);
assert_eq!(m.push_index(), 3);
assert_eq!(m.pop_front(), Some(3));
assert_eq!(m.get(0), None);
assert_eq!(m[1], 7);
assert_eq!(m[2], 9);
assert_eq!(m.start_index(), 1);
assert_eq!(m.push_index(), 3);
m.push_back(11);
assert_eq!(m.get(0), None);
assert_eq!(m[1], 7);
assert_eq!(m[2], 9);
assert_eq!(m[3], 11);
assert_eq!(m.start_index(), 1);
assert_eq!(m.push_index(), 4);
assert_eq!(m.pop_front(), Some(7));
assert_eq!(m.pop_front(), Some(9));
assert_eq!(m.pop_front(), Some(11));
assert_eq!(m.get(0), None);
assert_eq!(m.get(1), None);
assert_eq!(m.get(2), None);
assert_eq!(m.get(3), None);
assert_eq!(m.start_index(), 4);
assert_eq!(m.push_index(), 4);
assert!(m.is_empty());
} | rust_cleaned_test_functions.jsonl/51622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 801
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
368,
341,
286,
1077,
5206,
296,
284,
11312,
73891,
2227,
486,
931,
543,
286,
296,
2552,
3895,
7,
18,
317,
286,
2060,
10714,
10297,
76,
58,
15,
1125,
220,
18,
317,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_open_multiple_channels_establishes_channels_after_acknowledgement() {
let mut exec = fasync::Executor::new().unwrap();
// Crete and start a SessionInner that relays any opened RFCOMM channels.
let (mut session, mut outgoing_frames, _channel_receiver) = setup_session();
// The session multiplexer has started.
assert!(session.multiplexer().start(Role::Responder).is_ok());
// Initiate an open RFCOMM channel request with a random valid ServerChannel.
let server_channel = ServerChannel(5);
let expected_dlci = server_channel.to_dlci(Role::Initiator).unwrap();
{
let mut open_fut = Box::pin(session.open_remote_channel(server_channel));
assert!(exec.run_until_stalled(&mut open_fut).is_pending());
// for the DLCI.
expect_mux_command(
&mut exec,
&mut outgoing_frames,
MuxCommandMarker::ParameterNegotiation,
);
assert_matches!(exec.run_until_stalled(&mut open_fut), Poll::Ready(Ok(_)));
}
let server_channel2 = ServerChannel(9);
let expected_dlci2 = server_channel2.to_dlci(Role::Initiator).unwrap();
{
let mut open_fut = Box::pin(session.open_remote_channel(server_channel2));
assert_matches!(exec.run_until_stalled(&mut open_fut), Poll::Ready(Ok(_)));
}
{
// Simulate the peer's positive response to the DLC PN request.
let mut handle_fut = Box::pin(session.handle_frame(make_dlc_pn_frame(
CommandResponse::Response,
expected_dlci,
true, // Supports credit-based flow control.
100, // Supports max frame size of 100.
)));
assert!(exec.run_until_stalled(&mut handle_fut).is_pending());
// We expect an outgoing SABM for `server_channel`.
expect_frame(
&mut exec,
&mut outgoing_frames,
FrameData::SetAsynchronousBalancedMode,
expected_dlci,
);
assert!(exec.run_until_stalled(&mut handle_fut).is_pending());
// We also expect another outgoing SABM for `server_channel2`.
expect_frame(
&mut exec,
&mut outgoing_frames,
FrameData::SetAsynchronousBalancedMode,
expected_dlci2,
);
assert_matches!(exec.run_until_stalled(&mut handle_fut), Poll::Ready(Ok(_)));
}
} | rust_cleaned_test_functions.jsonl/14939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
45233,
19291,
18583,
5102,
288,
19291,
19844,
48447,
50022,
29564,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
15454,
1428,
286,
442,
7792,
665,
323,
1191,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hex_valid_into_message() {
let keypair = gen_keypair();
let msg = TxSimple::new(&keypair.0, "I am a simple!", &keypair.1);
let hex = msg.to_hex();
let msg2 = TxSimple::from_hex(hex).expect("Unable to decode hex into `TxFirst`");
assert_eq!(msg2, msg);
} | rust_cleaned_test_functions.jsonl/90748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
8337,
45514,
6462,
368,
341,
262,
1077,
1376,
12670,
284,
4081,
3097,
12670,
543,
262,
1077,
3750,
284,
39850,
16374,
486,
931,
2099,
792,
12670,
13,
15,
11,
330,
40,
1079,
264,
4285,
187... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_union() {
let mut model = Model::default();
let g_ids = (0..=2)
.map(|id| {
let g_id = model.make_box(qgm::get(id).into());
let mut b = model.get_mut_box(g_id);
b.add_column(exp::base(0, typ::int32(false)));
b.add_column(exp::base(1, typ::int32(id == 1)));
b.add_column(exp::base(2, typ::int32(id == 2)));
b.add_column(exp::base(3, typ::int32(id == 1)));
b.add_column(exp::base(4, typ::int32(id == 2)));
g_id
})
.collect::<Vec<_>>();
let u_id = model.make_box(BoxType::Union);
let q_ids = g_ids
.iter()
.map(|g_id| model.make_quantifier(QuantifierType::Foreach, *g_id, u_id))
.collect::<Vec<_>>();
{
let mut b = model.get_mut_box(u_id);
// C0: Q0.0
b.add_column(exp::cref(q_ids[0], 0));
// C1: Q0.1
b.add_column(exp::cref(q_ids[0], 1));
// C2: Q0.2
b.add_column(exp::cref(q_ids[0], 2));
// C3: Q0.3
b.add_column(exp::cref(q_ids[0], 3));
// C4: Q0.4
b.add_column(exp::cref(q_ids[0], 4));
}
for g_id in g_ids {
RejectedNulls.derive(&mut model, g_id);
RelationType.derive(&mut model, g_id);
}
RejectedNulls.derive(&mut model, u_id);
RelationType.derive(&mut model, u_id);
{
let b = model.get_box(u_id);
let act_value = b.attributes.get::<RelationType>();
let exp_value = &vec![
typ::int32(false),
typ::int32(true),
typ::int32(true),
typ::int32(true),
typ::int32(true),
];
assert_eq!(act_value, exp_value);
}
} | rust_cleaned_test_functions.jsonl/6657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51621,
368,
341,
286,
1077,
5206,
1614,
284,
4903,
486,
2258,
1428,
286,
1077,
342,
8077,
284,
320,
15,
496,
28,
17,
340,
310,
659,
2186,
22428,
307,
91,
341,
394,
1077,
342,
842,
284,
1614,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bytes_mut() {
let b = BytesMut::from("test");
assert_eq!(Binary::from(b.clone()).len(), 4);
assert_eq!(Binary::from(b).as_ref(), b"test");
} | rust_cleaned_test_functions.jsonl/89003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
29523,
368,
341,
286,
1077,
293,
284,
30024,
51440,
486,
1499,
445,
1944,
797,
286,
2060,
10714,
10297,
21338,
486,
1499,
1883,
15997,
6011,
2892,
1507,
220,
19,
317,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ptr_eq() {
let five = Arc::new(5);
let same_five = five.clone();
let other_five = Arc::new(5);
assert!(Arc::ptr_eq(&five, &same_five));
assert!(!Arc::ptr_eq(&five, &other_five));
} | rust_cleaned_test_functions.jsonl/35123 | {
"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,
4348,
10714,
368,
341,
286,
1077,
4236,
284,
19689,
486,
931,
7,
20,
317,
286,
1077,
1852,
95258,
284,
4236,
15997,
543,
286,
1077,
1008,
95258,
284,
19689,
486,
931,
7,
20,
626,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_crds_filter_mask() {
let filter = CrdsFilter::new_rand(1, 128);
assert_eq!(filter.mask, !0x0);
assert_eq!(CrdsFilter::max_items(80f64, 0.01, 8f64), 9f64);
assert_eq!(CrdsFilter::mask_bits(1000f64, 9f64), 7u32);
let filter = CrdsFilter::new_rand(1000, 10);
assert_eq!(filter.mask & 0x00_ffff_ffff, 0x00_ffff_ffff);
} | rust_cleaned_test_functions.jsonl/45203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32331,
5356,
8727,
9999,
368,
341,
286,
1077,
4051,
284,
4553,
5356,
5632,
486,
931,
33864,
7,
16,
11,
220,
16,
17,
23,
317,
286,
2060,
10714,
10297,
5315,
35179,
11,
753,
15,
87,
15,
317,
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_ask_era_num() {
new_test_ext().execute_with(|| {
advance_session();
assert_eq!(<frame_system::Pallet<Test>>::block_number(), 5 );
assert_eq!(Session::current_index(), 1 );
assert_eq!(OracleFinance::current_era(), Some(0));
assert_eq!(OracleFinance::eras_start_session_index(0), Some(2));
advance_session();
assert_eq!(<frame_system::Pallet<Test>>::block_number(), 10 );
assert_eq!(Session::current_index(), 2 );
assert_eq!(OracleFinance::current_era(), Some(0));
assert_eq!(OracleFinance::eras_start_session_index(0), Some(2));
advance_session();
assert_eq!(<frame_system::Pallet<Test>>::block_number(), 15 );
assert_eq!(Session::current_index(), 3 );
assert_eq!(OracleFinance::current_era(), Some(1));
assert_eq!(OracleFinance::eras_start_session_index(1), Some(4));
advance_session();
assert_eq!(<frame_system::Pallet<Test>>::block_number(), 20 );
assert_eq!(Session::current_index(), 4 );
assert_eq!(OracleFinance::current_era(), Some(1));
assert_eq!(OracleFinance::eras_start_session_index(1), Some(4));
advance_session();
assert_eq!(<frame_system::Pallet<Test>>::block_number(), 25 );
assert_eq!(Session::current_index(), 5 );
assert_eq!(OracleFinance::current_era(), Some(2));
assert_eq!(OracleFinance::eras_start_session_index(2), Some(6));
advance_session();
assert_eq!(<frame_system::Pallet<Test>>::block_number(), 30 );
assert_eq!(Session::current_index(), 6 );
assert_eq!(OracleFinance::current_era(), Some(2));
assert_eq!(OracleFinance::eras_start_session_index(2), Some(6));
advance_session();
assert_eq!(<frame_system::Pallet<Test>>::block_number(), 35 );
assert_eq!(Session::current_index(), 7 );
assert_eq!(OracleFinance::current_era(), Some(3));
assert_eq!(OracleFinance::eras_start_session_index(3), Some(8));
});
} | rust_cleaned_test_functions.jsonl/35133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 712
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92269,
62,
2416,
4273,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
197,
59320,
12316,
543,
197,
6948,
10714,
10297,
27,
6763,
17687,
486,
47,
7464,
71273,
77595,
4574,
5500,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_next_orientation() {
assert_eq!(Orientation::East, next_orientation(Orientation::North, 'R'));
assert_eq!(Orientation::West, next_orientation(Orientation::North, 'L'));
assert_eq!(Orientation::South, next_orientation(Orientation::East, 'R'));
assert_eq!(Orientation::North, next_orientation(Orientation::East, 'L'));
assert_eq!(Orientation::West, next_orientation(Orientation::South, 'R'));
assert_eq!(Orientation::East, next_orientation(Orientation::South, 'L'));
assert_eq!(Orientation::North, next_orientation(Orientation::West, 'R'));
assert_eq!(Orientation::South, next_orientation(Orientation::West, 'L'));
} | rust_cleaned_test_functions.jsonl/11945 | {
"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,
11257,
66269,
368,
341,
6948,
10714,
10297,
22332,
486,
36340,
11,
1790,
66269,
19238,
17663,
486,
25221,
11,
364,
49,
6336,
6948,
10714,
10297,
22332,
486,
23306,
11,
1790,
66269,
19238,
17663,
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_binary_array() {
let values: [u8; 12] = [
b'h', b'e', b'l', b'l', b'o', b'p', b'a', b'r', b'q', b'u', b'e', b't',
];
let offsets: [i32; 4] = [0, 5, 5, 12];
let array_data = ArrayData::builder(DataType::Binary)
.len(3)
.add_buffer(Buffer::from(offsets.to_byte_slice()))
.add_buffer(Buffer::from(&values[..]))
.build();
let binary_array = BinaryArray::from(array_data);
assert_eq!(3, binary_array.len());
assert_eq!(0, binary_array.null_count());
assert_eq!([b'h', b'e', b'l', b'l', b'o'], binary_array.value(0));
assert_eq!([] as [u8; 0], binary_array.value(1));
assert_eq!(
[b'p', b'a', b'r', b'q', b'u', b'e', b't'],
binary_array.value(2)
);
assert_eq!(5, binary_array.value_offset(2));
assert_eq!(7, binary_array.value_length(2));
for i in 0..3 {
assert!(binary_array.is_valid(i));
assert!(!binary_array.is_null(i));
}
// Test binary array with offset
let array_data = ArrayData::builder(DataType::Binary)
.len(4)
.offset(1)
.add_buffer(Buffer::from(offsets.to_byte_slice()))
.add_buffer(Buffer::from(&values[..]))
.build();
let binary_array = BinaryArray::from(array_data);
assert_eq!(
[b'p', b'a', b'r', b'q', b'u', b'e', b't'],
binary_array.value(1)
);
assert_eq!(5, binary_array.value_offset(0));
assert_eq!(0, binary_array.value_length(0));
assert_eq!(5, binary_array.value_offset(1));
assert_eq!(7, binary_array.value_length(1));
} | rust_cleaned_test_functions.jsonl/11616 | {
"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,
31761,
3858,
368,
341,
286,
1077,
2750,
25,
508,
84,
23,
26,
220,
16,
17,
60,
284,
2278,
310,
293,
38882,
516,
293,
47868,
516,
293,
63866,
516,
293,
63866,
516,
293,
93472,
516,
293,
6,
79,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rchunks_mut_nth() {
let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5];
let mut c = v.rchunks_mut(2);
assert_eq!(c.nth(1).unwrap(), &[2, 3]);
assert_eq!(c.next().unwrap(), &[0, 1]);
let v2: &mut [i32] = &mut [0, 1, 2, 3, 4];
let mut c2 = v2.rchunks_mut(3);
assert_eq!(c2.nth(1).unwrap(), &[0, 1]);
assert_eq!(c2.next(), None);
} | rust_cleaned_test_functions.jsonl/9668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
84263,
29523,
78342,
368,
341,
262,
1077,
348,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq() {
let mut a = VecMap::new();
let mut b = VecMap::new();
assert!(a == b);
assert!(a.insert(0, 5).is_none());
assert!(a != b);
assert!(b.insert(0, 4).is_none());
assert!(a != b);
assert!(a.insert(5, 19).is_none());
assert!(a != b);
assert!(!b.insert(0, 5).is_none());
assert!(a != b);
assert!(b.insert(5, 19).is_none());
assert!(a == b);
a = VecMap::new();
b = VecMap::with_capacity(1);
assert!(a == b);
} | rust_cleaned_test_functions.jsonl/53278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
341,
286,
1077,
5206,
264,
284,
11312,
2227,
486,
931,
543,
286,
1077,
5206,
293,
284,
11312,
2227,
486,
931,
1428,
286,
2060,
10297,
64,
621,
293,
317,
286,
2060,
10297,
64,
7030,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_whitespace_control() {
assert_eq!(
split_blocks("foo {{ bar }} 2000"),
vec!["foo ", "{{ bar }}", " 2000"]
);
assert_eq!(
split_blocks("foo {{- bar -}} 2000"),
vec!["foo", " {{- bar -}} ", "2000"]
);
assert_eq!(
split_blocks("foo \n{{- bar }} 2000"),
vec!["foo", " \n{{- bar }}", " 2000"]
);
assert_eq!(
split_blocks("foo {% bar %} 2000"),
vec!["foo ", "{% bar %}", " 2000"]
);
assert_eq!(
split_blocks("foo {%- bar -%} 2000"),
vec!["foo", " {%- bar -%} ", "2000"]
);
assert_eq!(
split_blocks("foo \n{%- bar %} 2000"),
vec!["foo", " \n{%- bar %}", " 2000"]
);
} | rust_cleaned_test_functions.jsonl/65644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 467
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86175,
13436,
368,
341,
286,
2060,
10714,
33673,
310,
6718,
25201,
445,
7975,
5867,
3619,
3869,
220,
17,
15,
15,
15,
4461,
310,
7486,
0,
1183,
7975,
3670,
47219,
3619,
3869,
497,
330,
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_incompatible_pairwise_cipher() {
let a_rsne = make_rsne(Some(cipher::CCMP_128), vec![cipher::BIP_CMAC_256], vec![akm::PSK]);
assert_eq!(is_rsn_compatible(&a_rsne), false);
} | rust_cleaned_test_functions.jsonl/113747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
34842,
14445,
4482,
76692,
368,
341,
286,
1077,
264,
47115,
811,
284,
1281,
47115,
811,
65405,
1337,
10558,
486,
3706,
5781,
62,
16,
17,
23,
701,
7486,
20703,
67586,
486,
33,
3298,
920,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_strong_bridges() {
#![allow(clippy::many_single_char_names)]
let mut graph = petgraph_impl::new::<_, ()>();
let a = graph.add_node("a");
let b = graph.add_node("b");
let c = graph.add_node("c");
let d = graph.add_node("d");
let e = graph.add_node("e");
let f = graph.add_node("f");
let g = graph.add_node("g");
let h = graph.add_node("h");
let i = graph.add_node("i");
let j = graph.add_node("j");
let k = graph.add_node("k");
let l = graph.add_node("l");
let _e0 = graph.add_edge(a, b, ());
let e1 = graph.add_edge(a, f, ());
let e2 = graph.add_edge(b, c, ());
let _e3 = graph.add_edge(c, b, ());
let _e4 = graph.add_edge(c, d, ());
let _e5 = graph.add_edge(c, e, ());
let e6 = graph.add_edge(d, a, ());
let _e7 = graph.add_edge(e, b, ());
let _e8 = graph.add_edge(e, d, ());
let _e9 = graph.add_edge(f, g, ());
let e10 = graph.add_edge(f, h, ());
let e11 = graph.add_edge(g, i, ());
let e12 = graph.add_edge(g, j, ());
let e13 = graph.add_edge(h, g, ());
let e14 = graph.add_edge(i, f, ());
let e15 = graph.add_edge(j, k, ());
let e16 = graph.add_edge(j, l, ());
let e17 = graph.add_edge(k, g, ());
let e18 = graph.add_edge(l, e, ());
let expected = vec![e1, e2, e6, e10, e11, e12, e13, e14, e15, e16, e17, e18];
debug_assert_eq!(expected, naively_compute_strong_bridges(&graph));
} | rust_cleaned_test_functions.jsonl/115490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 829
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
2895,
644,
880,
1869,
4188,
368,
341,
286,
671,
20703,
7183,
9849,
45749,
486,
34576,
19487,
9232,
9187,
5563,
286,
1077,
5206,
4771,
284,
6753,
4439,
21007,
486,
931,
27638,
6878,
1719,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_acc() {
let test_data = [
"nop +0", "acc +1", "jmp +4", "acc +3", "jmp -3", "acc -99", "acc +1", "jmp -4",
"acc +6",
];
let mut program = parse_instructions(test_data);
let res = execute(0, 0, &program);
if let Execution::InfLoop(ip, acc, history) = res {
assert_eq!(try_fix_program(ip, acc, &mut program, &history), Ok((7, 8)));
} else {
panic!("It was supposed to be an infinite loop")
}
} | rust_cleaned_test_functions.jsonl/10241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
17737,
368,
341,
286,
1077,
1273,
1769,
284,
2278,
310,
330,
62813,
488,
15,
497,
330,
4475,
488,
16,
497,
330,
61055,
488,
19,
497,
330,
4475,
488,
18,
497,
330,
61055,
481,
18,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_second() {
assert_eq!(second("seconds"), Ok(("", "seconds")));
assert_eq!(second("second"), Ok(("", "second")));
assert_eq!(second("secs"), Ok(("", "secs")));
assert_eq!(second("sec"), Ok(("", "sec")));
assert_eq!(second("s"), Ok(("", "s")));
} | rust_cleaned_test_functions.jsonl/71145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29644,
368,
341,
310,
2060,
10714,
10297,
5569,
445,
17403,
3975,
7622,
7,
19814,
330,
17403,
17621,
310,
2060,
10714,
10297,
5569,
445,
5569,
3975,
7622,
7,
19814,
330,
5569,
17621,
310,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_attribute_ref_sup4() {
let buf = [0x01, 0x02, 0x03, 0x04, 0x99, 0x99];
let unit = test_parse_attribute_unit_default();
let form = constants::DW_FORM_ref_sup4;
let value = AttributeValue::DebugInfoRefSup(DebugInfoOffset(0x0403_0201));
test_parse_attribute(&buf, 4, &unit, form, value);
} | rust_cleaned_test_functions.jsonl/102032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16791,
7793,
23723,
19,
368,
341,
286,
1077,
6607,
284,
508,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
19,
11,
220,
15,
87,
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... | 1 |
#[test]
fn test_network_big_message() {
let first = "127.0.0.1:17200".parse().unwrap();
let second = "127.0.0.1:17201".parse().unwrap();
let m1 = raw_message(100_000);
let m2 = raw_message(400);
let mut connect_list = ConnectList::default();
let mut t1 = ConnectionParams::from_address(first);
let first_key = t1.connect_info.public_key;
connect_list.add(t1.connect_info.clone());
let mut t2 = ConnectionParams::from_address(second);
let second_key = t2.connect_info.public_key;
connect_list.add(t2.connect_info.clone());
let connect_list = SharedConnectList::from_connect_list(connect_list);
let e1 = TestEvents::with_addr(first, &connect_list);
let e2 = TestEvents::with_addr(second, &connect_list);
let mut e1 = t1.spawn(e1, connect_list.clone());
let mut e2 = t2.spawn(e2, connect_list);
e1.connect_with(second_key, t1.connect.clone());
e2.wait_for_connect();
e1.wait_for_connect();
e1.send_to(second_key, m1.clone());
assert_eq!(e2.wait_for_message(), m1);
e1.send_to(second_key, m2.clone());
assert_eq!(e2.wait_for_message(), m2);
e1.send_to(second_key, m1.clone());
assert_eq!(e2.wait_for_message(), m1);
e2.send_to(first_key, m2.clone());
assert_eq!(e1.wait_for_message(), m2);
e2.send_to(first_key, m1.clone());
assert_eq!(e1.wait_for_message(), m1);
e2.send_to(first_key, m2.clone());
assert_eq!(e1.wait_for_message(), m2);
e1.disconnect_with(second_key);
assert_eq!(e1.wait_for_disconnect(), second_key);
e2.disconnect_with(first_key);
assert_eq!(e2.wait_for_disconnect(), first_key);
} | rust_cleaned_test_functions.jsonl/46392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 715
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
36386,
6462,
368,
341,
262,
1077,
1156,
284,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
16,
22,
17,
15,
15,
3263,
6400,
1005,
15454,
543,
262,
1077,
2086,
284,
330,
16,
17,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_plugin_output_from_template_with_each_loop() {
let mapping = Mapping {
name: "random name".to_string(),
query: "up{random_label=\"random_value\"}".to_string(),
thresholds: ThresholdPair {
warning: None,
critical: Some(NagiosRange::from("@10:20").unwrap()),
},
host: "foo".to_string(),
service: Some("bar".to_string()),
interval: Duration::from_secs(60),
last_apply: Instant::now(),
plugin_output: Some(
"[{{ exit_status }}] Overall bla bla
{{ #each data }}
[{{ this.exit_status }}] {{ this.labels.known_label }} is {{ truncate prec=4 this.value }}
{{ /each }}
"
.to_string(),
),
performance_data: PerformanceData::default(),
};
let mut data = vec![];
let labels = BTreeMap::from([
("known_label".to_string(), "foo_value".to_string()),
("another_label".to_string(), "another_value".to_string()),
]);
let d = Data {
labels,
value: 5.0,
is_ok: Some(true),
is_warning: Some(false),
is_critical: Some(false),
is_up: None,
is_down: None,
exit_status: "OK".to_string(),
real_exit_value: 0,
temp_exit_value: 0,
};
data.push(d);
let labels = BTreeMap::from([
("known_label".to_string(), "bar_value".to_string()),
("another_label".to_string(), "another_value".to_string()),
]);
let d = Data {
labels,
value: 15.0,
is_ok: Some(true),
is_warning: Some(false),
is_critical: Some(true),
is_up: None,
is_down: None,
exit_status: "CRITICAL".to_string(),
real_exit_value: 2,
temp_exit_value: 2,
};
data.push(d);
let labels = BTreeMap::from([
("known_label".to_string(), "value".to_string()),
("another_label".to_string(), "another_value".to_string()),
]);
let d = Data {
labels,
value: 25.55465123,
is_ok: Some(true),
is_warning: Some(false),
is_critical: Some(false),
is_up: None,
is_down: None,
exit_status: "OK".to_string(),
real_exit_value: 0,
temp_exit_value: 0,
};
data.push(d);
assert_eq!(
format_from_template(
mapping.plugin_output.as_ref().unwrap(),
&mapping,
data,
2,
"CRITICAL".to_string()
)
.unwrap(),
"[CRITICAL] Overall bla bla
[OK] foo_value is 5
[CRITICAL] bar_value is 15
[OK] value is 25.5547
"
.to_string()
);
} | rust_cleaned_test_functions.jsonl/96139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1648
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
23110,
7645,
5673,
8693,
6615,
32046,
17198,
368,
341,
286,
1077,
12731,
284,
38446,
341,
310,
829,
25,
330,
11463,
829,
3263,
983,
3904,
3148,
310,
3239,
25,
330,
454,
90,
11463,
6106,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hsl_rgb_conversion() {
let red_rgb = RGBColor {
r: 1.,
g: 0.,
b: 0.,
};
let red_hsv: HSVColor = red_rgb.convert();
assert!(red_hsv.h.abs() <= 0.0001);
assert!((red_hsv.s - 1.0) <= 0.0001);
assert!((red_hsv.v - 1.0) <= 0.0001);
let lavender_hsv = HSVColor {
h: 243.5,
s: 0.568,
v: 0.925,
};
let lavender_rgb: RGBColor = lavender_hsv.convert();
assert_eq!(lavender_rgb.to_string(), "#6E66EC");
} | rust_cleaned_test_functions.jsonl/40396 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
3226,
37407,
64132,
368,
341,
286,
1077,
2518,
37407,
284,
20978,
1636,
341,
310,
435,
25,
220,
16,
38088,
310,
342,
25,
220,
15,
38088,
310,
293,
25,
220,
15,
38088,
286,
2605,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode() {
let json_str = "{\"name\":\"Alan\", \"city\":\"Tokyo\"}";
let contact: Contact = json::decode(json_str).unwrap();
assert!(contact == Contact { name: "Alan".to_string(), city: "Tokyo".to_string() });
} | rust_cleaned_test_functions.jsonl/92811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
341,
262,
1077,
2951,
2895,
284,
54734,
606,
23488,
67624,
16215,
7245,
8926,
23488,
52854,
16032,
2105,
26259,
262,
1077,
3645,
25,
9180,
284,
2951,
486,
18196,
9304,
2895,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_rsna_invalid_psk() {
let bss = fake_bss!(Wpa2);
// PSK too short
let credential = fidl_sme::Credential::Psk(vec![0xAA; 31]);
get_wpa2_rsna(&fake_device_info(CLIENT_ADDR), &credential, &bss)
.expect_err("expected RSNA failure with invalid PSK");
} | rust_cleaned_test_functions.jsonl/6069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
47115,
3376,
31433,
620,
4886,
368,
341,
286,
1077,
293,
778,
284,
12418,
880,
778,
10297,
54,
6595,
17,
317,
286,
442,
11405,
42,
2238,
2805,
198,
286,
1077,
40207,
284,
32104,
75,
643,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_thread_signal_unblock() {
thread::spawn(|| {
let mut mask = SigSet::empty();
mask.add(SIGUSR1);
assert!(mask.thread_unblock().is_ok());
assert!(!SigSet::thread_get_mask().unwrap().contains(SIGUSR1));
}).join().unwrap();
} | rust_cleaned_test_functions.jsonl/41967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10814,
21137,
4907,
4574,
368,
341,
286,
4516,
486,
46087,
79453,
341,
310,
1077,
5206,
6911,
284,
41560,
1649,
486,
3194,
543,
310,
6911,
1364,
52516,
49558,
16,
626,
310,
2060,
10297,
11258,
452... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_template_element_no_expressions() {
assert_parse_success!(
primary_expression(false, false),
"`asd`",
Expression::TemplateLiteral {
quasis: vec![TemplateElement {
cooked: Some("asd".to_string()),
raw: "asd".to_string(),
loc: Some(((1, 0), (1, 5)).into())
}],
expressions: vec![],
loc: Some(((1, 0), (1, 5)).into())
}
);
} | rust_cleaned_test_functions.jsonl/66464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8693,
7894,
6536,
2702,
39873,
368,
341,
262,
2060,
21039,
18632,
33673,
286,
6028,
28068,
3576,
11,
895,
1326,
286,
35973,
79102,
63,
756,
286,
16378,
486,
7275,
17350,
341,
310,
922,
10718,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hmac_sha256_examples() {
assert_eq!(
hmac_256::<Sha256>(&[], &[]),
hex::decode("b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad")
.unwrap()
.as_slice()
);
assert_eq!(
hmac_256::<Sha256>(b"key", b"The quick brown fox jumps over the lazy dog"),
hex::decode("f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8")
.unwrap()
.as_slice()
);
} | rust_cleaned_test_functions.jsonl/46487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
11948,
48836,
17,
20,
21,
45279,
368,
341,
286,
2060,
10714,
33673,
310,
83356,
62,
17,
20,
21,
27638,
62316,
17,
20,
21,
44784,
12995,
609,
1294,
1326,
310,
12371,
486,
18196,
445,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_reconciliation() {
let mut dummy_chain = DummyChainImpl::new();
let head_header = block::BlockHeader {
height: 1,
..block::BlockHeader::default()
};
dummy_chain.store_head_header(&head_header);
let new_output = DummyOutputSet::empty()
.with_output(test_output(10))
.with_output(test_output(20))
.with_output(test_output(30))
.with_output(test_output(40));
dummy_chain.update_output_set(new_output);
let chain_ref = Arc::new(dummy_chain);
let pool = RwLock::new(test_setup(&chain_ref));
// Preparation: We will introduce a three root pool transactions.
// 1. A transaction that should be invalidated because it is exactly
// contained in the block.
// 2. A transaction that should be invalidated because the input is
let block_transaction = test_transaction(vec![10], vec![8]);
let conflict_transaction = test_transaction(vec![20], vec![12, 6]);
let valid_transaction = test_transaction(vec![30], vec![13, 15]);
// We will also introduce a few children:
// turn exactly contained in the block.
let block_child = test_transaction(vec![8], vec![5, 1]);
// contained in the block at all and should be valid after
// reconciliation.
let pool_child = test_transaction(vec![5], vec![3]);
// 6. A transaction that descends from transaction 2 that does not
let conflict_child = test_transaction(vec![12], vec![2]);
// 7. A transaction that descends from transaction 2 that should be
// valid due to its inputs being satisfied by the block.
let conflict_valid_child = test_transaction(vec![6], vec![4]);
// 8. A transaction that descends from transaction 3 that should be
// invalidated due to an output conflict.
let valid_child_conflict = test_transaction(vec![13], vec![9]);
// 9. A transaction that descends from transaction 3 that should remain
// valid after reconciliation.
let valid_child_valid = test_transaction(vec![15], vec![11]);
// 10. A transaction that descends from both transaction 6 and
// transaction 9
let mixed_child = test_transaction(vec![2, 11], vec![7]);
// Add transactions.
// Note: There are some ordering constraints that must be followed here
let mut txs_to_add = vec![
block_transaction,
conflict_transaction,
valid_transaction,
block_child,
pool_child,
conflict_child,
conflict_valid_child,
valid_child_conflict,
valid_child_valid,
mixed_child,
];
let expected_pool_size = txs_to_add.len();
// First we add the above transactions to the pool; all should be
// accepted.
{
let mut write_pool = pool.write().unwrap();
assert_eq!(write_pool.total_size(), 0);
for tx in txs_to_add.drain(..) {
write_pool
.add_to_memory_pool(test_source(), tx, false)
.unwrap();
}
assert_eq!(write_pool.total_size(), expected_pool_size);
}
// Now we prepare the block that will cause the above condition.
// - Copy of 1
let block_tx_1 = test_transaction(vec![10], vec![8]);
let block_tx_2 = test_transaction(vec![20], vec![6]);
// - Copy of 4
let block_tx_3 = test_transaction(vec![8], vec![5, 1]);
// - Output conflict w/ 8
let block_tx_4 = test_transaction(vec![40], vec![9, 1]);
let block_transactions = vec![&block_tx_1, &block_tx_2, &block_tx_3, &block_tx_4];
let keychain = Keychain::from_random_seed().unwrap();
let key_id = keychain.derive_key_id(1).unwrap();
let block = block::Block::new(
&block::BlockHeader::default(),
block_transactions,
&keychain,
&key_id,
Difficulty::one(),
).unwrap();
chain_ref.apply_block(&block);
// Block reconciliation
{
let mut write_pool = pool.write().unwrap();
let evicted_transactions = write_pool.reconcile_block(&block);
assert!(evicted_transactions.is_ok());
assert_eq!(evicted_transactions.unwrap().len(), 6);
// check the specific transactions that were evicted.
}
// Using the pool's methods to validate a few end conditions.
{
let read_pool = pool.read().unwrap();
assert_eq!(read_pool.total_size(), 4);
// We should have available blockchain outputs
expect_output_parent!(read_pool, Parent::BlockTransaction, 9, 1);
// We should have spent blockchain outputs
expect_output_parent!(read_pool, Parent::AlreadySpent{other_tx: _}, 5, 6);
// We should have spent pool references
expect_output_parent!(read_pool, Parent::AlreadySpent{other_tx: _}, 15);
// We should have unspent pool references
expect_output_parent!(read_pool, Parent::PoolTransaction{tx_ref: _}, 3, 11, 13);
// References internal to the block should be unknown
expect_output_parent!(read_pool, Parent::Unknown, 8);
// Evicted transactions should have unknown outputs
expect_output_parent!(read_pool, Parent::Unknown, 2, 7);
}
} | rust_cleaned_test_functions.jsonl/17040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1765
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
1288,
98240,
368,
341,
197,
10217,
5206,
17292,
30583,
284,
50567,
18837,
9673,
486,
931,
543,
197,
10217,
1968,
8757,
284,
2504,
486,
4713,
4047,
341,
298,
30500,
25,
220,
16,
345,
298,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_svd() {
// Y = beta.X + e
// where Y is the N x 1 matrix of y values
// and X is the N x 2 matrix of x0 and x1 values
// x0 = 1 for all datapoints
// the expansion form is y = beta0 * x0 + beta1 * x1 + e
let xs = m!(1.0, 1.0; 1.0, 2.0; 1.0, 3.0);
let ys = m!(2.0; 4.0; 6.0);
let svd = SVD::new(&xs);
let u = svd.get_u();
let s = svd.get_s();
let v = svd.get_v();
assert!((u * s * v.t()).approx_eq(&xs));
// "divide each alpha_j by its corresponding s_j"
// alpha_j by the diagnonal s_j
assert_eq!(u.t().cols(), ys.rows());
let alpha = u.t() * ys;
assert_eq!(alpha.rows(), s.rows());
let sinv_alpha = m!(alpha.get(0, 0) / s.get(0, 0); alpha.get(1, 0) / s.get(1, 1));
assert_eq!(sinv_alpha.rows(), 2);
assert_eq!(sinv_alpha.cols(), 1);
assert_eq!(v.cols(), sinv_alpha.rows());
let betas = v * sinv_alpha;
assert_approx_eq!(betas.get(0, 0), 0.0f64, 0.0001f64);
assert_approx_eq!(betas.get(1, 0), 2.0f64, 0.0001f64);
} | rust_cleaned_test_functions.jsonl/61502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
16598,
368,
341,
286,
442,
809,
284,
13440,
4338,
488,
384,
198,
286,
442,
1380,
809,
374,
279,
451,
856,
220,
16,
6172,
315,
379,
2750,
198,
286,
442,
323,
1599,
374,
279,
451,
856,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reduce_dollar_to_franc() {
let bank = default_bank();
assert_eq!(franc(20.0), bank.reduce(&dollar(10.0), "CHF"));
} | rust_cleaned_test_functions.jsonl/133362 | {
"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,
64596,
814,
21295,
2346,
41537,
1129,
368,
341,
286,
1077,
6073,
284,
1638,
35733,
543,
286,
2060,
10714,
10297,
1626,
1129,
7,
17,
15,
13,
15,
701,
6073,
23792,
2099,
67,
21295,
7,
16,
15,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_part_1() {
let data = vec![
"0: 4 1 5",
"1: 2 3 | 3 2",
"2: 4 4 | 5 5",
"3: 4 5 | 5 4",
"4: \"a\"",
"5: \"b\"",
"",
"ababbb",
"bababa",
"abbbab",
"aaabbb",
"aaaabbb",
];
assert_eq!(part_1(&data), 2);
} | rust_cleaned_test_functions.jsonl/50116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
62,
16,
368,
341,
262,
1077,
821,
284,
7486,
90515,
414,
330,
15,
25,
220,
19,
220,
16,
220,
20,
756,
414,
330,
16,
25,
220,
17,
220,
18,
760,
220,
18,
220,
17,
756,
414,
330,
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_query_matches_with_alternatives_at_root() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(
language,
r#"
[
"if"
"else"
"function"
"throw"
"return"
] @keyword
"#,
)
.unwrap();
assert_query_matches(
language,
&query,
"
function a(b, c, d) {
if (b) {
return c;
} else {
throw d;
}
}
",
&[
(0, vec![("keyword", "function")]),
(0, vec![("keyword", "if")]),
(0, vec![("keyword", "return")]),
(0, vec![("keyword", "else")]),
(0, vec![("keyword", "throw")]),
],
);
})
} | rust_cleaned_test_functions.jsonl/25169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 660
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
79728,
5859,
3752,
12993,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
286,
1077,
3239,
284,
11361,
486,
931,
1006,
310,
4128,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_loops_around_when_reaching_top_of_the_list() {
let search = get_blank_search();
assert!(search.up().up().selection().unwrap().as_slice() == "two");
} | rust_cleaned_test_functions.jsonl/96102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5560,
3721,
62,
19454,
47636,
1288,
11829,
10426,
3575,
16068,
2019,
368,
341,
286,
1077,
2711,
284,
633,
56103,
10716,
543,
286,
2060,
10297,
1836,
17652,
1005,
454,
1005,
23617,
1005,
15454,
1005,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_array_sum() {
let c: Result<Color, _> = [-1, 255, 255].try_into();
assert!(c.is_err());
} | rust_cleaned_test_functions.jsonl/24502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
10160,
368,
341,
286,
1077,
272,
25,
5714,
88827,
11,
716,
29,
284,
10055,
16,
11,
220,
17,
20,
20,
11,
220,
17,
20,
20,
936,
1539,
45514,
543,
286,
2060,
10297,
66,
2079,
9266,
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 |
#[test]
fn test_buffer_len() {
assert_eq!(mock_buffer::<u8>(8).len(), 8);
assert_eq!(mock_buffer::<u16>(8).len(), 8);
} | rust_cleaned_test_functions.jsonl/30872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
6043,
368,
341,
262,
2060,
10714,
10297,
16712,
7776,
27638,
84,
23,
2235,
23,
568,
2892,
1507,
220,
23,
317,
262,
2060,
10714,
10297,
16712,
7776,
27638,
84,
16,
21,
2235,
23,
568,
2892,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decrement_5() {
let mut h = Histogram::new();
let v = h.config.max_value + 1;
let _ = h.increment(v);
h.decrement(v).unwrap();
} | rust_cleaned_test_functions.jsonl/82147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
13477,
62,
20,
368,
341,
286,
1077,
5206,
305,
284,
82138,
486,
931,
543,
286,
1077,
348,
284,
305,
5423,
6678,
3142,
488,
220,
16,
280,
286,
1077,
716,
284,
305,
56936,
3747,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_match_user_non_root() -> Result<(), Box<dyn error::Error>> {
let image = build_image(&[
"RUN addgroup --gid 1234 app",
"RUN adduser --uid 1234 --gid 1234 --gecos '' --disabled-password app",
])?;
let output = run_container(
&image,
&["-e", "MHF_HOST_UID=1300", "-e", "MHF_HOST_GID=1301"],
&["id"],
)?;
assert_contains_substr!(
output.text,
"uid=1300(app) gid=1301(app) groups=1301(app)\n"
);
assert_eq!(Some(0), output.status.code());
Ok(())
} | rust_cleaned_test_functions.jsonl/90917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
3317,
21637,
12993,
368,
1464,
5714,
68843,
8261,
92846,
1465,
486,
1454,
2452,
341,
262,
1077,
2168,
284,
1936,
4954,
2099,
9640,
286,
330,
47390,
912,
4074,
1177,
34849,
220,
16,
17,
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... | 3 |
#[test]
fn test_parse_error_at_index_error() {
test_parse_error!(
vec![("a", "false"), ("b", "true")],
(bool, u32),
ErrorKind::ParseErrorAtIndex {
index: 1,
value: "true".to_owned(),
expected_type: "u32",
}
);
} | rust_cleaned_test_functions.jsonl/16608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4096,
3752,
3560,
4096,
368,
341,
286,
1273,
21039,
4096,
33673,
310,
7486,
20703,
445,
64,
497,
330,
3849,
3975,
3489,
65,
497,
330,
1866,
899,
1259,
310,
320,
2641,
11,
575,
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... | 1 |
#[test]
fn test_json_as_duration() {
test_none_with_ctx_and_extra(cast_json_as_duration);
// the case that Json::unquote failed had be tested by test_json_unquote
let cs = vec![
Json::Object(BTreeMap::default()),
Json::Array(vec![]),
Json::I64(10),
Json::I64(i64::MAX),
Json::I64(i64::MIN),
Json::U64(0),
Json::U64(u64::MAX),
Json::Double(10.5),
Json::Double(10.4),
Json::Double(-10.4),
Json::Double(-10.5),
Json::Double(i64::MIN as u64 as f64),
Json::Double(i64::MAX as u64 as f64),
Json::Double(i64::MIN as u64 as f64),
Json::Double(i64::MIN as f64),
Json::Double(((1u64 << 63) + (1u64 << 62)) as u64 as f64),
Json::Double(-((1u64 << 63) as f64 + (1u64 << 62) as f64)),
Json::Double(f64::from(f32::MIN)),
Json::Double(f64::from(f32::MAX)),
Json::Double(f64::MAX),
Json::Double(f64::MAX),
Json::String(String::from("10.0")),
Json::String(String::from(
"999999999999999999999999999999999999999999999999",
)),
Json::String(String::from(
"-999999999999999999999999999999999999999999999999",
)),
Json::String(String::from(
"99999999999999999999999999999999999999999999999aabcde9",
)),
Json::String(String::from(
"-99999999999999999999999999999999999999999999999aabcde9",
)),
Json::Boolean(true),
Json::Boolean(false),
Json::None,
];
test_as_duration_helper(
cs,
|x| x.unquote().unwrap(),
|x| format!("{:?}", x),
cast_json_as_duration,
"cast_json_as_duration",
);
} | rust_cleaned_test_functions.jsonl/101811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
11898,
25454,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
9455,
11898,
25454,
626,
286,
442,
279,
1142,
429,
8308,
486,
359,
2949,
4641,
1030,
387,
12510,
553,
1273,
945... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_iter() {
use std::convert::TryFrom;
let arr = params::Container::try_from(vec![0i32.into(), 1i32.into(), 2i32.into()]).unwrap();
let mut fds = Vec::new();
let mut buf = Vec::new();
let mut ctx = crate::wire::marshal::MarshalContext {
fds: &mut fds,
buf: &mut buf,
byteorder: crate::ByteOrder::LittleEndian,
};
crate::wire::marshal::container::marshal_container_param(&arr, &mut ctx).unwrap();
let mut offset = 0;
let sig = arr.sig();
let mut iter = ParamIter::new(&sig, &mut offset, &buf, ByteOrder::LittleEndian)
.unwrap()
.unwrap();
let mut ints = Vec::new();
while let Some(base) = iter.recurse() {
if let params::Base::Int32(i) = base.unwrap().base().unwrap() {
ints.push(i);
}
}
assert_eq!(&[0, 1, 2], ints.as_slice());
} | rust_cleaned_test_functions.jsonl/71898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
11723,
368,
341,
262,
990,
1460,
486,
14166,
486,
21453,
3830,
280,
262,
1077,
2890,
284,
3628,
486,
4502,
486,
1539,
5673,
25592,
20703,
15,
72,
18,
17,
39860,
1507,
220,
16,
72,
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... | 3 |
#[test]
fn test_refresh_neuron_by_subaccount_by_proxy() {
let owner = *TEST_NEURON_1_OWNER_PRINCIPAL;
let caller = *TEST_NEURON_1_OWNER_PRINCIPAL;
refresh_neuron_by_id_or_subaccount(owner, caller, RefreshBy::Subaccount);
} | rust_cleaned_test_functions.jsonl/1155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42076,
13925,
36090,
3710,
5228,
4608,
3710,
29712,
368,
341,
262,
1077,
6372,
284,
353,
10033,
14039,
1511,
711,
62,
16,
74323,
10571,
38439,
3298,
969,
280,
262,
1077,
19865,
284,
353,
10033,
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_seek_do_not_overwrite() {
let (at, mut ucmd) = at_and_ucmd!();
let mut outfile = at.make_file("outfile");
outfile.write_all(b"abc").unwrap();
ucmd.args(&[
"bs=1",
"skip=1",
"seek=1",
"count=1",
"status=noxfer",
"of=outfile",
])
.pipe_in("123")
.succeeds()
.stderr_is("1+0 records in\n1+0 records out\n")
.no_stdout();
assert_eq!(at.read("outfile"), "a2");
} | rust_cleaned_test_functions.jsonl/99840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
26309,
7913,
15431,
4934,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
5206,
33178,
284,
518,
10117,
2458,
445,
59625,
797,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_setup_and_prove_single_gate_and_tables() {
use crate::pairing::bn256::{Bn256, Fr};
use crate::worker::Worker;
use crate::plonk::better_better_cs::verifier::*;
use crate::plonk::better_better_cs::setup::VerificationKey;
let mut assembly = SetupAssembly::<Bn256, PlonkCsWidth4WithNextStepParams, Width4MainGateWithDNext>::new();
let circuit = TestCircuit4WithLookupsManyGatesSmallTable::<Bn256> {
_marker: PhantomData
};
circuit.synthesize(&mut assembly).expect("must work");
println!("Assembly contains {} gates", assembly.n());
assert!(assembly.is_satisfied());
assembly.finalize();
println!("Finalized assembly contains {} gates", assembly.n());
let worker = Worker::new();
let setup = assembly.create_setup::<TestCircuit4WithLookupsManyGatesSmallTable<Bn256>>(&worker).unwrap();
let mut assembly = ProvingAssembly::<Bn256, PlonkCsWidth4WithNextStepParams, Width4MainGateWithDNext>::new();
circuit.synthesize(&mut assembly).expect("must work");
assembly.finalize();
let size = assembly.n().next_power_of_two();
use crate::plonk::commitments::transcript::keccak_transcript::RollingKeccakTranscript;
use crate::kate_commitment::*;
let crs_mons = Crs::<Bn256, CrsForMonomialForm>::crs_42(size, &worker);
let proof = assembly.create_proof::<TestCircuit4WithLookupsManyGatesSmallTable<Bn256>, RollingKeccakTranscript<Fr>>(
&worker,
&setup,
&crs_mons,
None
).unwrap();
let vk = VerificationKey::from_setup(&setup, &worker, &crs_mons).unwrap();
let valid = verify::<Bn256, TestCircuit4WithLookupsManyGatesSmallTable<Bn256>, RollingKeccakTranscript<Fr>>(
&vk,
&proof,
None,
).unwrap();
assert!(valid);
} | rust_cleaned_test_functions.jsonl/78087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21363,
8378,
2540,
586,
19487,
54798,
8378,
35632,
368,
341,
286,
990,
17717,
486,
12670,
287,
486,
11081,
17,
20,
21,
22964,
33,
77,
17,
20,
21,
11,
2869,
2440,
286,
990,
17717,
486,
21462,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_byte_array_len_encoding() -> io::Result<()> {
let data = [
4, // byte array len encoding ID
6, // args.len
1, // external encoding ID
1, // args.len
13, // block content ID
1, // external encoding ID
1, // args.len
21, // block content ID
];
let mut reader = &data[..];
let encoding = read_encoding(&mut reader)?;
assert_eq!(
encoding,
Encoding::ByteArrayLen(
Box::new(Encoding::External(13)),
Box::new(Encoding::External(21))
)
);
Ok(())
} | rust_cleaned_test_functions.jsonl/5075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
19737,
3858,
6043,
37613,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
821,
284,
2278,
310,
220,
19,
11,
220,
442,
4922,
1334,
2422,
11170,
3034,
198,
310,
220,
21,
11,
220,
442,
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_into_alogithm_id() {
assert_eq!(
Into::<TPM2_ALG_ID>::into(AlgorithmicError::Error),
TPM2_ALG_ERROR
);
} | rust_cleaned_test_functions.jsonl/41517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
31645,
27638,
4239,
44,
17,
8912,
38,
3450,
6831,
18122,
7,
27847,
292,
1454,
486,
1454,
1326,
310,
63644,
17,
8912,
38,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_keys() {
let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
let map: HashMap<_, _> = vec.into_par_iter().collect();
let keys: Vec<_> = map.par_keys().cloned().collect();
assert_eq!(keys.len(), 3);
assert!(keys.contains(&1));
assert!(keys.contains(&2));
assert!(keys.contains(&3));
} | rust_cleaned_test_functions.jsonl/45214 | {
"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,
12631,
368,
341,
286,
1077,
7486,
284,
7486,
0,
9697,
16,
11,
364,
64,
4567,
320,
17,
11,
364,
65,
4567,
320,
18,
11,
364,
66,
863,
935,
286,
1077,
2415,
25,
10528,
27,
6878,
716,
29,
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_inject_input_sends_action() {
async_service_test(|ime_service, _visibility_service| {
async move {
let (_ime, mut editor_stream) = bind_ime_for_test(&ime_service);
// send key events
simulate_keypress(&ime_service, 0, HID_USAGE_KEY_ENTER);
// get first message with keypress event
let (_state, event) = get_state_update(&mut editor_stream).await;
let event = event.expect("expected event to be set");
assert_eq!(event.phase, uii::KeyboardEventPhase::Pressed);
assert_eq!(event.code_point, 0);
assert_eq!(event.hid_usage, HID_USAGE_KEY_ENTER);
// get second message with onaction event
let msg = editor_stream
.try_next()
.await
.expect("expected working event stream")
.expect("ime should have sent message");
if let uii::InputMethodEditorClientRequest::OnAction { action, .. } = msg {
assert_eq!(action, uii::InputMethodAction::Done);
} else {
panic!("request should be OnAction");
}
}
})
} | rust_cleaned_test_functions.jsonl/7402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
583,
5898,
643,
1412,
7931,
368,
341,
286,
3312,
12267,
4452,
22428,
545,
12267,
11,
716,
28176,
12267,
91,
341,
310,
3312,
3271,
341,
394,
1077,
5453,
545,
11,
5206,
6440,
12673,
8,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_list_table_patient_no_header() {
test_list_table_patient(
PATIENTS_LIST_HEADER,
PATIENTS_LIST_DICOM_TAGS,
true,
include_str!("../tests/data/unit/list_patients_no_header").trim_end(),
);
} | rust_cleaned_test_functions.jsonl/76474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
2019,
5237,
70310,
6536,
8757,
368,
341,
286,
1273,
2019,
5237,
70310,
1006,
310,
44370,
10757,
50,
11899,
20330,
345,
310,
44370,
10757,
50,
11899,
1557,
1317,
1898,
84182,
345,
310,
830,
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 |
#[test]
fn test_nested_hierarchy() {
let result = hierarchy! {
root: {
sub1: {
sub11: {
sub111: {
value: 1u64,
other_value: "foo",
}
}
},
sub2: {
sub21: {
value: 2u64,
},
sub22: {},
}
}
};
assert_data_tree!(result, root: {
sub1: {
sub11: {
sub111: {
value: 1u64,
other_value: "foo",
}
}
},
sub2: {
sub21: {
value: 2u64,
},
sub22: {}
}
});
} | rust_cleaned_test_functions.jsonl/45833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 732
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
95043,
368,
341,
286,
1077,
1102,
284,
28922,
0,
341,
310,
3704,
25,
341,
394,
1186,
16,
25,
341,
503,
1186,
16,
16,
25,
341,
664,
1186,
16,
16,
16,
25,
341,
999,
897,
25,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_banmen_with_kyou_nari_7_squares_sente() {
test_legal_moves_banmen_with_kin_7_squares_sente_impl(SKyouN)
} | rust_cleaned_test_functions.jsonl/81273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
9330,
1089,
2780,
62,
22,
643,
40856,
643,
6817,
368,
972,
18185,
82324,
45390,
880,
276,
5676,
6615,
4698,
258,
62,
22,
643,
40856,
643,
6817,
21007,
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 |
#[test]
fn test_toolchain_sort() {
let expected = vec![
"stable-x86_64-unknown-linux-gnu",
"beta-x86_64-unknown-linux-gnu",
"nightly-x86_64-unknown-linux-gnu",
"1.0.0-x86_64-unknown-linux-gnu",
"1.2.0-x86_64-unknown-linux-gnu",
"1.8.0-x86_64-unknown-linux-gnu",
"1.10.0-x86_64-unknown-linux-gnu",
];
let mut v = vec![
"1.8.0-x86_64-unknown-linux-gnu",
"1.0.0-x86_64-unknown-linux-gnu",
"nightly-x86_64-unknown-linux-gnu",
"stable-x86_64-unknown-linux-gnu",
"1.10.0-x86_64-unknown-linux-gnu",
"beta-x86_64-unknown-linux-gnu",
"1.2.0-x86_64-unknown-linux-gnu",
];
toolchain_sort(&mut v);
assert_eq!(expected, v);
} | rust_cleaned_test_functions.jsonl/15086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22785,
8819,
18435,
368,
341,
286,
1077,
3601,
284,
7486,
90515,
310,
330,
27992,
6558,
23,
21,
62,
21,
19,
12,
16088,
46375,
85716,
756,
310,
330,
19127,
6558,
23,
21,
62,
21,
19,
12,
16088,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_var_f64_le() {
for &v in F64_TESTS {
let mut buf = vec![];
buf.encode_f64_le(v).unwrap();
let value = decode_f64_le(&mut buf.as_slice()).unwrap();
assert_eq!(v, value);
}
} | rust_cleaned_test_functions.jsonl/45059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
761,
21,
19,
11751,
368,
341,
286,
369,
609,
85,
304,
434,
21,
19,
80312,
341,
310,
1077,
5206,
6607,
284,
7486,
0,
15078,
310,
6607,
17313,
761,
21,
19,
11751,
3747,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_enum_as_int() {
// TODO: we need to test None case here.
let mut buf = BufferVec::new();
buf.push("我好强啊");
buf.push("我太强啦");
let cs = vec![
// (input, expect)
(EnumRef::new(&buf, 0), 0),
(EnumRef::new(&buf, 1), 1),
];
for (input, expect) in cs {
let r = cast_enum_as_int(input);
let r = r.map(|x| x.map(|x| x as u64));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/1940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
11898,
4042,
368,
341,
286,
442,
5343,
25,
582,
1184,
311,
1273,
2240,
1142,
1588,
382,
286,
1077,
5206,
6607,
284,
10312,
10050,
486,
931,
543,
286,
6607,
2552,
445,
35946,
52801,
99193,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sqrt() {
let mut ctx = create_context();
ctx.register_scalar_function(Rc::new(SqrtFunction {}));
let df = ctx.sql(&"SELECT id, sqrt(id) FROM people").unwrap();
ctx.write_csv(df, "./target/test_sqrt.csv").unwrap();
let expected_result = read_file("test/data/expected/test_sqrt.csv");
assert_eq!(expected_result, read_file("./target/test_sqrt.csv"));
} | rust_cleaned_test_functions.jsonl/2506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92199,
368,
341,
286,
1077,
5206,
5635,
284,
1855,
8467,
1428,
286,
5635,
9929,
41652,
9174,
2785,
66,
486,
931,
3759,
8140,
5152,
4687,
3237,
286,
1077,
6764,
284,
5635,
10045,
2099,
1,
4858,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_checksum() {
let mut bytes = vec![0; 8];
let mut packet = Packet::new_unchecked(&mut bytes);
packet.set_src_port(1);
packet.set_dst_port(31881);
packet.set_len(8);
packet.fill_checksum(&SRC_ADDR.into(), &DST_ADDR.into());
assert_eq!(packet.checksum(), 0xffff);
} | rust_cleaned_test_functions.jsonl/36418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
64038,
368,
341,
286,
1077,
5206,
5820,
284,
7486,
20703,
15,
26,
220,
23,
935,
286,
1077,
5206,
10151,
284,
28889,
486,
931,
4907,
7549,
2099,
6984,
5820,
317,
286,
10151,
980,
16274,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_segment_count_collector() {
{
let count_collector = SegmentCountCollector::default();
assert_eq!(count_collector.harvest(), 0);
}
{
let mut count_collector = SegmentCountCollector::default();
count_collector.collect(0u32, 1.0);
assert_eq!(count_collector.harvest(), 1);
}
{
let mut count_collector = SegmentCountCollector::default();
count_collector.collect(0u32, 1.0);
assert_eq!(count_collector.harvest(), 1);
}
{
let mut count_collector = SegmentCountCollector::default();
count_collector.collect(0u32, 1.0);
count_collector.collect(1u32, 1.0);
assert_eq!(count_collector.harvest(), 2);
}
} | rust_cleaned_test_functions.jsonl/70337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28061,
3180,
10211,
27669,
368,
341,
286,
341,
310,
1077,
1760,
10211,
27669,
284,
37103,
2507,
53694,
486,
2258,
543,
310,
2060,
10714,
10297,
1830,
10211,
27669,
86455,
7019,
1507,
220,
15,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_textobject_paragraph_inside_double() {
let tests = [
(
"last two\n\n#[p|]#aragraph\n\nwithout whitespaces\n\n",
"last two\n\n#[paragraph\n\nwithout whitespaces\n|]#\n",
),
(
"last two\n#[\n|]#paragraph\n\nwithout whitespaces\n\n",
"last two\n\n#[paragraph\n\nwithout whitespaces\n|]#\n",
),
];
for (before, expected) in tests {
let (s, selection) = crate::test::print(before);
let text = Rope::from(s.as_str());
let selection = selection
.transform(|r| textobject_paragraph(text.slice(..), r, TextObject::Inside, 2));
let actual = crate::test::plain(&s, selection);
assert_eq!(actual, expected, "\nbefore: `{:?}`", before);
}
} | rust_cleaned_test_functions.jsonl/107627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
1700,
96713,
72860,
24598,
368,
341,
286,
1077,
7032,
284,
2278,
310,
2399,
394,
330,
4259,
1378,
1699,
1699,
13353,
79,
91,
60,
2,
277,
9216,
1699,
1699,
28996,
21874,
27338,
1699,
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... | 2 |
#[test]
fn test_and() {
assert_eq!(1, and (1,1));
assert_eq!(0, and (0,1));
assert_eq!(0, and (1,0));
assert_eq!(0, and (0,0));
} | rust_cleaned_test_functions.jsonl/112906 | {
"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,
8378,
368,
341,
286,
2060,
10714,
10297,
16,
11,
323,
320,
16,
11,
16,
1106,
286,
2060,
10714,
10297,
15,
11,
323,
320,
15,
11,
16,
1106,
286,
2060,
10714,
10297,
15,
11,
323,
320,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_range_128() {
use core::{i128, u128};
assert!(super::range(0i128, 5).eq([0, 1, 2, 3, 4].iter().cloned()));
assert!(super::range(-10i128, -1).eq([-10, -9, -8, -7, -6, -5, -4, -3, -2].iter().cloned()));
assert!(super::range(0u128, 5)
.rev()
.eq([4, 3, 2, 1, 0].iter().cloned()));
assert_eq!(
super::range(i128::MIN, i128::MIN + 1).size_hint(),
(1, Some(1))
);
assert_eq!(
super::range(i128::MAX - 1, i128::MAX).size_hint(),
(1, Some(1))
);
assert_eq!(
super::range(i128::MIN, i128::MAX).size_hint(),
(usize::MAX, None)
);
assert_eq!(
super::range(u128::MAX - 1, u128::MAX).size_hint(),
(1, Some(1))
);
assert_eq!(
super::range(0, usize::MAX as u128).size_hint(),
(usize::MAX, Some(usize::MAX))
);
assert_eq!(
super::range(0, usize::MAX as u128 + 1).size_hint(),
(usize::MAX, None)
);
assert_eq!(super::range(0, i128::MAX).size_hint(), (usize::MAX, None));
} | rust_cleaned_test_functions.jsonl/37393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
62,
16,
17,
23,
368,
341,
286,
990,
6200,
22964,
72,
16,
17,
23,
11,
575,
16,
17,
23,
2315,
286,
2060,
10297,
9522,
486,
9669,
7,
15,
72,
16,
17,
23,
11,
220,
20,
568,
11006,
2561,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_docs() {
let mut config = configure(&[], &[]);
config.cmd = Subcommand::Test {
paths: vec![],
test_args: vec![],
rustc_args: vec![],
fail_fast: true,
doc_tests: DocTests::Yes,
bless: false,
compare_mode: None,
rustfix_coverage: false,
pass: None,
};
let build = Build::new(config);
let mut builder = Builder::new(&build);
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Test), &[]);
let a = TargetSelection::from_user("A");
// error_index_generator uses stage 1 to share rustdoc artifacts with the
// rustdoc tool.
assert_eq!(
first(builder.cache.all::<doc::ErrorIndex>()),
&[doc::ErrorIndex { compiler: Compiler { host: a, stage: 1 }, target: a },]
);
assert_eq!(
first(builder.cache.all::<tool::ErrorIndex>()),
&[tool::ErrorIndex { compiler: Compiler { host: a, stage: 1 } }]
);
// Unfortunately rustdoc is built twice. Once from stage1 for compiletest
// worth investigating if it would be possible to test std from stage1.
// Note that the stages here are +1 than what they actually are because
// Rustdoc::run swaps out the compiler with stage minus 1 if --stage is
// not 0.
assert_eq!(
first(builder.cache.all::<tool::Rustdoc>()),
&[
tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },
]
);
} | rust_cleaned_test_functions.jsonl/103565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49692,
368,
341,
1789,
286,
1077,
5206,
2193,
284,
14411,
2099,
12995,
609,
56703,
286,
2193,
25724,
284,
3719,
5631,
486,
2271,
341,
310,
12716,
25,
7486,
20703,
1259,
310,
1273,
8384,
25,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_operations_hash() -> Result<(), failure::Error> {
let decoded = HashType::OperationListListHash.string_to_bytes("LLoaGLRPRx3Zf8kB4ACtgku8F4feeBiskeb41J1ciwfcXB3KzHKXc")?;
let decoded = hex::encode(&decoded);
let expected = "7c09f7c4d76ace86e1a7e1c7dc0a0c7edcaa8b284949320081131976a87760c3";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/65928 | {
"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,
15227,
57345,
8950,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
29213,
284,
6531,
929,
486,
8432,
852,
852,
6370,
4804,
2346,
12524,
445,
4086,
19533,
3825,
49,
6480,
87,
18,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_decode_vch_f2_00_02() {
#[cfg(feature = "v3")]
init_psa_crypto();
let vch = Voucher::try_from(VCH_F2_00_02).unwrap();
let (sig, alg) = vch.get_signature().unwrap();
assert_eq!(sig.len(), 64);
assert_eq!(*alg, SignatureAlgorithm::ES256);
assert_eq!(vch.get_signer_cert(), None);
assert!(vch.get_cose_content().unwrap().len() > 0);
} | rust_cleaned_test_functions.jsonl/81739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
2273,
331,
761,
17,
62,
15,
15,
62,
15,
17,
368,
341,
262,
11506,
14072,
27062,
284,
330,
85,
18,
5422,
262,
2930,
620,
9081,
78298,
1428,
262,
1077,
348,
331,
284,
647,
23937,
486,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shortest_paths_5() {
let g = super::Digraph::from_vec(&vec![
None, Some(1.0f64), None,
None, None, Some(2.0f64),
Some(-4.0f64), None, None
]);
assert_eq!(g.bellman_ford(0),
Err(GraphErrors::ContainsNegativeCycle));
assert_eq!(g.johnson(0), Err(GraphErrors::ContainsNegativeCycle));
} | rust_cleaned_test_functions.jsonl/42296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
477,
24152,
62,
20,
368,
341,
286,
1077,
342,
284,
2256,
486,
37098,
1935,
486,
1499,
13251,
2099,
4083,
90515,
310,
2240,
11,
4329,
7,
16,
13,
15,
69,
21,
19,
701,
2240,
345,
310,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resumable_seal_v1_1() {
let porep_id_v1_1: u64 = 5; // This is a RegisteredSealProof value
let mut porep_id = [0u8; 32];
porep_id[..8].copy_from_slice(&porep_id_v1_1.to_le_bytes());
run_resumable_seal::<SectorShape2KiB>(false, 0, &porep_id);
run_resumable_seal::<SectorShape2KiB>(false, 1, &porep_id);
} | rust_cleaned_test_functions.jsonl/4371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
372,
480,
3453,
278,
2273,
16,
62,
16,
368,
341,
262,
1077,
96451,
79,
842,
2273,
16,
62,
16,
25,
575,
21,
19,
284,
220,
20,
26,
442,
1096,
374,
264,
35539,
1514,
278,
31076,
897,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conf_change_remove_leader() {
let mut cluster = new_node_cluster(0, 3);
cluster.cfg.raft_store.allow_remove_leader = false;
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
let r1 = cluster.run_conf_change();
pd_client.must_add_peer(r1, new_peer(2, 2));
pd_client.must_add_peer(r1, new_peer(3, 3));
// Transfer leader to the first peer.
cluster.must_transfer_leader(r1, new_peer(1, 1));
// false warning about pending conf change.
cluster.must_put(b"k1", b"v1");
let res =
call_conf_change(&mut cluster, r1, ConfChangeType::RemoveNode, new_peer(1, 1)).unwrap();
assert!(
res.get_header()
.get_error()
.get_message()
.contains("ignore remove leader"),
"{:?}",
res
);
} | rust_cleaned_test_functions.jsonl/107620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16059,
15947,
18193,
79991,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
10652,
30481,
13,
2944,
14809,
57456,
18193,
79991,
284,
895,
280,
262,
1077,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slot_subscribe() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let rpc = RpcSolPubSubImpl::default_with_bank_forks(bank_forks);
let session = create_session();
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("slotNotification");
rpc.slot_subscribe(session, subscriber);
rpc.subscriptions.notify_slot(0, 0, 0);
// Test slot confirmation notification
let (response, _) = robust_poll_or_panic(receiver);
let expected_res = SlotInfo {
parent: 0,
slot: 0,
root: 0,
};
let expected_res_str =
serde_json::to_string(&serde_json::to_value(expected_res).unwrap()).unwrap();
let expected = format!(
r#"{{"jsonrpc":"2.0","method":"slotNotification","params":{{"result":{},"subscription":0}}}}"#,
expected_res_str
);
assert_eq!(expected, response);
} | rust_cleaned_test_functions.jsonl/4705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 511
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27563,
88935,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
486,
931,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_keys() {
let dict = sample_dict("abcd");
assert_eq!(dict.iter_keys().count(), 1);
autoreleasepool(|pool| {
assert_eq!(dict.iter_keys().next().unwrap().as_str(pool), "abcd");
});
} | rust_cleaned_test_functions.jsonl/108471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
12631,
368,
341,
286,
1077,
6451,
284,
6077,
5243,
445,
68644,
797,
286,
2060,
10714,
10297,
8477,
19471,
12631,
1005,
1830,
1507,
220,
16,
317,
286,
74566,
10285,
22428,
10285,
91,
341,
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 |
#[test]
fn test_plan_fetch_and_lookup() {
let clause_a = Clause::new(Unbound("a".into()), Bound(Ident::Entity(Entity(1))), Unbound("b".into()));
let clause_b = Clause::new(Unbound("b".into()), Bound(Ident::Entity(Entity(2))), Unbound("c".into()));
let find = vec!["a".into(), "b".into(), "c".into()];
let query = Query {
find: find.clone(),
clauses: vec![clause_a.clone(), clause_b.clone()],
constraints: vec![],
};
let fetch_plan = Plan::Fetch(clause_a);
assert_eq!(
Plan::for_query(query),
Plan::Project(Box::new(Plan::LookupEach(Box::new(fetch_plan), clause_b)), find)
)
} | rust_cleaned_test_functions.jsonl/77548 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26564,
11803,
8378,
27464,
368,
341,
286,
1077,
21647,
4306,
284,
55797,
486,
931,
49289,
10891,
445,
64,
3263,
18122,
11858,
37176,
7,
28301,
486,
3030,
33761,
7,
16,
36363,
1230,
10891,
445,
65,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_matches_with_simple_pattern() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(
language,
"(function_declaration name: (identifier) @fn-name)",
)
.unwrap();
assert_query_matches(
language,
&query,
"function one() { two(); function three() {} }",
&[
(0, vec![("fn-name", "one")]),
(0, vec![("fn-name", "three")]),
],
);
});
} | rust_cleaned_test_functions.jsonl/25146 | {
"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,
5738,
38344,
6615,
30015,
21260,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
286,
1077,
3239,
284,
11361,
486,
931,
1006,
310,
4128,
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... | 2 |
#[test]
fn test_transpose() {
assert_eq!(A.transpose(),
Matrix3::<f64>::new(1.0f64, 2.0f64, 3.0f64,
4.0f64, 5.0f64, 6.0f64,
7.0f64, 8.0f64, 9.0f64));
} | rust_cleaned_test_functions.jsonl/30155 | {
"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,
7965,
2900,
368,
341,
286,
2060,
10714,
10297,
32,
35305,
3148,
4293,
11631,
18,
27638,
69,
21,
19,
6831,
931,
7,
16,
13,
15,
69,
21,
19,
11,
220,
17,
13,
15,
69,
21,
19,
11,
220,
18,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_event_serialisation_with_no_more_events() {
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
enum Event {
SomeEvent,
SomeOtherEvent,
}
let reply = event_reply::<Event, u32, _>(None, |_| 10);
let mut buf = [0; 32];
let serialised = postcard::to_slice(&reply, &mut buf).unwrap();
assert_eq!(serialised, [0, 0, 0, 0, 0, 0, 0, 0]);
assert_eq!(
postcard::from_bytes::<EventReply<Event>>(serialised).unwrap(),
EventReply {
delta_ticks: 0,
event: None,
}
);
} | rust_cleaned_test_functions.jsonl/65560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6748,
25602,
7923,
6615,
6536,
36664,
19691,
368,
341,
286,
11506,
27098,
65297,
11,
11091,
11,
48440,
11,
55039,
11,
39900,
5563,
286,
7618,
3665,
341,
310,
4329,
1556,
345,
310,
4329,
11409,
155... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_array_fmt_debug() {
let values: [u8; 15] = *b"hellotherearrow";
let array_data = ArrayData::builder(DataType::FixedSizeBinary(5))
.len(3)
.add_buffer(Buffer::from(&values[..]))
.build();
let arr = FixedSizeBinaryArray::from(array_data);
assert_eq!(
"FixedSizeBinaryArray<5>\n[\n [104, 101, 108, 108, 111],\n [116, 104, 101, 114, 101],\n [97, 114, 114, 111, 119],\n]",
format!("{:?}", arr)
);
} | rust_cleaned_test_functions.jsonl/11629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
3858,
38128,
15446,
368,
341,
286,
1077,
2750,
25,
508,
84,
23,
26,
220,
16,
20,
60,
284,
353,
65,
1,
14990,
18532,
6044,
3302,
286,
1077,
1334,
1769,
284,
2910,
1043,
486,
17850,
63941... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_events_idle() {
let mut events = EventQueue::existing(std::iter::empty()).expect("failed to create Events");
assert_eq!(events.pop_front(), Some(fidl_interfaces::Event::Idle(fidl_interfaces::Empty)));
assert_eq!(events.pop_front(), None);
} | rust_cleaned_test_functions.jsonl/39896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19691,
47810,
368,
341,
286,
1077,
5206,
4357,
284,
3665,
7554,
486,
36895,
5194,
486,
2015,
486,
3194,
6011,
17119,
445,
16091,
311,
1855,
17627,
797,
286,
2060,
10714,
10297,
12389,
8288,
22926,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_enum() {
let mut decoder = Decoder::new(from_str("\"Dog\"").unwrap());
let value: Animal = Decodable::decode(&mut decoder).unwrap();
assert_eq!(value, Dog);
let s = "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}";
let mut decoder = Decoder::new(from_str(s).unwrap());
let value: Animal = Decodable::decode(&mut decoder).unwrap();
assert_eq!(value, Frog("Henry".to_owned(), 349));
} | rust_cleaned_test_functions.jsonl/111035 | {
"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,
15227,
31054,
368,
341,
286,
1077,
5206,
24551,
284,
50472,
486,
931,
17016,
2895,
38915,
48940,
2105,
1827,
15454,
1423,
286,
1077,
897,
25,
21292,
284,
3714,
69129,
486,
18196,
2099,
6984,
24551,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_top_k_frequent() {
assert_eq!(
sorted(Solution::top_k_frequent(vec![1, 1, 1, 2, 2, 3], 2)),
vec![1, 2]
);
assert_eq!(Solution::top_k_frequent(vec![1], 1), vec![1]);
} | rust_cleaned_test_functions.jsonl/117117 | {
"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,
10426,
4698,
761,
69691,
368,
341,
286,
2060,
10714,
33673,
310,
10615,
3759,
3214,
486,
3481,
4698,
761,
69691,
25592,
20703,
16,
11,
220,
16,
11,
220,
16,
11,
220,
17,
11,
220,
17,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_color_from_hex_rgba() {
assert_eq!(Color::from(0x00000000), Color::from((0.0, 0.0, 0.0, 0.0)));
assert_eq!(Color::from(0xFF00FFFF), Color::from((1.0, 0.0, 1.0, 1.0)));
assert_eq!(Color::from(0xFFFFFFFF), Color::from((1.0, 1.0, 1.0, 1.0)));
assert_eq!(Color::from(0xFFFF00FF), Color::from((1.0, 1.0, 0.0, 1.0)));
assert_eq!(Color::from(0xFFFF0000), Color::from((1.0, 1.0, 0.0, 0.0)));
assert_eq!(Color::from(0xFF000000), Color::from((1.0, 0.0, 0.0, 0.0)));
assert_eq!(Color::from(0x000000FF), Color::from((0.0, 0.0, 0.0, 1.0)));
} | rust_cleaned_test_functions.jsonl/57744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
5673,
32655,
95229,
368,
341,
286,
2060,
10714,
10297,
1636,
486,
1499,
7,
15,
87,
15,
15,
15,
15,
15,
15,
15,
15,
701,
3478,
486,
1499,
1188,
15,
13,
15,
11,
220,
15,
13,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_map() {
let res = StructWithMap::parse(INPUT_16);
assert_eq!(
res,
Ok((
&INPUT_16[5..],
StructWithMap {
a: 1,
int_str: "18".to_string()
}
))
);
} | rust_cleaned_test_functions.jsonl/48209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
5376,
368,
341,
262,
1077,
592,
284,
16139,
2354,
2227,
486,
6400,
57911,
62,
16,
21,
317,
262,
2060,
10714,
33673,
286,
592,
345,
286,
7622,
94702,
310,
609,
29421,
62,
16,
21,
58,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_show_compilation_errors() {
let _pool = ConstPool::new();
let text = r"
script {
fun main() {
let _ = 0x0::Transaction::sender();
}
}";
let errors = execute_script(
MoveFile::with_content(script_path(), text),
vec![],
"libra",
"0x1111111111111111",
vec![],
)
.unwrap_err()
.downcast::<CompilerError>()
.unwrap()
.errors;
assert_eq!(errors.len(), 1);
assert_eq!(errors[0][0].1, "Unbound module \'0x0::Transaction\'");
} | rust_cleaned_test_functions.jsonl/43913 | {
"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,
15267,
18177,
13455,
20196,
368,
341,
262,
1077,
716,
10285,
284,
24522,
10551,
486,
931,
1428,
262,
1077,
1467,
284,
435,
698,
2282,
341,
262,
2464,
1887,
368,
341,
286,
1077,
716,
284,
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_parse_ok() {
let mi = MetaItem {
name: Symbol::intern("all"),
node: MetaItemKind::Word,
span: DUMMY_SP,
};
assert_eq!(Cfg::parse(&mi), Ok(word_cfg("all")));
let mi = MetaItem {
name: Symbol::intern("all"),
node: MetaItemKind::NameValue(dummy_spanned(LitKind::Str(
Symbol::intern("done"),
StrStyle::Cooked,
))),
span: DUMMY_SP,
};
assert_eq!(Cfg::parse(&mi), Ok(name_value_cfg("all", "done")));
let mi = MetaItem {
name: Symbol::intern("all"),
node: MetaItemKind::List(vec![
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("a"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("b"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
]),
span: DUMMY_SP,
};
assert_eq!(Cfg::parse(&mi), Ok(word_cfg("a") & word_cfg("b")));
let mi = MetaItem {
name: Symbol::intern("any"),
node: MetaItemKind::List(vec![
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("a"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("b"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
]),
span: DUMMY_SP,
};
assert_eq!(Cfg::parse(&mi), Ok(word_cfg("a") | word_cfg("b")));
let mi = MetaItem {
name: Symbol::intern("not"),
node: MetaItemKind::List(vec![
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("a"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
]),
span: DUMMY_SP,
};
assert_eq!(Cfg::parse(&mi), Ok(!word_cfg("a")));
let mi = MetaItem {
name: Symbol::intern("not"),
node: MetaItemKind::List(vec![
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("any"),
node: MetaItemKind::List(vec![
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("a"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("all"),
node: MetaItemKind::List(vec![
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("b"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("c"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
]),
span: DUMMY_SP,
})),
]),
span: DUMMY_SP,
})),
]),
span: DUMMY_SP,
};
assert_eq!(Cfg::parse(&mi), Ok(!(word_cfg("a") | (word_cfg("b") & word_cfg("c")))));
let mi = MetaItem {
name: Symbol::intern("all"),
node: MetaItemKind::List(vec![
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("a"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("b"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
dummy_spanned(NestedMetaItemKind::MetaItem(MetaItem {
name: Symbol::intern("c"),
node: MetaItemKind::Word,
span: DUMMY_SP,
})),
]),
span: DUMMY_SP,
};
assert_eq!(Cfg::parse(&mi), Ok(word_cfg("a") & word_cfg("b") & word_cfg("c")));
} | rust_cleaned_test_functions.jsonl/57875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3069
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
19817,
368,
341,
286,
1077,
9497,
284,
15819,
1234,
341,
310,
829,
25,
19612,
486,
55444,
445,
541,
4461,
310,
2436,
25,
15819,
1234,
10629,
486,
10879,
345,
310,
9390,
25,
422,
58673,
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_used_in_while_expr() {
check_assist(
inline_local_variable,
"
fn foo() {
let a<|> = 1 > 0;
while a {}
}",
"
fn foo() {
<|>while 1 > 0 {}
}",
);
} | rust_cleaned_test_functions.jsonl/60331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27803,
1243,
86069,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
264,
27,
91,
29,
284,
220,
16,
861,
220,
15,
280,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_banmen_to_sfen() {
let input_and_expected:Vec<(Banmen,Result<String,TypeConvertError<String>>)> = vec![
(Banmen([
[GKyouN,GKeiN,GGinN,GKin,GOu,GKin,GGin,GKei,GKyou],
[Blank,GHishaN,Blank,Blank,Blank,Blank,Blank,GKakuN,Blank],
[GFuN,GFuN,GFuN,GFuN,GFuN,GFu,GFu,GFu,GFu],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SFu,SFu,SFu,SFu,SFuN,SFuN,SFuN,SFuN,SFuN],
[Blank,SKaku,Blank,Blank,Blank,Blank,Blank,SHisha,Blank],
[SKyou,SKei,SGin,SKin,SOu,SKin,SGinN,SKeiN,SKyouN]
]),Ok(String::from("+l+n+sgkgsnl/1+r5+b1/+p+p+p+p+ppppp/9/9/9/PPPP+P+P+P+P+P/1B5R1/LNSGKG+S+N+L"))),
(Banmen([
[GKyouN,GKeiN,GGinN,GKin,GOu,GKin,GGin,GKei,GKyou],
[Blank,GHisha,Blank,Blank,Blank,Blank,Blank,GKaku,Blank],
[GFuN,GFuN,GFuN,GFuN,GFuN,GFu,GFu,GFu,GFu],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SFu,SFu,SFu,SFu,SFuN,SFuN,SFuN,SFuN,SFuN],
[Blank,SKakuN,Blank,Blank,Blank,Blank,Blank,SHishaN,Blank],
[SKyou,SKei,SGin,SKin,SOu,SKin,SGinN,SKeiN,SKyouN]
]),Ok(String::from("+l+n+sgkgsnl/1r5b1/+p+p+p+p+ppppp/9/9/9/PPPP+P+P+P+P+P/1+B5+R1/LNSGKG+S+N+L"))),
(Banmen([
[GFu,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,GFu,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,GFu,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,GFu,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,GFu,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,GFu,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,GFu,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,GFu,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,GFu]
]),Ok(String::from("p8/1p7/2p6/3p5/4p4/5p3/6p2/7p1/8p"))),
];
for (i,r) in input_and_expected.into_iter() {
assert_eq!(i.to_sfen(),r);
}
} | rust_cleaned_test_functions.jsonl/46539 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
276,
5676,
2346,
643,
30353,
368,
972,
10217,
1946,
8378,
32190,
25,
10050,
28706,
50241,
5676,
11,
2077,
3464,
11,
929,
12012,
1454,
3464,
2452,
16018,
284,
7486,
20703,
319,
197,
197,
5349,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cp_arg_interactive() {
new_ucmd!()
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE)
.arg("-i")
.pipe_in("N\n")
.succeeds()
.stderr_contains("Not overwriting");
} | rust_cleaned_test_functions.jsonl/21240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
6057,
15318,
3028,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
50320,
69235,
1593,
38913,
25430,
340,
286,
659,
858,
50320,
2039,
3307,
1566,
787,
10626,
11922,
25430,
340,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_programs() {
parse(include_str!("../../../../test-files/classes.lox"));
parse(include_str!("../../../../test-files/counter.lox"));
parse(include_str!("../../../../test-files/fib.lox"));
parse(include_str!("../../../../test-files/fizzbuzz1.lox"));
parse(include_str!("../../../../test-files/fizzbuzz2.lox"));
parse(include_str!("../../../../test-files/forloop.lox"));
parse(include_str!("../../../../test-files/fun-expressions.lox"));
parse(include_str!("../../../../test-files/fun.lox"));
parse(include_str!("../../../../test-files/linked-list.lox"));
} | rust_cleaned_test_functions.jsonl/31464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
82,
368,
341,
75115,
77863,
2895,
17223,
84257,
1944,
46048,
47058,
43749,
87,
4010,
75115,
77863,
2895,
17223,
84257,
1944,
46048,
14,
8292,
43749,
87,
4010,
75115,
77863,
2895,
17223,
84257,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_outcome_one_vote_player() {
let uuid = UUID::random();
let state = TallyingState::new(
vec![(VoteTarget::Player { uuid }, vec![uuid])]
.into_iter()
.collect(),
);
assert_eq!(
state.determine_outcome_of_election(),
VoteOutcome::Player { uuid }
);
} | rust_cleaned_test_functions.jsonl/58282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
6068,
2020,
11667,
54360,
15524,
368,
341,
262,
1077,
16040,
284,
23698,
486,
11463,
543,
262,
1077,
1584,
284,
350,
745,
287,
1397,
486,
931,
1006,
414,
7486,
0,
9697,
41412,
6397,
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_prelude() {
let _ = ::env_logger::try_init();
let vm = make_vm();
run_expr::<OpaqueValue<&Thread, Hole>>(&vm, r#" import! std.prelude "#);
} | rust_cleaned_test_functions.jsonl/8950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
85068,
368,
341,
262,
1077,
716,
284,
3504,
3160,
27413,
486,
1539,
6137,
543,
262,
1077,
10995,
284,
1281,
39008,
543,
262,
1598,
21915,
27638,
69398,
1130,
52244,
6855,
11,
50929,
2452,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_struct_with_maps_roundtrip() {
let map_struct = StructWithMaps {
num_map: vec![(1, 1), (2, u64::max_value())].into_iter().collect(),
string_map: vec![(1, String::from("abc")), (2, String::from("def"))]
.into_iter()
.collect(),
bytes_map: vec![(1, vec![1, 2, 3]), (2, vec![3, 4, 5])]
.into_iter()
.collect(),
point_map: vec![(1, Point { x: 1, y: 2 }), (2, Point { x: 3, y: 4 })]
.into_iter()
.collect(),
key_string_map: vec![
(String::from("abc"), 0),
(String::from("def"), u64::max_value()),
]
.into_iter()
.collect(),
};
let map_struct_pb = map_struct.to_pb();
let struct_convert_round_trip: StructWithMaps =
ProtobufConvert::from_pb(map_struct_pb).unwrap();
assert_eq!(struct_convert_round_trip, map_struct);
let bytes = map_struct.to_bytes();
let struct_encode_round_trip = StructWithMaps::from_bytes(Cow::from(&bytes)).unwrap();
assert_eq!(struct_encode_round_trip, map_struct);
} | rust_cleaned_test_functions.jsonl/15770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
6615,
46512,
29896,
32981,
368,
341,
262,
1077,
2415,
15126,
284,
16139,
2354,
36562,
341,
286,
1629,
5376,
25,
7486,
0,
9697,
16,
11,
220,
16,
701,
320,
17,
11,
575,
21,
19,
486,
2810,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_downsampler_with_data_gap() {
// output samples between 200ms and 550ms.
let duration_micros = 1_000_000;
let raw_interval_micros = 10_000;
let downsampling_interval_micros = 100_000;
let raw_data_gap_micros = [230_000, 440_000];
let mut downsampler = Downsampler::new(downsampling_interval_micros);
let mut t_micros = 0;
let mut records_out = Vec::new();
while t_micros <= duration_micros {
if t_micros < raw_data_gap_micros[0] || t_micros > raw_data_gap_micros[1] {
let record = ZedmonRecord {
timestamp_micros: t_micros,
shunt_voltage: 1.0,
bus_voltage: 1.0,
power: 1.0,
};
match downsampler.process(record) {
Some(r) => records_out.push(r),
None => {}
}
}
t_micros += raw_interval_micros;
}
let timestamps: Vec<u64> = records_out.into_iter().map(|r| r.timestamp_micros).collect();
assert_eq!(timestamps, vec![100_000, 200_000, 550_000, 650_000, 750_000, 850_000, 950_000]);
} | rust_cleaned_test_functions.jsonl/90587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 688
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13998,
82,
34501,
6615,
1769,
51790,
368,
341,
73363,
286,
442,
2550,
10469,
1948,
220,
17,
15,
15,
1011,
323,
220,
20,
20,
15,
1011,
624,
286,
1077,
8090,
73003,
82,
284,
220,
16,
62,
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... | 5 |
#[test]
fn test_der_set_defined() {
let empty = &b""[..];
let bytes = [
0x31, 0x0a, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x03, 0x01, 0x00, 0x00,
];
let expected = DerObject::from_set(vec![
DerObject::from_int_slice(b"\x01\x00\x01"),
DerObject::from_int_slice(b"\x01\x00\x00"),
]);
fn parser(i: &[u8]) -> DerResult {
parse_der_set_defined(
// to a list
map(tuple((parse_der_integer, parse_der_integer)), |(a, b)| {
vec![a, b]
}),
)(i)
}
assert_eq!(parser(&bytes), Ok((empty, expected)));
} | rust_cleaned_test_functions.jsonl/45873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
2602,
52870,
368,
341,
262,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
262,
1077,
5820,
284,
2278,
286,
220,
15,
87,
18,
16,
11,
220,
15,
87,
15,
64,
11,
220,
15,
87,
15,
17,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_loading_defaults() {
let manager = ConfigManager::default();
assert_eq!(manager.configs.len(), 3);
let key = SyntaxDefinition::Yaml.into();
assert!(manager.configs.contains_key(&key));
let yaml = manager.configs.get(&key).unwrap();
assert_eq!(yaml.cache.get("tab_size"), Some(&json!(2)));
} | rust_cleaned_test_functions.jsonl/40014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57726,
42290,
368,
341,
286,
1077,
6645,
284,
5532,
2043,
486,
2258,
543,
286,
2060,
10714,
10297,
13297,
5423,
82,
19406,
1507,
220,
18,
317,
286,
1077,
1376,
284,
32117,
10398,
486,
56,
9467,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signature() {
let mut rng = XorShiftRng::from_seed([1, 2, 3, 4]);
let mut random_msg = |len| rng.gen_iter::<u8>().take(len).collect::<Vec<_>>();
let (pk, serialized_pk) = gen_private_key_and_its_be_bytes();
let pubkey = public_key_from_private(&pk);
for msg_len in &[0, 2, 4, 5, 32, 128] {
let msg = random_msg(*msg_len);
let wasm_signature = sign_musig(&serialized_pk, &msg);
let wasm_unpacked_signature = TxSignature::deserialize_from_packed_bytes(&wasm_signature)
.expect("failed to unpack signature");
let signer_pubkey = wasm_unpacked_signature.verify_musig(&msg);
assert_eq!(
signer_pubkey.map(|pk| pk.0.into_xy()),
Some(pubkey.0.into_xy()),
"msg_len: {}, msg_hex: {}, wasm_signature_hex:{}",
msg_len,
hex::encode(&msg),
hex::encode(&wasm_signature)
);
}
} | rust_cleaned_test_functions.jsonl/114192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
368,
341,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
2558,
262,
1077,
5206,
4194,
6483,
284,
760,
2892,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_init_can_be_called_with_no_pool_config() {
init!("false");
wallet::close_wallet().unwrap();
let content = json!({
"wallet_name": settings::DEFAULT_WALLET_NAME,
"wallet_key": settings::DEFAULT_WALLET_KEY
}).to_string();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
// assert that pool was never initialized
assert!(get_pool_handle().is_err());
} | rust_cleaned_test_functions.jsonl/127529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
27421,
21263,
27859,
6615,
6536,
15709,
5332,
368,
341,
286,
2930,
17223,
3849,
797,
286,
15085,
486,
5552,
62308,
1005,
15454,
1428,
286,
1077,
2213,
284,
2951,
0,
2262,
310,
330,
35735,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.