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_json_array() {
let cases = vec![
(vec![], Some(r#"[]"#)),
(vec![Some(r#"1"#), None], Some(r#"[1, null]"#)),
(
vec![
Some(r#"1"#),
None,
Some(r#"2"#),
Some(r#""sdf""#),
Some(r#""k1""#),
Some(r#""v1""#),
],
Some(r#"[1, null, 2, "sdf", "k1", "v1"]"#),
),
];
for (vargs, expected) in cases {
let vargs = vargs
.into_iter()
.map(|input| input.map(|s| Json::from_str(s).unwrap()))
.collect::<Vec<_>>();
let expected = expected.map(|s| Json::from_str(s).unwrap());
let output = RpnFnScalarEvaluator::new()
.push_params(vargs.clone())
.evaluate(ScalarFuncSig::JsonArraySig)
.unwrap();
assert_eq!(output, expected, "{:?}", vargs);
}
} | rust_cleaned_test_functions.jsonl/60595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 689
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
3858,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
4083,
0,
12995,
4329,
2601,
55543,
33325,
2,
6965,
310,
320,
4083,
20703,
8373,
2601,
55543,
16,
57676,
701,
2240,
1125,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_arch_arm_detail() {
use arch::arm::ArmOperandType::*;
use arch::arm::*;
use capstone_sys::arm_op_mem;
let r0_op = ArmOperand {
op_type: Reg(RegId(ArmReg::ARM_REG_R0 as RegIdInt)),
..Default::default()
};
test_arch_mode_endian_insns_detail(
&mut Capstone::new()
.arm()
.mode(arm::ArchMode::Arm)
.build()
.unwrap(),
Arch::ARM,
Mode::Arm,
Some(Endian::Little),
&[],
&[
// bl #0xfbc
DII::new(
"bl",
b"\xed\xff\xff\xeb",
&[ArmOperand {
op_type: Imm(0xfbc),
..Default::default()
}],
),
DII::new(
"str",
b"\x04\xe0\x2d\xe5",
&[
ArmOperand {
op_type: Reg(RegId(ArmReg::ARM_REG_LR as RegIdInt)),
..Default::default()
},
ArmOperand {
op_type: Mem(ArmOpMem(arm_op_mem {
base: ArmReg::ARM_REG_SP,
index: 0,
scale: 1,
disp: -4,
lshift: 0,
})),
..Default::default()
},
],
),
DII::new(
"andeq",
b"\x00\x00\x00\x00",
&[r0_op.clone(), r0_op.clone(), r0_op.clone()],
),
DII::new(
"str",
b"\xe0\x83\x22\xe5",
&[
ArmOperand {
op_type: Reg(RegId(ArmReg::ARM_REG_R8 as RegIdInt)),
..Default::default()
},
ArmOperand {
op_type: Mem(ArmOpMem(arm_op_mem {
base: ArmReg::ARM_REG_R2,
index: 0,
scale: 1,
disp: -992,
lshift: 0,
})),
..Default::default()
},
],
),
DII::new(
"mcreq",
b"\xf1\x02\x03\x0e",
&[
ArmOperand {
op_type: Pimm(2),
..Default::default()
},
ArmOperand {
op_type: Imm(0),
..Default::default()
},
r0_op.clone(),
ArmOperand {
op_type: Cimm(3),
..Default::default()
},
ArmOperand {
op_type: Cimm(1),
..Default::default()
},
ArmOperand {
op_type: Imm(7),
..Default::default()
},
],
),
DII::new(
"mov",
b"\x00\x00\xa0\xe3",
&[
r0_op.clone(),
ArmOperand {
op_type: Imm(0),
..Default::default()
},
],
),
],
);
test_arch_mode_endian_insns_detail(
&mut Capstone::new()
.arm()
.mode(arm::ArchMode::Thumb)
.build()
.unwrap(),
Arch::ARM,
Mode::Thumb,
None,
&[],
&[DII::new(
"bx",
b"\x70\x47",
&[ArmOperand {
op_type: Reg(RegId(ArmReg::ARM_REG_LR as RegIdInt)),
..Default::default()
}],
)],
);
} | rust_cleaned_test_functions.jsonl/127431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3006
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34330,
34680,
14480,
368,
341,
262,
990,
5325,
486,
2178,
486,
32913,
29940,
929,
56162,
262,
990,
5325,
486,
2178,
56162,
262,
990,
2062,
10812,
20344,
486,
2178,
10287,
12976,
401,
262,
1077,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_image_parse_registry_port() {
assert_eq!(
ImageRef::parse("example.com:1234/foo"),
ImageRef {
registry: Some("example.com:1234".into()),
image: "foo".into(),
tag: None,
hash: None
}
);
assert_eq!(
ImageRef::parse("example.com:1234/foo:bar"),
ImageRef {
registry: Some("example.com:1234".into()),
image: "foo".into(),
tag: Some("bar".into()),
hash: None
}
);
assert_eq!(
ImageRef::parse("example.com:1234/foo/bar"),
ImageRef {
registry: Some("example.com:1234".into()),
image: "foo/bar".into(),
tag: None,
hash: None
}
);
assert_eq!(
ImageRef::parse("example.com:1234/foo/bar:baz"),
ImageRef {
registry: Some("example.com:1234".into()),
image: "foo/bar".into(),
tag: Some("baz".into()),
hash: None
}
);
// nested images
assert_eq!(
ImageRef::parse("example.com:1234/foo/bar/baz:qux"),
ImageRef {
registry: Some("example.com:1234".into()),
image: "foo/bar/baz".into(),
tag: Some("qux".into()),
hash: None
}
);
} | rust_cleaned_test_functions.jsonl/17932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
21039,
50650,
8716,
368,
341,
262,
2060,
10714,
33673,
414,
4654,
3945,
486,
6400,
445,
8687,
905,
25,
16,
17,
18,
19,
60555,
4461,
414,
4654,
3945,
341,
286,
19424,
25,
4329,
445,
8687,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stack_guard() {
let engine = TestEngineBuilder::new().build().unwrap();
let read_pool = build_read_pool_for_test(engine.clone());
let cop = Endpoint::<RocksEngine>::new(
&Config {
end_point_recursion_limit: 5,
..Config::default()
},
read_pool,
);
let req = {
let mut expr = Expr::default();
for _ in 0..10 {
let mut e = Expr::default();
e.mut_children().push(expr);
expr = e;
}
let mut e = Executor::default();
e.mut_selection().mut_conditions().push(expr);
let mut dag = DAGRequest::default();
dag.mut_executors().push(e);
let mut req = coppb::Request::default();
req.set_tp(REQ_TYPE_DAG);
req.set_data(dag.write_to_bytes().unwrap());
req
};
let resp: coppb::Response = cop
.parse_and_handle_unary_request(req, None)
.wait()
.unwrap();
assert!(!resp.get_other_error().is_empty());
} | rust_cleaned_test_functions.jsonl/40856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 629
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
36796,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
1349,
15709,
284,
1936,
6443,
15709,
5478,
4452,
48974,
15997,
1423,
286,
1077,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_dictionary_key() {
assert::pass(
r#"
x = {0: 123}
assert_eq(x[0], 123)
assert_eq(x[0.0], 123)
assert_eq(x[-0.0], 123)
assert_eq(1 in x, False)
"#,
);
} | rust_cleaned_test_functions.jsonl/114098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42605,
3097,
368,
341,
286,
2060,
486,
6385,
1006,
310,
435,
2,
698,
87,
284,
314,
15,
25,
220,
16,
17,
18,
532,
2207,
10714,
2075,
58,
15,
1125,
220,
16,
17,
18,
340,
2207,
10714,
2075,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_supplies_buy_food_insufficient() {
let mut supplies = Supplies::new();
let reason = supplies.buy_food(1000).unwrap_err().reason;
assert_eq!(BuyErrorType::InsufficientFunds, reason);
assert_eq!(700, supplies.money);
assert_eq!(0, supplies.food);
} | rust_cleaned_test_functions.jsonl/28661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
7202,
46348,
58580,
34386,
26683,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
1077,
2874,
284,
16720,
63871,
58580,
7,
16,
15,
15,
15,
568,
15454,
9266,
1005,
19895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_host_off_no_viewer_count() {
let src = ":tmi.twitch.tv HOSTTARGET #randers :- -";
let irc_message = IRCMessage::parse(src).unwrap();
let msg = HostTargetMessage::try_from(irc_message.clone()).unwrap();
assert_eq!(
msg,
HostTargetMessage {
channel_login: "randers".to_owned(),
action: HostTargetAction::HostModeOff { viewer_count: None },
source: irc_message
}
);
} | rust_cleaned_test_functions.jsonl/1052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
13651,
6536,
80344,
3180,
368,
341,
286,
1077,
2286,
284,
13022,
83,
8155,
90179,
14485,
44578,
45583,
671,
11335,
388,
20955,
481,
876,
286,
1077,
79923,
6462,
284,
59328,
2052,
486,
6400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mode_order() {
assert!(Numeric < Alphanumeric);
assert!(Byte > Kanji);
assert!(!(Numeric < Kanji));
assert!(!(Numeric >= Kanji));
} | rust_cleaned_test_functions.jsonl/64977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7302,
7869,
368,
341,
286,
2060,
10297,
36296,
366,
1674,
65788,
317,
286,
2060,
10297,
7153,
861,
30563,
7754,
317,
286,
2060,
0,
33660,
36296,
366,
30563,
7754,
1106,
286,
2060,
0,
33660,
36296,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pwm_circuit() {
let mut uut = PWMTest::default();
uut.clock.connect();
uut.connect_all();
yosys_validate("pwm", &generate_verilog(&uut)).unwrap();
let mut sim = Simulation::new();
sim.add_clock(5, |x: &mut Box<PWMTest>| x.clock.next = !x.clock.val());
sim.add_testbench(|mut sim: Sim<PWMTest>| {
let mut x = sim.init()?;
let mut accum = 0;
for _ndx in 0..256 {
x = sim.wait(10, x)?;
if x.pwm.active.val() {
accum += 1;
}
}
sim.done(x)?;
assert_eq!(accum, 32);
Ok(())
});
sim.run_traced(
Box::new(uut),
512 * 10,
File::create(vcd_path!("pwm.vcd")).unwrap(),
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/6231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70985,
666,
37268,
368,
341,
262,
1077,
5206,
575,
332,
284,
36034,
2271,
486,
2258,
543,
262,
575,
332,
50546,
10800,
543,
262,
575,
332,
10800,
5705,
543,
262,
379,
436,
1047,
42681,
445,
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... | 6 |
#[test]
fn test_merge() -> Result<(), IndexError> {
let mut x: MyVec<usize> = MyVec::new();
for i in &[1, 3, 5, 6, 8, 10] {
x.push(*i)
}
let mut y: MyVec<usize> = MyVec::new();
for i in &[2, 4, 6, 7, 9, 11] {
y.push(*i)
}
let z = x.merge(y);
assert_eq!(*z, *vec![1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11]);
Ok(())
} | rust_cleaned_test_functions.jsonl/24015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
368,
1464,
5714,
68843,
60203,
29,
341,
262,
1077,
5206,
856,
25,
3017,
10050,
90244,
29,
284,
3017,
10050,
486,
931,
543,
262,
369,
600,
304,
44590,
16,
11,
220,
18,
11,
220,
20,
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... | 3 |
#[test]
fn test_mcg128xsl64_serde() {
use bincode;
use std::io::{BufWriter, BufReader};
let mut rng = Mcg128Xsl64::seed_from_u64(0);
let buf: Vec<u8> = Vec::new();
let mut buf = BufWriter::new(buf);
bincode::serialize_into(&mut buf, &rng).expect("Could not serialize");
let buf = buf.into_inner().unwrap();
let mut read = BufReader::new(&buf[..]);
let mut deserialized: Mcg128Xsl64 = bincode::deserialize_from(&mut read)
.expect("Could not deserialize");
for _ in 0..16 {
assert_eq!(rng.next_u64(), deserialized.next_u64());
}
} | rust_cleaned_test_functions.jsonl/52976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
27446,
16,
17,
23,
87,
3226,
21,
19,
75861,
450,
368,
341,
262,
990,
9544,
1851,
280,
262,
990,
1460,
486,
815,
22964,
15064,
6492,
11,
69013,
5062,
2315,
262,
1077,
5206,
28422,
284,
448... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uint_div_no_panic() {
assert_eq!(Uint256::from(6) / Uint256::from(2), Uint256::from(3));
} | rust_cleaned_test_functions.jsonl/47738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
16237,
6536,
620,
31270,
368,
341,
286,
2060,
10714,
10297,
21570,
17,
20,
21,
486,
1499,
7,
21,
8,
608,
27883,
17,
20,
21,
486,
1499,
7,
17,
701,
27883,
17,
20,
21,
486,
1499,
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 |
#[test]
fn test_map_ex_axis() {
let x = ndarray::array![[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]].into_ndarray();
let y = map_ex_axis(&x, Axis(1), |x| x.mean().unwrap());
assert_eq!(y, ndarray::array![2.5, 3.5, 4.5]);
} | rust_cleaned_test_functions.jsonl/114645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
2702,
23567,
368,
341,
262,
1077,
856,
284,
66883,
486,
1653,
0,
15505,
58,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
1125,
508,
19,
13,
15,
11,
220,
20,
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_from_celestrak_omm() -> Result<()> {
let elements: Elements = serde_json::from_str(
r#"{
"OBJECT_NAME": "ISS (ZARYA)",
"OBJECT_ID": "1998-067A",
"EPOCH": "2020-07-12T01:19:07.402656",
"MEAN_MOTION": 15.49560532,
"ECCENTRICITY": 0.0001771,
"INCLINATION": 51.6435,
"RA_OF_ASC_NODE": 225.4004,
"ARG_OF_PERICENTER": 44.9625,
"MEAN_ANOMALY": 5.1087,
"EPHEMERIS_TYPE": 0,
"CLASSIFICATION_TYPE": "U",
"NORAD_CAT_ID": 25544,
"ELEMENT_SET_NO": 999,
"REV_AT_EPOCH": 23587,
"BSTAR": 0.0049645,
"MEAN_MOTION_DOT": 0.00289036,
"MEAN_MOTION_DDOT": 0
}"#,
)?;
match elements.object_name.as_ref() {
Some(object_name) => assert_eq!(object_name, "ISS (ZARYA)"),
None => panic!(),
}
assert_eq!(elements.norad_id, 25544);
assert!(matches!(
elements.classification,
Classification::Unclassified
));
assert_eq!(
elements.international_designator.as_ref().unwrap(),
"1998-067A"
);
assert_eq!(
elements.datetime,
chrono::NaiveDate::from_yo(2020, 194).and_time(
chrono::NaiveTime::from_num_seconds_from_midnight(4747, 402656000)
)
);
assert_eq_f64(elements.epoch(), 20.527186712635181);
assert_eq_f64(
elements.epoch_afspc_compatibility_mode(),
20.527186712635135,
);
assert_eq_f64(elements.mean_motion_dot, 0.00289036);
assert_eq_f64(elements.mean_motion_ddot, 0.0);
assert_eq_f64(elements.drag_term, 0.0049645);
assert_eq!(elements.ephemeris_type, 0);
assert_eq!(elements.element_set_number, 999);
assert_eq_f64(elements.inclination, 51.6435);
assert_eq_f64(elements.right_ascension, 225.4004);
assert_eq_f64(elements.eccentricity, 0.0001771);
assert_eq_f64(elements.argument_of_perigee, 44.9625);
assert_eq_f64(elements.mean_anomaly, 5.1087);
assert_eq_f64(elements.mean_motion, 15.49560532);
assert_eq!(elements.revolution_number, 23587);
Ok(())
} | rust_cleaned_test_functions.jsonl/74830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
50727,
273,
495,
585,
62,
19786,
368,
1464,
5714,
71698,
341,
286,
1077,
5424,
25,
34157,
284,
61570,
9455,
486,
1499,
2895,
1006,
310,
435,
55543,
515,
394,
330,
43847,
4708,
788,
330,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_string() {
assert_eq!(
apply(
r#"
"" +
"#
.trim()
),
Ok(vec![
Token::String(span(1, 1, "\"\"")),
Token::Symbol(span(1, 4, "+"))
])
)
} | rust_cleaned_test_functions.jsonl/27562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
3904,
368,
341,
286,
2060,
10714,
33673,
310,
3796,
1006,
394,
435,
2,
698,
3014,
3610,
1,
4956,
503,
659,
10666,
741,
310,
2837,
310,
7622,
25592,
90515,
394,
9660,
486,
703,
66092,
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_errors() {
let mut errs = OptParseErrors::new();
assert_eq!(errs.is_empty(), true);
assert_eq!(errs.len(), 0);
errs.push(OptParseError::invalid_option("--abc"));
errs.push(OptParseError::missing_option("--abc"));
#[cfg(feature = "option_argument")]
{
errs.push(OptParseError::invalid_option_argument(
"--abc",
"invalid float literal",
));
errs.push(OptParseError::unexpected_option_argument("--abc", "defg"));
errs.push(OptParseError::missing_option_argument("--abc"));
}
#[cfg(feature = "argument")]
{
errs.push(OptParseError::missing_argument("<input>"));
errs.push(OptParseError::unexpected_argument("xyz"));
}
#[cfg(feature = "subcommand")]
{
errs.push(OptParseError::invalid_subcommand("new"));
errs.push(OptParseError::missing_subcommand("<command>"));
}
#[cfg(feature = "ambiguous")]
errs.push(OptParseError::ambiguous_option("--abc", "abcd, abce"));
#[cfg(all(feature = "ambiguous", feature = "subcommand"))]
errs.push(OptParseError::ambiguous_subcommand(
"new",
"new-first, new-second",
));
assert_eq!(errs.is_empty(), false);
let len = 2;
#[cfg(feature = "option_argument")]
let len = len + 3;
#[cfg(feature = "argument")]
let len = len + 2;
#[cfg(feature = "ambiguous")]
let len = len + 1;
#[cfg(all(feature = "ambiguous", feature = "subcommand"))]
let len = len + 1;
#[cfg(feature = "subcommand")]
let len = len + 2;
assert_eq!(errs.len(), len);
let thing = format!("{}", errs);
let expect = concat!("Invalid option: --abc\n", "Missing option: --abc",);
#[cfg(feature = "option_argument")]
let expect = expect.to_string()
+ concat!(
"\n",
"Invalid option argument: --abc: invalid float literal\n",
"Unexpected option argument: --abc: defg\n",
"Missing option argument: --abc",
);
#[cfg(feature = "argument")]
let expect = expect.to_string()
+ concat!(
"\n",
"Missing argument: <input>\n",
"Unexpected argument: xyz",
);
#[cfg(feature = "subcommand")]
let expect = expect.to_string()
+ concat!(
"\n",
"Invalid subcommand: new\n",
"Missing subcommand: <command>",
);
#[cfg(feature = "ambiguous")]
let expect = expect.to_string() + concat!("\n", "Ambiguous option: --abc: abcd, abce",);
#[cfg(all(feature = "ambiguous", feature = "subcommand"))]
let expect =
expect.to_string() + concat!("\n", "Ambiguous subcommand: new: new-first, new-second",);
assert_eq!(thing, expect);
} | rust_cleaned_test_functions.jsonl/8282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20196,
368,
341,
286,
1077,
5206,
70817,
284,
16554,
14463,
13877,
486,
931,
543,
286,
2060,
10714,
10297,
84735,
2079,
15124,
1507,
830,
317,
286,
2060,
10714,
10297,
84735,
19406,
1507,
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_compiler_get_cached_or_compile_force_recache() {
drop(env_logger::try_init());
let creator = new_creator();
let f = TestFixture::new();
let pool = ThreadPool::sized(1);
let mut runtime = Runtime::new().unwrap();
let storage = DiskCache::new(&f.tempdir.path().join("cache"), u64::MAX, &pool);
let storage: Arc<dyn Storage> = Arc::new(storage);
// Pretend to be GCC.
next_command(&creator, Ok(MockChild::new(exit_status(0), "gcc", "")));
let c = get_compiler_info(
creator.clone(),
&f.bins[0],
f.tempdir.path(),
&[],
&pool,
None,
)
.wait()
.unwrap()
.0;
const COMPILER_STDOUT: &[u8] = b"compiler stdout";
const COMPILER_STDERR: &[u8] = b"compiler stderr";
// recaching.
let obj = f.tempdir.path().join("foo.o");
for _ in 0..2 {
// The preprocessor invocation.
next_command(
&creator,
Ok(MockChild::new(exit_status(0), "preprocessor output", "")),
);
// The compiler invocation.
let o = obj.clone();
next_command_calls(&creator, move |_| {
// Pretend to compile something.
let mut f = File::create(&o)?;
f.write_all(b"file contents")?;
Ok(MockChild::new(
exit_status(0),
COMPILER_STDOUT,
COMPILER_STDERR,
))
});
}
let cwd = f.tempdir.path();
let arguments = ovec!["-c", "foo.c", "-o", "foo.o"];
let hasher = match c.parse_arguments(&arguments, ".".as_ref()) {
CompilerArguments::Ok(h) => h,
o => panic!("Bad result from parse_arguments: {:?}", o),
};
let hasher2 = hasher.clone();
let (cached, res) = runtime
.block_on(future::lazy(|| {
hasher.get_cached_or_compile(
Ok(None),
creator.clone(),
storage.clone(),
arguments.clone(),
cwd.to_path_buf(),
vec![],
CacheControl::Default,
pool.clone(),
)
}))
.unwrap();
// Ensure that the object file was created.
assert!(fs::metadata(&obj).map(|m| m.len() > 0).unwrap());
match cached {
CompileResult::CacheMiss(MissType::Normal, DistType::NoDist, _, f) => {
// wait on cache write future so we don't race with it!
f.wait().unwrap();
}
_ => assert!(false, "Unexpected compile result: {:?}", cached),
}
assert_eq!(exit_status(0), res.status);
assert_eq!(COMPILER_STDOUT, res.stdout.as_slice());
assert_eq!(COMPILER_STDERR, res.stderr.as_slice());
fs::remove_file(&obj).unwrap();
let (cached, res) = hasher2
.get_cached_or_compile(
Ok(None),
creator,
storage,
arguments,
cwd.to_path_buf(),
vec![],
CacheControl::ForceRecache,
pool,
)
.wait()
.unwrap();
// Ensure that the object file was created.
assert!(fs::metadata(&obj).map(|m| m.len() > 0).unwrap());
match cached {
CompileResult::CacheMiss(MissType::ForcedRecache, DistType::NoDist, _, f) => {
// wait on cache write future so we don't race with it!
f.wait().unwrap();
}
_ => assert!(false, "Unexpected compile result: {:?}", cached),
}
assert_eq!(exit_status(0), res.status);
assert_eq!(COMPILER_STDOUT, res.stdout.as_slice());
assert_eq!(COMPILER_STDERR, res.stderr.as_slice());
} | rust_cleaned_test_functions.jsonl/61650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80910,
3062,
64369,
8734,
74170,
40739,
7080,
1777,
368,
341,
286,
5943,
16978,
27413,
486,
1539,
6137,
1423,
286,
1077,
19919,
284,
501,
68532,
543,
286,
1077,
282,
284,
3393,
18930,
486,
931,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_LDA_immediate_no_flag() {
// Load accumulator. Immediate addressing
let code = vec![0xA9, 0x36];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
assert_eq!(0x8000, nes.PC);
nes.next(&mut memory).unwrap();
assert_eq!(0x8002, nes.PC);
assert_eq!(0x36, nes.A);
} | rust_cleaned_test_functions.jsonl/38683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2351,
6352,
17895,
14636,
6536,
10933,
368,
341,
286,
442,
8893,
56312,
13,
80310,
27020,
198,
286,
1077,
2038,
284,
7486,
20703,
15,
14673,
24,
11,
220,
15,
87,
18,
21,
4821,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_mark_creation_time() {
let mut crds = Crds::default();
let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
let node_pubkey = entry.label().pubkey();
let mut node = CrdsGossipPull::default();
crds.insert(entry.clone(), 0).unwrap();
let old = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
crds.insert(old.clone(), 0).unwrap();
let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
crds.insert(new.clone(), 0).unwrap();
// set request creation time to max_value
node.mark_pull_request_creation_time(&new.label().pubkey(), u64::max_value());
for _ in 0..10 {
let req = node.new_pull_request(
&crds,
&node_pubkey,
0,
u64::max_value(),
&HashMap::new(),
PACKET_DATA_SIZE,
);
let (to, _, self_info) = req.unwrap();
assert_eq!(to, old.label().pubkey());
assert_eq!(self_info, entry);
}
} | rust_cleaned_test_functions.jsonl/45198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
18924,
46163,
3009,
368,
341,
286,
1077,
5206,
1560,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
4343,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
1731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get() {
let mut a = vec![11];
assert_eq!(a.get(1), None);
a = vec![11, 12];
assert_eq!(a.get(1).unwrap(), &12);
a = vec![11, 12, 13];
assert_eq!(a.get(1).unwrap(), &12);
} | rust_cleaned_test_functions.jsonl/12847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
262,
1077,
5206,
264,
284,
7486,
20703,
16,
16,
935,
262,
2060,
10714,
10297,
64,
670,
7,
16,
701,
2240,
317,
262,
264,
284,
7486,
20703,
16,
16,
11,
220,
16,
17,
935,
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_gltexture() {
let s = std::env::var("ASSETS").expect("$env::ASSETS is not ref to a minecraft version.jar");
let ifile = std::fs::File::open(s).unwrap();
let zip = std::rc::Rc::new(std::cell::RefCell::new(AssetsArchive::new(ifile).unwrap()));
let pvd = TextureImageProvider::from(zip.clone());
let evloop = glutin::EventsLoop::new();
let display = context::build_display((256, 256), &evloop, glutin::GlRequest::Specific(glutin::Api::OpenGl, (3, 3)));
let mut gen = CombinedTextureGen::new( &display, pvd );
for name in &["block/bricks", "block/oak_planks", "block/tripwire_hook"] {
println!("{:?}", gen.get(name));
}
let tex = gen.build(32, 32, glium::texture::MipmapsOption::AutoGeneratedMipmaps).unwrap();
println!("{:?}", tex);
#[derive(Copy, Clone)]
struct Vertex {
position: [f32; 2],
tex: [f32; 2],
tex_id: i32,
}
glium::implement_vertex!(Vertex, position, tex, tex_id);
// building the index buffer
let index_buffer = glium::IndexBuffer::new(&display, glium::index::PrimitiveType::TrianglesList,
&[0u16, 1, 2, 2, 1, 3]).unwrap();
// compiling shaders and linking them together
let program = glium::program!(&display,
330 => {
vertex: "
#version 330
uniform mat4 matrix;
in vec2 position;
in vec2 tex;
in int tex_id;
out vec3 v_tex;
void main() {
v_tex = vec3(tex.x, tex.y, float(tex_id));
gl_Position = matrix * vec4(position, 0.0, 1.0);
}
",
fragment: "
#version 330
uniform sampler2DArray tex;
in vec3 v_tex;
void main() {
gl_FragColor = texture(tex, v_tex);
}
"
},
).unwrap();
// drawing once
// building the uniforms
let uniforms = glium::uniform! {
matrix: [
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0f32]
],
tex: &tex
};
// drawing a frame
let mut target = display.draw();
target.clear_color(0.0, 0.0, 0.0, 0.0);
let dx = -0.4;
let dy = -0.4;
let tex_id = 0;
let vertex_buffer = glium::VertexBuffer::new(&display,
&[
Vertex { position: [-0.5 + dx, -0.5 + dy], tex: [0.0, 0.0], tex_id },
Vertex { position: [ 0.5 + dx, -0.5 + dy], tex: [0.0, 1.0], tex_id },
Vertex { position: [-0.5 + dx, 0.5 + dy], tex: [1.0, 0.0], tex_id },
Vertex { position: [ 0.5 + dx, 0.5 + dy], tex: [1.0, 1.0], tex_id },
]
)
.unwrap();
target.draw(&vertex_buffer, &index_buffer, &program, &uniforms, &Default::default()).unwrap();
let dx = 0.4;
let dy = 0.4;
let tex_id = 2;
let vertex_buffer = glium::VertexBuffer::new(&display,
&[
Vertex { position: [-0.5 + dx, -0.5 + dy], tex: [0.0, 0.0], tex_id },
Vertex { position: [ 0.5 + dx, -0.5 + dy], tex: [0.0, 1.0], tex_id },
Vertex { position: [-0.5 + dx, 0.5 + dy], tex: [1.0, 0.0], tex_id },
Vertex { position: [ 0.5 + dx, 0.5 + dy], tex: [1.0, 1.0], tex_id },
]
)
.unwrap();
target.draw(&vertex_buffer, &index_buffer, &program, &uniforms, &Default::default()).unwrap();
let dx = 0.4;
let dy = -0.4;
let tex_id = 1;
let vertex_buffer = glium::VertexBuffer::new(&display,
&[
Vertex { position: [-0.5 + dx, -0.5 + dy], tex: [0.0, 0.0], tex_id },
Vertex { position: [ 0.5 + dx, -0.5 + dy], tex: [0.0, 1.0], tex_id },
Vertex { position: [-0.5 + dx, 0.5 + dy], tex: [1.0, 0.0], tex_id },
Vertex { position: [ 0.5 + dx, 0.5 + dy], tex: [1.0, 1.0], tex_id },
]
)
.unwrap();
target.draw(&vertex_buffer, &index_buffer, &program, &uniforms, &Default::default()).unwrap();
let dx = -0.4;
let dy = 0.4;
let tex_id = 3;
let vertex_buffer = glium::VertexBuffer::new(&display,
&[
Vertex { position: [-0.5 + dx, -0.5 + dy], tex: [0.0, 0.0], tex_id },
Vertex { position: [ 0.5 + dx, -0.5 + dy], tex: [0.0, 1.0], tex_id },
Vertex { position: [-0.5 + dx, 0.5 + dy], tex: [1.0, 0.0], tex_id },
Vertex { position: [ 0.5 + dx, 0.5 + dy], tex: [1.0, 1.0], tex_id },
]
)
.unwrap();
target.draw(&vertex_buffer, &index_buffer, &program, &uniforms, &Default::default()).unwrap();
target.finish().unwrap();
// reading the front buffer into an image
let image: glium::texture::RawImage2d<u8> = display.read_front_buffer().unwrap();
let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap();
let image = image::DynamicImage::ImageRgba8(image).flipv();
image.save("../target/glium-test_texture.png").unwrap();
} | rust_cleaned_test_functions.jsonl/11280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2644
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34569,
27496,
368,
341,
262,
1077,
274,
284,
1460,
486,
3160,
486,
947,
445,
1911,
71793,
1827,
17119,
20912,
3160,
486,
1911,
71793,
374,
537,
2053,
311,
264,
73873,
2319,
27628,
797,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_subtraction() {
let subtractions = [
["10", "7", "3"],
[
"0",
"3618502788666131213697322783095070105623107215331596699973092056135872020480",
"1",
],
];
for item in subtractions.iter() {
assert_eq!(
FieldElement::from_dec_str(item[0]).unwrap()
- FieldElement::from_dec_str(item[1]).unwrap(),
FieldElement::from_dec_str(item[2]).unwrap()
);
}
} | rust_cleaned_test_functions.jsonl/128298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
26425,
368,
341,
286,
1077,
1186,
376,
4020,
284,
2278,
310,
4383,
16,
15,
497,
330,
22,
497,
330,
18,
8097,
310,
2278,
394,
330,
15,
756,
394,
330,
18,
21,
16,
23,
20,
15,
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... | 2 |
#[test]
fn test_readlink() {
let tempdir = tempfile::tempdir().unwrap();
let src = tempdir.path().join("a");
let dst = tempdir.path().join("b");
println!("a: {:?}, b: {:?}", &src, &dst);
fs::symlink(&src.as_path(), &dst.as_path()).unwrap();
let dirfd = open(tempdir.path(),
OFlag::empty(),
Mode::empty()).unwrap();
let expected_dir = src.to_str().unwrap();
assert_eq!(readlink(&dst).unwrap().to_str().unwrap(), expected_dir);
assert_eq!(readlinkat(dirfd, "b").unwrap().to_str().unwrap(), expected_dir);
} | rust_cleaned_test_functions.jsonl/91356 | {
"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,
6443,
2080,
368,
341,
262,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
2286,
284,
2730,
3741,
3875,
1005,
5987,
445,
64,
797,
262,
1077,
10648,
284,
2730,
3741,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_look_at_rh_no_displacement_or_rotation() {
let eye = Point3::new(0.0, 0.0, 0.0);
let target = Point3::new(0.0, 0.0, 1.0);
let up = Vector3::unit_y();
let look_at = Matrix4x4::look_at_rh(&eye, &target, &up);
let expected = Vector4::new(0.0, 0.0, 0.0, 1.0);
let result = look_at * eye.to_homogeneous();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24271,
3752,
1710,
71,
6536,
9932,
16101,
8734,
44813,
368,
341,
286,
1077,
7912,
284,
5126,
18,
486,
931,
7,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
317,
286,
1077,
2169,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concurrent_1() {
use std::thread::spawn;
let t: Vec<_> = (0..100)
.into_iter()
.map(|i| {
spawn(move || {
let a = STR_POOL.intern(i.to_string(), Arc::from);
let v: Vec<_> = (0..100)
.into_iter()
.map(|_| spawn(move || STR_POOL.intern(i.to_string(), Arc::from)))
.collect();
for b in v.into_iter() {
assert_eq!(a, b.join().unwrap());
}
})
})
.collect();
for r in t.into_iter() {
assert!(r.join().is_ok());
}
} | rust_cleaned_test_functions.jsonl/38597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 480
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3231,
62,
16,
368,
341,
286,
990,
1460,
486,
4528,
486,
46087,
401,
286,
1077,
259,
25,
11312,
32399,
29,
284,
320,
15,
496,
16,
15,
15,
340,
310,
659,
18122,
11723,
741,
310,
659,
218... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_update_edge_potential() {
let left_image = [[1, 1, 1].to_vec(), [1, 0, 1].to_vec(), [1, 1, 1].to_vec()].to_vec();
let right_image = [[1, 1, 1].to_vec(), [1, 0, 1].to_vec(), [1, 1, 1].to_vec()].to_vec();
let mut diffusion_graph = DiffusionGraph::initialize(left_image, right_image, 1, 1.);
diffusion_graph.potentials[0][0][2][0] = -0.3;
diffusion_graph.potentials[0][0][3][0] = 0.1;
diffusion_graph.potentials[2][1][0][0] = 0.8;
diffusion_graph.potentials[2][1][2][0] = -0.62;
assert_eq!(0., diffusion_graph.dummy_potentials[0][0][2][0]);
diffusion_graph.update_edge_potential(0, 0, 2, 0);
assert_eq!(true, approx_equal(diffusion_graph.dummy_potentials[0][0][2][0], 0.1, 1E-6));
diffusion_graph.update_edge_potential(1, 1, 0, 0);
assert_eq!(true, approx_equal(diffusion_graph.dummy_potentials[1][1][0][0], 0., 1E-6));
diffusion_graph.update_edge_potential(2, 1, 2, 0);
assert_eq!(true, approx_equal(diffusion_graph.dummy_potentials[2][1][2][0], -0.06, 1E-6));
} | rust_cleaned_test_functions.jsonl/70582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
17932,
57952,
2283,
368,
341,
286,
1077,
2115,
4954,
284,
4318,
16,
11,
220,
16,
11,
220,
16,
936,
983,
13251,
1507,
508,
16,
11,
220,
15,
11,
220,
16,
936,
983,
13251,
1507,
508,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recognize_utf8_boundary_dangle_two() {
let buf: &[u8] = &[0x61, 0x61, 0x61, 0xE0, 0xA1, 0x98, 0x0d, 0x0a, 0x0d, 0x0a];
let mut full = buffer_from(buf);
let result = block_on(async { recognize(&mut full).await });
let complex = result.unwrap().find_header("Complex");
assert_eq!(complex, Some("aaaࡘ".to_string()));
} | rust_cleaned_test_functions.jsonl/48187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7080,
3934,
551,
39453,
23,
54004,
814,
4044,
23241,
368,
341,
220,
1077,
6607,
25,
44590,
84,
23,
60,
284,
44590,
15,
87,
21,
16,
11,
220,
15,
87,
21,
16,
11,
220,
15,
87,
21,
16,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_return_statements() {
let tests = vec![
("return 10;", 10),
("return 10; 9;", 10),
("return 2 * 5; 9;", 10),
("9; return 2 * 5; 9;", 10),
(
"
if (10 > 1) {
if (10 > 1) {
return 10;
}
return 1;
}
",
10,
),
];
for (input, result) in tests {
assert_eq!(eval(input), Object::Int(result));
}
} | rust_cleaned_test_functions.jsonl/84230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12511,
16271,
3723,
368,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
3489,
689,
220,
16,
15,
32503,
220,
16,
15,
1326,
286,
3489,
689,
220,
16,
15,
26,
220,
24,
32503,
220,
16,
15,
1326,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_purge_old_pending_push_messages() {
let mut crds = Crds::default();
let mut push = CrdsGossipPush::default();
let peer = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
assert_eq!(crds.insert(peer, 0), Ok(None));
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
let mut ci = ContactInfo::new_localhost(&Pubkey::new_rand(), 0);
ci.wallclock = 1;
let new_msg = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci));
let expected = HashMap::new();
assert_eq!(
push.process_push_message(&mut crds, &Pubkey::default(), new_msg, 1),
Ok(None)
);
push.purge_old_pending_push_messages(&crds, 0);
assert_eq!(push.new_push_messages(&crds, 0), expected);
} | rust_cleaned_test_functions.jsonl/79138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
21108,
37861,
14218,
23428,
368,
341,
286,
1077,
5206,
1560,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
5206,
4484,
284,
4553,
5356,
38,
41473,
16644,
486,
2258,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_alogithm_id() {
assert_eq!(
EncryptionMode::try_from(TPM2_ALG_CTR).unwrap(),
EncryptionMode::Ctr
);
assert_eq!(
EncryptionMode::try_from(TPM2_ALG_OFB).unwrap(),
EncryptionMode::Ofb
);
assert_eq!(
EncryptionMode::try_from(TPM2_ALG_CBC).unwrap(),
EncryptionMode::Cbc
);
assert_eq!(
EncryptionMode::try_from(TPM2_ALG_CFB).unwrap(),
EncryptionMode::Cfb
);
assert_eq!(
EncryptionMode::try_from(TPM2_ALG_ECB).unwrap(),
EncryptionMode::Ecb
);
assert!(
EncryptionMode::try_from(TPM2_ALG_ERROR).is_err(),
"Error should not exist in EncryptionMode"
);
} | rust_cleaned_test_functions.jsonl/41512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
62055,
3636,
486,
1539,
5673,
4140,
8795,
17,
8912,
38,
920,
2378,
568,
15454,
3148,
310,
62055,
3636,
486,
77227,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_unprocessed_batch_limit() {
solana_logger::setup();
// Create `PacketBatch` with 2 unprocessed packets
let new_packet_batch = PacketBatch::new(vec![Packet::default(); 2]);
let mut unprocessed_packets: UnprocessedPacketBatches =
vec![(new_packet_batch, vec![0, 1], false)]
.into_iter()
.collect();
// Set the limit to 2
let batch_limit = 2;
// Create new unprocessed packets and add to a batch
let new_packet_batch = PacketBatch::new(vec![Packet::default()]);
let packet_indexes = vec![];
let duplicates = Arc::new(Mutex::new((
LruCache::new(DEFAULT_LRU_SIZE),
PacketHasher::default(),
)));
let mut dropped_packet_batches_count = 0;
let mut dropped_packets_count = 0;
let mut newly_buffered_packets_count = 0;
let banking_stage_stats = BankingStageStats::default();
// packets are not added to the unprocessed queue
BankingStage::push_unprocessed(
&mut unprocessed_packets,
new_packet_batch.clone(),
packet_indexes,
&mut dropped_packet_batches_count,
&mut dropped_packets_count,
&mut newly_buffered_packets_count,
batch_limit,
&duplicates,
&banking_stage_stats,
);
assert_eq!(unprocessed_packets.len(), 1);
assert_eq!(dropped_packet_batches_count, 0);
assert_eq!(dropped_packets_count, 0);
assert_eq!(newly_buffered_packets_count, 0);
// packets are added to the unprocessed queue
let packet_indexes = vec![0];
BankingStage::push_unprocessed(
&mut unprocessed_packets,
new_packet_batch,
packet_indexes.clone(),
&mut dropped_packet_batches_count,
&mut dropped_packets_count,
&mut newly_buffered_packets_count,
batch_limit,
&duplicates,
&banking_stage_stats,
);
assert_eq!(unprocessed_packets.len(), 2);
assert_eq!(dropped_packet_batches_count, 0);
assert_eq!(dropped_packets_count, 0);
assert_eq!(newly_buffered_packets_count, 1);
// dropped and the new one is appended to the end
let new_packet_batch = PacketBatch::new(vec![Packet::from_data(
Some(&SocketAddr::from(([127, 0, 0, 1], 8001))),
42,
)
.unwrap()]);
assert_eq!(unprocessed_packets.len(), batch_limit);
BankingStage::push_unprocessed(
&mut unprocessed_packets,
new_packet_batch.clone(),
packet_indexes.clone(),
&mut dropped_packet_batches_count,
&mut dropped_packets_count,
&mut newly_buffered_packets_count,
batch_limit,
&duplicates,
&banking_stage_stats,
);
assert_eq!(unprocessed_packets.len(), 2);
assert_eq!(
unprocessed_packets[1].0.packets[0],
new_packet_batch.packets[0]
);
assert_eq!(dropped_packet_batches_count, 1);
assert_eq!(dropped_packets_count, 2);
assert_eq!(newly_buffered_packets_count, 2);
BankingStage::push_unprocessed(
&mut unprocessed_packets,
new_packet_batch.clone(),
packet_indexes,
&mut dropped_packet_batches_count,
&mut dropped_packets_count,
&mut newly_buffered_packets_count,
3,
&duplicates,
&banking_stage_stats,
);
assert_eq!(unprocessed_packets.len(), 2);
assert_eq!(
unprocessed_packets[1].0.packets[0],
new_packet_batch.packets[0]
);
assert_eq!(dropped_packet_batches_count, 1);
assert_eq!(dropped_packets_count, 2);
assert_eq!(newly_buffered_packets_count, 2);
} | rust_cleaned_test_functions.jsonl/44194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2069
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
4907,
34022,
14534,
14763,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
442,
4230,
1565,
16679,
21074,
63,
448,
220,
17,
650,
34022,
27035,
198,
286,
1077,
501,
21078,
14534,
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_parse_dependencies_section() {
let input = r#"
dependencies {
dep1 {
curl -L http://application.com
}
dep2 {
curl -L http://application2.com
}
}
"#
.chars()
.collect::<Vec<_>>();
let r = parse_dependencies_section().parse(&input).unwrap();
assert_eq!(
r,
vec![
Dependency {
name: "dep1".into(),
block: r#"
curl -L http://application.com
"#
.into(),
},
Dependency {
name: "dep2".into(),
block: r#"
curl -L http://application2.com
"#
.into(),
}
]
)
} | rust_cleaned_test_functions.jsonl/49997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 640
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
71841,
16221,
368,
341,
286,
1077,
1946,
284,
435,
2,
698,
310,
19543,
341,
394,
2170,
16,
341,
503,
13957,
481,
43,
1758,
1110,
5132,
905,
198,
394,
456,
394,
2170,
17,
341,
503,
13957... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_options_add_macro_definition_no_value() {
let mut c = Compiler::new().unwrap();
let mut options = CompileOptions::new().unwrap();
options.add_macro_definition("E", None);
let result = c
.compile_into_spirv_assembly(
IFDEF_E,
ShaderKind::Vertex,
"shader.glsl",
"main",
Some(&options),
)
.unwrap();
assert_eq!(VOID_MAIN_ASSEMBLY, result.as_text());
} | rust_cleaned_test_functions.jsonl/41049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
8743,
2891,
58810,
31698,
6536,
3142,
368,
341,
286,
1077,
5206,
272,
284,
45631,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
2606,
284,
54467,
3798,
486,
931,
1005,
15454,
543,
286,
2606,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_from_str() {
let schedule = Schedule::from_str("cheesecake 0,30 0,6,12,18 1,15 Jan-March Thurs");
assert!(schedule.is_err());
} | rust_cleaned_test_functions.jsonl/125949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
5673,
2895,
368,
341,
262,
1077,
9700,
284,
23512,
486,
1499,
2895,
445,
1528,
288,
78256,
220,
15,
11,
18,
15,
220,
15,
11,
21,
11,
16,
17,
11,
16,
23,
220,
16,
11,
16,
20,
4350,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_build_world() {
let _ = env_logger::try_init();
let options = DocBuilderOptions::from_prefix(PathBuf::from("../cratesfyi-prefix"));
let mut docbuilder = DocBuilder::new(options);
// This test is building WHOLE WORLD and may take forever
assert!(docbuilder.build_world().is_ok());
} | rust_cleaned_test_functions.jsonl/31378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
31792,
368,
341,
286,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
543,
286,
1077,
2606,
284,
21709,
3297,
3798,
486,
1499,
13974,
33030,
15064,
486,
1499,
17409,
5082,
973,
30595,
72,
671... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fidl_socket_addr_v4() {
assert_eq!(
fidl::Ipv4SocketAddress {
address: fidl::Ipv4Address { addr: [192, 168, 0, 1] },
port: 8080
},
fidl_socket_addr_v4!("192.168.0.1:8080")
);
} | rust_cleaned_test_functions.jsonl/12532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
55464,
19555,
7387,
2273,
19,
368,
341,
286,
2060,
10714,
33673,
310,
32104,
75,
486,
80656,
19,
69455,
341,
394,
2621,
25,
32104,
75,
486,
80656,
19,
4286,
314,
10789,
25,
508,
16,
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... | 1 |
#[test]
fn test_busy_loop() {
#[cfg(target_os="macos")]
{
// We need root permissions here to run this on OSX
if unsafe { libc::geteuid() } != 0 {
return;
}
}
let mut runner = TestRunner::new(Config::default(), "./tests/scripts/busyloop.py");
let traces = runner.spy.get_stack_traces().unwrap();
// we should be able to say that the script is active and
// catch issues like https://github.com/benfred/py-spy/issues/141
assert!(traces[0].active);
} | rust_cleaned_test_functions.jsonl/11289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75959,
17198,
368,
341,
262,
11506,
14072,
8637,
29387,
428,
11948,
436,
5422,
262,
341,
286,
442,
1205,
1184,
3704,
8541,
1588,
311,
1598,
419,
389,
87746,
198,
286,
421,
19860,
314,
42142,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_inline_immutable_multiple_times() {
test("var x = null; var y = x, z = x;", "var x; var y, z;");
test("var x = 3; var y = x, z = x;", "var x; var y, z;");
} | rust_cleaned_test_functions.jsonl/27649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
71370,
5922,
45233,
22353,
368,
341,
262,
1273,
445,
947,
856,
284,
845,
26,
762,
379,
284,
856,
11,
1147,
284,
856,
32503,
330,
947,
856,
26,
762,
379,
11,
1147,
34649,
262,
1273,
445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_module_and_function() {
err(
"fun Foo() {} module Foo",
pos(1, 14),
SemError::ShadowFunction("Foo".into()),
);
err(
"module Foo fun Foo() {}",
pos(1, 12),
SemError::ShadowModule("Foo".into()),
);
} | rust_cleaned_test_functions.jsonl/11803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
8378,
9174,
368,
341,
286,
1848,
1006,
310,
330,
11894,
33428,
368,
4687,
4688,
33428,
756,
310,
1133,
7,
16,
11,
220,
16,
19,
1326,
310,
14248,
1454,
486,
23667,
5152,
445,
40923,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_protocol_upgrade() {
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
let dkg_interval_length = 3;
let node_ids = [node_test_id(0)];
let Dependencies {
mut pool,
registry,
crypto,
time_source,
replica_config,
state_manager,
..
} = dependencies_with_subnet_params(
pool_config.clone(),
subnet_test_id(0),
vec![
(
1,
SubnetRecordBuilder::from(&node_ids)
.with_dkg_interval_length(dkg_interval_length)
.build(),
),
(
10,
SubnetRecordBuilder::from(&node_ids)
.with_dkg_interval_length(dkg_interval_length)
.with_replica_version("0xBEEF")
.build(),
),
],
);
let ingress_pool = TestIngressPool::new(pool_config);
state_manager
.get_mut()
.expect_get_state_hash_at()
.return_const(Ok(CryptoHashOfState::from(CryptoHash(Vec::new()))));
let certified_height = Height::from(1);
state_manager
.get_mut()
.expect_latest_certified_height()
.return_const(certified_height);
state_manager
.get_mut()
.expect_get_state_at()
.return_const(Ok(ic_interfaces::state_manager::Labeled::new(
Height::new(0),
Arc::new(ic_test_utilities::state::get_initial_state(0, 0)),
)));
let mut payload_builder = MockPayloadBuilder::new();
payload_builder
.expect_get_payload()
.return_const(Ok(BatchPayload::default()));
let membership =
Membership::new(pool.get_cache(), registry.clone(), replica_config.subnet_id);
let membership = Arc::new(membership);
let block_maker = BlockMaker::new(
Arc::clone(&time_source) as Arc<_>,
replica_config.clone(),
Arc::clone(®istry) as Arc<dyn RegistryClient>,
membership.clone(),
crypto.clone(),
Arc::new(payload_builder),
Arc::new(RwLock::new(ic_artifact_pool::dkg_pool::DkgPoolImpl::new(
MetricsRegistry::new(),
))),
state_manager.clone(),
Duration::from_millis(0),
MetricsRegistry::new(),
no_op_logger(),
);
// Skip the first DKG interval
pool.advance_round_normal_operation_n(dkg_interval_length);
let proposal = block_maker.on_state_change(&PoolReader::new(&pool), &ingress_pool);
assert!(proposal.is_some());
let mut proposal = proposal.unwrap();
let block = proposal.content.as_mut();
assert!(block.payload.is_summary());
pool.advance_round_with_block(&proposal);
pool.insert_validated(pool.make_catch_up_package(proposal.height()));
// Skip the second DKG interval
pool.advance_round_normal_operation_n(dkg_interval_length);
assert_eq!(
PoolReader::new(&pool).registry_version(Height::from(dkg_interval_length * 2)),
Some(RegistryVersion::from(1))
);
// 2. Make CUP block at next start block
// We do not anticipate payload builder to be called since we will be making
let mut payload_builder = MockPayloadBuilder::new();
payload_builder
.expect_get_payload()
.return_const(Ok(BatchPayload::default()));
let block_maker = BlockMaker::new(
Arc::clone(&time_source) as Arc<_>,
replica_config,
Arc::clone(®istry) as Arc<dyn RegistryClient>,
membership,
crypto,
Arc::new(payload_builder),
Arc::new(RwLock::new(ic_artifact_pool::dkg_pool::DkgPoolImpl::new(
MetricsRegistry::new(),
))),
state_manager,
Duration::from_millis(0),
MetricsRegistry::new(),
no_op_logger(),
);
// Check CUP block is made.
let proposal = block_maker.on_state_change(&PoolReader::new(&pool), &ingress_pool);
assert!(proposal.is_some());
let cup_proposal = proposal.unwrap();
let cup_height = cup_proposal.height();
let block = cup_proposal.content.as_ref();
assert!(block.payload.is_summary());
assert_eq!(block.context.registry_version, RegistryVersion::from(10));
// only notarized but not finalize this CUP block.
pool.insert_validated(cup_proposal.clone());
pool.insert_validated(pool.make_next_beacon());
pool.notarize(&cup_proposal);
let proposal = block_maker.on_state_change(&PoolReader::new(&pool), &ingress_pool);
assert!(proposal.is_some());
let proposal = proposal.unwrap();
let block = proposal.content.as_ref();
assert_eq!(block.version(), &ReplicaVersion::default());
// registry version 10 becomes effective.
assert_eq!(
PoolReader::new(&pool).registry_version(proposal.height()),
Some(RegistryVersion::from(10))
);
pool.finalize(&cup_proposal);
let catch_up_package = pool.make_catch_up_package(cup_height);
pool.insert_validated(catch_up_package);
let proposal = block_maker.on_state_change(&PoolReader::new(&pool), &ingress_pool);
assert!(proposal.is_none());
})
} | rust_cleaned_test_functions.jsonl/43721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34880,
67794,
368,
341,
286,
17902,
4452,
94044,
486,
63722,
15709,
5332,
486,
4197,
4452,
15709,
5332,
22428,
10285,
5332,
91,
341,
310,
1077,
294,
7351,
20541,
5118,
284,
220,
18,
280,
310,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_with_progress() {
let tmpdir = setup("git_repo_update_with_progress");
let tarball = tmpdir.mash("../../alpine-base.tgz");
assert!(sys::remove_all(&tmpdir).is_ok());
assert_eq!(git::is_repo(&tmpdir), false);
assert!(
git::Repo::new(&tmpdir)
.unwrap()
.url("https://github.com/phR0ze/alpine-base")
.xfer_progress(|total, cur| {
let _ = total + cur;
})
.checkout_progress(|total, cur| {
let _ = total + cur;
})
.update_progress(|total, cur| {
let _ = total + cur;
})
.update()
.is_ok()
);
assert_eq!(git::is_repo(&tmpdir), true);
assert!(
git::Repo::new(&tmpdir)
.unwrap()
.url("https://github.com/phR0ze/alpine-base")
.xfer_progress(|total, cur| {
let _ = total + cur;
})
.checkout_progress(|total, cur| {
let _ = total + cur;
})
.update_progress(|total, cur| {
let _ = total + cur;
})
.update()
.is_ok()
);
// Now wipe it out and extract a tarball of the repo that needs updated
let repo = git::Repo::new(&tmpdir).unwrap();
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(tar::extract_all(&tarball, &tmpdir).is_ok());
assert_eq!(repo.last_msg().unwrap(), "Use the workflow name for the badge".to_string());
assert!(
git::Repo::new(&tmpdir)
.unwrap()
.url("https://github.com/phR0ze/alpine-base")
.xfer_progress(|total, cur| {
let _ = total + cur;
})
.checkout_progress(|total, cur| {
let _ = total + cur;
})
.update_progress(|total, cur| {
let _ = total + cur;
})
.update()
.is_ok()
);
assert_ne!(repo.last_msg().unwrap(), "Use the workflow name for the badge".to_string());
assert!(sys::remove_all(&tmpdir).is_ok());
} | rust_cleaned_test_functions.jsonl/114255 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
6615,
27200,
368,
341,
286,
1077,
4174,
3741,
284,
6505,
445,
12882,
37784,
8882,
6615,
27200,
797,
286,
1077,
12183,
3959,
284,
4174,
3741,
744,
988,
36800,
278,
38038,
30013,
734,
46589,
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_backup_and_import() {
let mut suite = TestSuite::new(3, 144 * 1024 * 1024);
// 3 version for each key.
let key_count = 60;
suite.must_kv_put(key_count, 3);
// Push down backup request.
let tmp = Builder::new().tempdir().unwrap();
let backup_ts = suite.alloc_ts();
let storage_path = make_unique_dir(tmp.path());
let rx = suite.backup(
vec![], // start
vec![], // end
0.into(), // begin_ts
backup_ts,
&storage_path,
);
let resps1 = block_on(rx.collect::<Vec<_>>());
// Only leader can handle backup.
assert_eq!(resps1.len(), 1);
let files1 = resps1[0].files.clone();
assert!(!resps1[0].get_files().is_empty());
suite.cluster.must_delete_range_cf(CF_DEFAULT, b"", b"");
suite.cluster.must_delete_range_cf(CF_WRITE, b"", b"");
// Backup file should have same contents.
let rx = suite.backup(
vec![], // start
vec![], // end
0.into(), // begin_ts
backup_ts,
&make_unique_dir(tmp.path()),
);
let resps2 = block_on(rx.collect::<Vec<_>>());
assert!(resps2[0].get_files().is_empty(), "{:?}", resps2);
// Use importer to restore backup files.
let backend = make_local_backend(&storage_path);
let storage = create_storage(&backend, Default::default()).unwrap();
let region = suite.cluster.get_region(b"");
let mut sst_meta = SstMeta::default();
sst_meta.region_id = region.get_id();
sst_meta.set_region_epoch(region.get_region_epoch().clone());
sst_meta.set_uuid(uuid::Uuid::new_v4().as_bytes().to_vec());
let mut metas = vec![];
for f in files1.clone().into_iter() {
let mut reader = storage.read(&f.name);
let mut content = vec![];
block_on(reader.read_to_end(&mut content)).unwrap();
let mut m = sst_meta.clone();
m.crc32 = calc_crc32_bytes(&content);
m.length = content.len() as _;
m.cf_name = name_to_cf(&f.name).to_owned();
metas.push((m, content));
}
for (m, c) in &metas {
for importer in suite.cluster.sim.rl().importers.values() {
let mut f = importer.create(m).unwrap();
f.append(c).unwrap();
f.finish().unwrap();
}
// Make ingest command.
let mut ingest = Request::default();
ingest.set_cmd_type(CmdType::IngestSst);
ingest.mut_ingest_sst().set_sst(m.clone());
let mut header = RaftRequestHeader::default();
let leader = suite.context.get_peer().clone();
header.set_peer(leader);
header.set_region_id(suite.context.get_region_id());
header.set_region_epoch(suite.context.get_region_epoch().clone());
let mut cmd = RaftCmdRequest::default();
cmd.set_header(header);
cmd.mut_requests().push(ingest);
let resp = suite
.cluster
.call_command_on_leader(cmd, Duration::from_secs(5))
.unwrap();
assert!(!resp.get_header().has_error(), "{:?}", resp);
}
// Backup file should have same contents.
let rx = suite.backup(
vec![], // start
vec![], // end
0.into(), // begin_ts
backup_ts,
&make_unique_dir(tmp.path()),
);
let resps3 = block_on(rx.collect::<Vec<_>>());
assert_same_files(files1.into_vec(), resps3[0].files.clone().into_vec());
suite.stop();
} | rust_cleaned_test_functions.jsonl/92419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
8378,
18434,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
18,
11,
220,
16,
19,
19,
353,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
317,
262,
442,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_event() {
run_in_task(|mut cx| {
let mut isolate = setup();
isolate
.execute("event_test.js", include_str!("event_test.js"))
.unwrap();
if let Poll::Ready(Err(_)) = isolate.poll_event_loop(&mut cx) {
unreachable!();
}
});
} | rust_cleaned_test_functions.jsonl/12652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6748,
368,
341,
262,
1598,
1243,
12184,
22428,
6984,
20716,
91,
341,
414,
1077,
5206,
42123,
284,
6505,
543,
414,
42123,
198,
286,
659,
10257,
445,
3087,
4452,
2857,
497,
2924,
2895,
17223,
3087,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_top_collector_with_limit_and_offset() {
let collector = TopCollector::with_limit(2).and_offset(1);
let results = collector
.merge_fruits(vec![vec![
(0.9, DocAddress::new(0, 1)),
(0.8, DocAddress::new(0, 2)),
(0.7, DocAddress::new(0, 3)),
(0.6, DocAddress::new(0, 4)),
(0.5, DocAddress::new(0, 5)),
]])
.unwrap();
assert_eq!(
results,
vec![(0.8, DocAddress::new(0, 2)), (0.7, DocAddress::new(0, 3)),]
);
} | rust_cleaned_test_functions.jsonl/17428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
10211,
27669,
6615,
14763,
8378,
6917,
368,
341,
286,
1077,
31953,
284,
6909,
53694,
486,
4197,
14763,
7,
17,
568,
437,
6917,
7,
16,
626,
286,
1077,
3059,
284,
31953,
198,
310,
659,
19052... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_iter_round_trip() {
let array = Int32Array::from(vec![Some(0), None, Some(2), None, Some(4)]);
let array = Arc::new(array) as ArrayRef;
let array = array.as_any().downcast_ref::<Int32Array>().unwrap();
let result: Int32Array = array.iter().map(|e| e.map(|e| e + 1)).collect();
let expected = Int32Array::from(vec![Some(1), None, Some(3), None, Some(5)]);
assert_eq!(result, expected);
// check if DoubleEndedIterator is implemented
let result: Int32Array = array.iter().rev().collect();
let rev_array = Int32Array::from(vec![Some(4), None, Some(2), None, Some(0)]);
assert_eq!(result, rev_array);
// check if ExactSizeIterator is implemented
let _ = array.iter().rposition(|opt_b| opt_b == Some(1));
} | rust_cleaned_test_functions.jsonl/117559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
11723,
29896,
63883,
368,
341,
286,
1077,
1334,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
15,
701,
2240,
11,
4329,
7,
17,
701,
2240,
11,
4329,
7,
19,
41958,
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_read_write() {
let evt = EventFd::new(EFD_NONBLOCK).unwrap();
evt.write(55).unwrap();
assert_eq!(evt.read().unwrap(), 55);
} | rust_cleaned_test_functions.jsonl/18670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9165,
368,
341,
286,
1077,
12358,
284,
3665,
74476,
486,
931,
10722,
14596,
22128,
39964,
568,
15454,
543,
286,
12358,
3836,
7,
20,
20,
568,
15454,
543,
286,
2060,
10714,
10297,
28734,
4125,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bytes_clone_drop() {
let vec = vec![33u8; 1024];
let b1 = Bytes::from(vec);
let _b2 = b1.clone();
} | rust_cleaned_test_functions.jsonl/32063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
54742,
29584,
368,
341,
262,
1077,
7486,
284,
7486,
20703,
18,
18,
84,
23,
26,
220,
16,
15,
17,
19,
935,
262,
1077,
293,
16,
284,
30024,
486,
1499,
25592,
317,
262,
1077,
716,
65,
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 |
#[test]
fn test_ensemble_get_aggregated_score() {
let name1 = "John Doe";
let name2 = "John Doe";
let jw = JaroWinklerMatcher::default();
let soundex = SoundexMatcher::default();
let matchers: Vec<Box<dyn Matcher>> = vec![Box::new(jw), Box::new(soundex)];
let mut ensemble = super::Ensemble::new(matchers);
ensemble.set_equal_weight();
let score = ensemble.get_aggregated_score(name1, name2);
assert_eq!(score, 1.0);
} | rust_cleaned_test_functions.jsonl/25044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
48475,
3062,
20587,
93040,
10405,
368,
341,
286,
1077,
829,
16,
284,
330,
13079,
49628,
876,
286,
1077,
829,
17,
284,
330,
13079,
49628,
3302,
286,
1077,
502,
86,
284,
619,
17165,
54,
766,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pok_multiple_sigs_with_same_msg() {
// Prove knowledge of multiple signatures and the equality of a specific message under both signatures.
// Knowledge of 2 signatures and their corresponding messages is being proven.
// 2nd message in the 1st signature and 5th message in the 2nd signature are to be proven equal without revealing them
let message_count = 5;
let (vk, signkey) = generate(message_count).unwrap();
let same_msg = SignatureMessage::random();
let mut msgs_1: Vec<SignatureMessage> = (0..message_count - 1)
.collect::<Vec<usize>>()
.iter()
.map(|_| SignatureMessage::random())
.collect();
let mut proof_messages_1 = Vec::with_capacity(message_count);
for m in msgs_1.iter() {
proof_messages_1.push(pm_hidden_raw!(m.clone()));
}
let same_blinding = ProofNonce::random();
msgs_1.insert(1, same_msg.clone());
proof_messages_1.insert(1, pm_hidden_raw!(same_msg.clone(), same_blinding.clone()));
let sig_1 = Signature::new(msgs_1.as_slice(), &signkey, &vk).unwrap();
assert!(sig_1.verify(msgs_1.as_slice(), &vk).unwrap());
let mut msgs_2: Vec<SignatureMessage> = (0..message_count - 1)
.collect::<Vec<usize>>()
.iter()
.map(|_| SignatureMessage::random())
.collect();
let mut proof_messages_2 = Vec::with_capacity(message_count);
for m in msgs_2.iter() {
proof_messages_2.push(pm_hidden_raw!(m.clone()));
}
msgs_2.insert(4, same_msg.clone());
proof_messages_2.insert(4, pm_hidden_raw!(same_msg.clone(), same_blinding.clone()));
let sig_2 = Signature::new(msgs_2.as_slice(), &signkey, &vk).unwrap();
assert!(sig_2.verify(msgs_2.as_slice(), &vk).unwrap());
// A particular message is same
assert_eq!(msgs_1[1], msgs_2[4]);
let pok_1 = PoKOfSignature::init(&sig_1, &vk, proof_messages_1.as_slice()).unwrap();
let pok_2 = PoKOfSignature::init(&sig_2, &vk, proof_messages_2.as_slice()).unwrap();
let mut chal_bytes = vec![];
chal_bytes.append(&mut pok_1.to_bytes());
chal_bytes.append(&mut pok_2.to_bytes());
let chal_prover = ProofChallenge::hash(&chal_bytes);
let proof_1 = pok_1.gen_proof(&chal_prover).unwrap();
let proof_2 = pok_2.gen_proof(&chal_prover).unwrap();
// The verifier generates the challenge on its own.
let mut chal_bytes = vec![];
chal_bytes.append(&mut proof_1.get_bytes_for_challenge(BTreeSet::new(), &vk));
chal_bytes.append(&mut proof_2.get_bytes_for_challenge(BTreeSet::new(), &vk));
let chal_verifier = ProofChallenge::hash(&chal_bytes);
assert_eq!(
proof_1.get_resp_for_message(1).unwrap(),
proof_2.get_resp_for_message(4).unwrap()
);
let revealed = BTreeMap::new();
assert!(proof_1
.verify(&vk, &revealed, &chal_verifier)
.unwrap()
.is_valid());
assert!(proof_2
.verify(&vk, &revealed, &chal_verifier)
.unwrap()
.is_valid());
} | rust_cleaned_test_functions.jsonl/82484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1540
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
562,
45233,
643,
14462,
6615,
33574,
6483,
368,
341,
286,
442,
1298,
586,
6540,
315,
5248,
32628,
323,
279,
21777,
315,
264,
3151,
1943,
1212,
2176,
32628,
624,
286,
442,
31925,
315,
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... | 3 |
#[test]
fn test_hover_through_expr_in_macro() {
let hover_on = check_hover_result(
"
//- /lib.rs
macro_rules! id {
($($tt:tt)*) => { $($tt)* }
}
fn foo(bar:u32) {
let a = id!(ba<|>r);
}
",
&["u32"],
);
assert_eq!(hover_on, "bar")
} | rust_cleaned_test_functions.jsonl/33507 | {
"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,
53445,
87399,
21915,
1243,
58810,
368,
341,
286,
1077,
19548,
4470,
284,
1779,
53445,
5287,
1006,
310,
6228,
310,
78406,
608,
2740,
25638,
198,
310,
18072,
21407,
0,
877,
341,
394,
1711,
699,
5566... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_riddle_create() {
let riddle = Riddle::new(
"title".to_string(),
"text".to_string(),
"hint".to_string(),
"answer".to_string(),
1,
);
assert_eq!(riddle.get_title(), "title");
assert_eq!(riddle.get_text(), "text");
assert_eq!(riddle.get_hint(), "hint");
assert!(riddle.check_answer("answer".to_string()));
assert_eq!(riddle.get_bounty(), 1);
assert!(!riddle.is_solved());
} | rust_cleaned_test_functions.jsonl/34251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
3310,
8657,
368,
341,
286,
1077,
435,
3310,
284,
431,
3310,
486,
931,
1006,
310,
330,
2102,
3263,
983,
3904,
3148,
310,
330,
1318,
3263,
983,
3904,
3148,
310,
330,
46125,
3263,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_a_plus_b_less_than_c() {
assert_expression!(
"A + B < C",
Expression::BinaryExpression(
Operator::Less,
Box::new(
Expression::BinaryExpression(
Operator::Plus,
Box::new("A".as_var_expr(1, 7)),
Box::new("B".as_var_expr(1, 11)),
ExpressionType::Unresolved
)
.at_rc(1, 9)
),
Box::new("C".as_var_expr(1, 15)),
ExpressionType::Unresolved
)
);
} | rust_cleaned_test_functions.jsonl/102651 | {
"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,
4306,
28043,
880,
50747,
51613,
666,
368,
341,
310,
2060,
28068,
33673,
394,
330,
32,
488,
425,
366,
356,
756,
394,
16378,
486,
21338,
9595,
1006,
503,
28498,
486,
27451,
345,
503,
8261,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_are_snapshots_compatible() {
solana_logger::setup();
let slot1: Slot = 1234;
let slot2: Slot = 5678;
let slot3: Slot = 999_999;
let full_snapshot_archive_info = FullSnapshotArchiveInfo::new_from_path(PathBuf::from(
format!("/dir/snapshot-{}-{}.tar", slot1, Hash::new_unique()),
))
.unwrap();
assert!(check_are_snapshots_compatible(&full_snapshot_archive_info, None,).is_ok());
let incremental_snapshot_archive_info =
IncrementalSnapshotArchiveInfo::new_from_path(PathBuf::from(format!(
"/dir/incremental-snapshot-{}-{}-{}.tar",
slot1,
slot2,
Hash::new_unique()
)))
.unwrap();
assert!(check_are_snapshots_compatible(
&full_snapshot_archive_info,
Some(&incremental_snapshot_archive_info)
)
.is_ok());
let incremental_snapshot_archive_info =
IncrementalSnapshotArchiveInfo::new_from_path(PathBuf::from(format!(
"/dir/incremental-snapshot-{}-{}-{}.tar",
slot2,
slot3,
Hash::new_unique()
)))
.unwrap();
assert!(check_are_snapshots_compatible(
&full_snapshot_archive_info,
Some(&incremental_snapshot_archive_info)
)
.is_err());
} | rust_cleaned_test_functions.jsonl/67603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
56855,
74175,
27634,
2965,
37079,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
9446,
16,
25,
31316,
284,
220,
16,
17,
18,
19,
280,
286,
1077,
9446,
17,
25,
31316,
284,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_arguments_response_file() {
assert_eq!(
CompilerArguments::CannotCache("@", None),
parse_arguments_(stringvec!["-c", "foo.c", "@foo", "-o", "foo.o"], false)
);
assert_eq!(
CompilerArguments::CannotCache("@", None),
parse_arguments_(stringvec!["-c", "foo.c", "-o", "@foo"], false)
);
} | rust_cleaned_test_functions.jsonl/17759 | {
"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,
21039,
43433,
9655,
2458,
368,
341,
286,
2060,
10714,
33673,
310,
45631,
19139,
486,
17444,
8233,
10662,
497,
2240,
1326,
310,
4715,
43433,
8361,
917,
4083,
0,
1183,
12,
66,
497,
330,
7975,
520,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consumer_initialize_error() {
let v = vec![];
let mut c = InitializeErrorConsumer {};
let p = Parser::new(&v, &mut c);
let ret = p.parse();
assert_matches!(ret, Err(State::ConsumerError(_)));
if let Err(State::ConsumerError(err)) = ret {
assert_eq!("consumer error", err.description());
assert_eq!("init error", format!("{}", err));
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/85744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73969,
40889,
4096,
368,
341,
286,
1077,
348,
284,
7486,
0,
15078,
286,
1077,
5206,
272,
284,
9008,
1454,
29968,
9321,
286,
1077,
281,
284,
21102,
486,
931,
2099,
85,
11,
609,
6984,
272,
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... | 2 |
#[test]
fn test_move_try_from() {
let input_and_expected:Vec<(&'static str,Result<Move, TypeConvertError<String>>)> = vec![
("",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (number of characters of move expression is invalid)")))),
("Z*1a",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("P",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (number of characters of move expression is invalid)")))),
("P+",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (number of characters of move expression is invalid)")))),
("P+1a",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN string (there no '*' after the name)")))),
("P*",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (number of characters of move expression is invalid)")))),
("P*1",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (number of characters of move expression is invalid)")))),
("P*aa",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("P*1j",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("P*10",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("P*0a",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("R*1a",Ok(Move::Put(MochigomaKind::Hisha, KomaDstPutPosition(1,1)))),
("B*2b",Ok(Move::Put(MochigomaKind::Kaku, KomaDstPutPosition(2,2)))),
("G*3c",Ok(Move::Put(MochigomaKind::Kin, KomaDstPutPosition(3,3)))),
("S*4d",Ok(Move::Put(MochigomaKind::Gin, KomaDstPutPosition(4,4)))),
("N*5e",Ok(Move::Put(MochigomaKind::Kei, KomaDstPutPosition(5,5)))),
("L*6f",Ok(Move::Put(MochigomaKind::Kyou, KomaDstPutPosition(6,6)))),
("P*7g",Ok(Move::Put(MochigomaKind::Fu, KomaDstPutPosition(7,7)))),
("P*8h",Ok(Move::Put(MochigomaKind::Fu, KomaDstPutPosition(8,8)))),
("P*9i",Ok(Move::Put(MochigomaKind::Fu, KomaDstPutPosition(9,9)))),
("1",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (number of characters of move expression is invalid)")))),
("1a",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (number of characters of move expression is invalid)")))),
("1a1",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (number of characters of move expression is invalid)")))),
("0a1a",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("111a",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)")))),
("1aia",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("1a19",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("1a0a",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("1a2b*",Err(TypeConvertError::SyntaxError(String::from(
"Invalid SFEN character string (The format of the move is illegal)"
)))),
("1a9i",Ok(Move::To(KomaSrcPosition(1,1),KomaDstToPosition(9,9,false)))),
("2b8h",Ok(Move::To(KomaSrcPosition(2,2),KomaDstToPosition(8,8,false)))),
("3c7g",Ok(Move::To(KomaSrcPosition(3,3),KomaDstToPosition(7,7,false)))),
("4d6f",Ok(Move::To(KomaSrcPosition(4,4),KomaDstToPosition(6,6,false)))),
("5e1a",Ok(Move::To(KomaSrcPosition(5,5),KomaDstToPosition(1,1,false)))),
("1a5e",Ok(Move::To(KomaSrcPosition(1,1),KomaDstToPosition(5,5,false)))),
("6f4d",Ok(Move::To(KomaSrcPosition(6,6),KomaDstToPosition(4,4,false)))),
("7g3c",Ok(Move::To(KomaSrcPosition(7,7),KomaDstToPosition(3,3,false)))),
("8h2b",Ok(Move::To(KomaSrcPosition(8,8),KomaDstToPosition(2,2,false)))),
("9i1a",Ok(Move::To(KomaSrcPosition(9,9),KomaDstToPosition(1,1,false)))),
("1a9i+",Ok(Move::To(KomaSrcPosition(1,1),KomaDstToPosition(9,9,true)))),
("2b8h+",Ok(Move::To(KomaSrcPosition(2,2),KomaDstToPosition(8,8,true)))),
("3c7g+",Ok(Move::To(KomaSrcPosition(3,3),KomaDstToPosition(7,7,true)))),
("4d6f+",Ok(Move::To(KomaSrcPosition(4,4),KomaDstToPosition(6,6,true)))),
("5e1a+",Ok(Move::To(KomaSrcPosition(5,5),KomaDstToPosition(1,1,true)))),
("1a5e+",Ok(Move::To(KomaSrcPosition(1,1),KomaDstToPosition(5,5,true)))),
("6f4d+",Ok(Move::To(KomaSrcPosition(6,6),KomaDstToPosition(4,4,true)))),
("7g3c+",Ok(Move::To(KomaSrcPosition(7,7),KomaDstToPosition(3,3,true)))),
("8h2b+",Ok(Move::To(KomaSrcPosition(8,8),KomaDstToPosition(2,2,true)))),
("9i1a+",Ok(Move::To(KomaSrcPosition(9,9),KomaDstToPosition(1,1,true)))),
];
for (i,r) in input_and_expected.into_iter() {
assert_eq!(Move::try_from(&i),r);
}
} | rust_cleaned_test_functions.jsonl/46530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
53283,
5673,
368,
972,
10217,
1946,
8378,
32190,
25,
10050,
27,
2099,
6,
1978,
607,
11,
2077,
27,
9860,
11,
3990,
12012,
1454,
3464,
2452,
16018,
284,
7486,
20703,
319,
197,
197,
19814,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_native_libs_tracking_hash_different_values() {
let mut v1 = super::basic_options();
let mut v2 = super::basic_options();
let mut v3 = super::basic_options();
// Reference
v1.libs = vec![(String::from("a"), cstore::NativeStatic),
(String::from("b"), cstore::NativeFramework),
(String::from("c"), cstore::NativeUnknown)];
// Change label
v2.libs = vec![(String::from("a"), cstore::NativeStatic),
(String::from("X"), cstore::NativeFramework),
(String::from("c"), cstore::NativeUnknown)];
// Change kind
v3.libs = vec![(String::from("a"), cstore::NativeStatic),
(String::from("b"), cstore::NativeStatic),
(String::from("c"), cstore::NativeUnknown)];
assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
} | rust_cleaned_test_functions.jsonl/122249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 603
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44494,
16142,
82,
66105,
8950,
82741,
9146,
368,
341,
286,
1077,
5206,
348,
16,
284,
2256,
486,
22342,
8743,
543,
286,
1077,
5206,
348,
17,
284,
2256,
486,
22342,
8743,
543,
286,
1077,
5206,
348... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_unique_event() {
let trim_at = 5;
let trim_to = 2;
let mut events: Vec<String> = vec![];
assert!(check_unique_event(
"A".into(),
&mut events,
trim_at,
trim_to
));
assert_eq!(vec!["A"], events);
assert!(check_unique_event(
"B".into(),
&mut events,
trim_at,
trim_to
));
assert_eq!(vec!["A", "B"], events);
assert!(!check_unique_event(
"B".into(),
&mut events,
trim_at,
trim_to
));
assert_eq!(vec!["A", "B"], events);
assert!(check_unique_event(
"C".into(),
&mut events,
trim_at,
trim_to
));
assert!(check_unique_event(
"D".into(),
&mut events,
trim_at,
trim_to
));
assert!(check_unique_event(
"E".into(),
&mut events,
trim_at,
trim_to
));
assert_eq!(vec!["A", "B", "C", "D", "E"], events);
// next one should trigger a trim!
assert!(check_unique_event(
"F".into(),
&mut events,
trim_at,
trim_to
));
assert_eq!(vec!["E", "F"], events);
} | rust_cleaned_test_functions.jsonl/32326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 845
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
21218,
6748,
368,
341,
286,
1077,
11013,
3752,
284,
220,
20,
280,
286,
1077,
11013,
2346,
284,
220,
17,
280,
286,
1077,
5206,
4357,
25,
11312,
3464,
29,
284,
7486,
0,
40901,
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... | 1 |
#[test]
fn test_datetime_sub() {
let ymdhms = |y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s);
assert_eq!(ymdhms(2014, 5, 6, 7, 8, 9) - ymdhms(2014, 5, 6, 7, 8, 9), Duration::zero());
assert_eq!(ymdhms(2014, 5, 6, 7, 8, 10) - ymdhms(2014, 5, 6, 7, 8, 9),
Duration::seconds(1));
assert_eq!(ymdhms(2014, 5, 6, 7, 8, 9) - ymdhms(2014, 5, 6, 7, 8, 10),
Duration::seconds(-1));
assert_eq!(ymdhms(2014, 5, 7, 7, 8, 9) - ymdhms(2014, 5, 6, 7, 8, 10),
Duration::seconds(86399));
assert_eq!(ymdhms(2001, 9, 9, 1, 46, 39) - ymdhms(1970, 1, 1, 0, 0, 0),
Duration::seconds(999_999_999));
} | rust_cleaned_test_functions.jsonl/99633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 422
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
5228,
368,
341,
286,
1077,
379,
2277,
71,
1011,
284,
760,
88,
13086,
11991,
19806,
10128,
10671,
91,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7021,
13086,
11991,
568,
437,
1523,
1011,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul_checked() {
let a = Primitive::from(&vec![None, Some(6), None, Some(6)]).to(DataType::Int32);
let b = Primitive::from(&vec![Some(5), None, None, Some(6)]).to(DataType::Int32);
let result = checked_mul(&a, &b).unwrap();
let expected = Primitive::from(&vec![None, None, None, Some(36)]).to(DataType::Int32);
assert_eq!(result, expected);
let a = Primitive::from(&vec![Some(100i8), Some(100i8), Some(100i8)]).to(DataType::Int8);
let b = Primitive::from(&vec![Some(1i8), Some(100i8), Some(1i8)]).to(DataType::Int8);
let result = checked_mul(&a, &b).unwrap();
let expected = Primitive::from(&vec![Some(100i8), None, Some(100i8)]).to(DataType::Int8);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/12703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
56456,
368,
341,
286,
1077,
264,
284,
51460,
486,
1499,
2099,
4083,
20703,
4064,
11,
4329,
7,
21,
701,
2240,
11,
4329,
7,
21,
7252,
568,
983,
63941,
486,
1072,
18,
17,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_first_not_connect() {
let main = "127.0.0.1:19500".parse().unwrap();
let other = "127.0.0.1:19501".parse().unwrap();
let mut connect_list = ConnectList::default();
let mut t1 = ConnectionParams::from_address(main);
let main_key = t1.connect_info.public_key;
connect_list.add(t1.connect_info.clone());
let mut t2 = ConnectionParams::from_address(other);
connect_list.add(t2.connect_info.clone());
let connect_list = SharedConnectList::from_connect_list(connect_list);
let node = TestEvents::with_addr(main, &connect_list);
let other_node = TestEvents::with_addr(other, &connect_list);
let mut node = t1.spawn(node, connect_list.clone());
let other_node = t2.spawn(other_node, connect_list.clone());
let message = raw_message(1000);
other_node.send_to(main_key, message.clone()); // should connect before send message
assert_eq!(node.wait_for_connect(), t2.connect);
assert_eq!(node.wait_for_message(), message);
} | rust_cleaned_test_functions.jsonl/46396 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
12978,
7913,
15720,
368,
341,
262,
1077,
1887,
284,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
16,
24,
20,
15,
15,
3263,
6400,
1005,
15454,
543,
262,
1077,
1008,
284,
330,
16,
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_merge_unmodified_blob_into_blob_into_tree() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let ours = commit! {
foo {
bar < "bar contents"
}
};
let theirs = commit! {
foo < "default foo contents"
};
repo.three_way_merge(ours, theirs)?;
assert_eq!(cat!(repo: "foo/bar"), "bar contents");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94164 | {
"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,
20888,
4907,
27162,
45908,
45514,
45908,
45514,
11663,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
11350,
284,
5266,
0,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_key_derivation() {
let data = hex::decode("7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f").unwrap();
let mnemonic = Mnemonic::from("legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal will").unwrap();
assert_eq!(
mnemonic.to_string(),
Mnemonic::mnemonic(&data).unwrap().to_string()
);
let seed = Seed::new(&mnemonic, "LIBRA");
let key_factory = KeyFactory::new(&seed).unwrap();
assert_eq!(
"16274c9618ed59177ca948529c1884ba65c57984d562ec2b4e5aa1ee3e3903be",
hex::encode(&key_factory.master())
);
// Check child_0 key derivation.
let child_private_0 = key_factory.private_child(ChildNumber(0)).unwrap();
assert_eq!(
"358a375f36d74c30b7f3299b62d712b307725938f8cc931100fbd10a434fc8b9",
hex::encode(&child_private_0.private_key.to_bytes()[..])
);
let child_private_0_again = key_factory.private_child(ChildNumber(0)).unwrap();
assert_eq!(
hex::encode(&child_private_0.private_key.to_bytes()[..]),
hex::encode(&child_private_0_again.private_key.to_bytes()[..])
);
// Check child_1 key derivation.
let child_private_1 = key_factory.private_child(ChildNumber(1)).unwrap();
assert_eq!(
"a325fe7d27b1b49f191cc03525951fec41b6ffa2d4b3007bb1d9dd353b7e56a6",
hex::encode(&child_private_1.private_key.to_bytes()[..])
);
let mut child_1_again = ChildNumber(0);
child_1_again.increment();
assert_eq!(ChildNumber(1), child_1_again);
let child_private_1_from_increment = key_factory.private_child(child_1_again).unwrap();
assert_eq!(
"a325fe7d27b1b49f191cc03525951fec41b6ffa2d4b3007bb1d9dd353b7e56a6",
hex::encode(&child_private_1_from_increment.private_key.to_bytes()[..])
);
} | rust_cleaned_test_functions.jsonl/8534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 862
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
35345,
39127,
368,
341,
262,
1077,
821,
284,
12371,
486,
18196,
445,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
22,
69,
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_introduce_var_for_cast() {
check_assist(
introduce_variable,
"
fn main() {
let v = <|>0f32 as u32<|>;
}
",
"
fn main() {
let <|>var_name = 0f32 as u32;
let v = var_name;
}
",
);
} | rust_cleaned_test_functions.jsonl/108765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
47845,
4612,
5478,
5303,
368,
341,
286,
1779,
12083,
380,
1006,
310,
19131,
14635,
345,
310,
6228,
8822,
1887,
368,
341,
262,
1077,
348,
284,
82639,
29,
15,
69,
18,
17,
438,
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 |
#[test]
fn test_clone_from() {
let mut v = vec![];
let three: Vec<Box<_>> = vec![box 1, box 2, box 3];
let two: Vec<Box<_>> = vec![box 4, box 5];
v.clone_from(&three);
assert_eq!(v, three);
// equal
v.clone_from(&three);
assert_eq!(v, three);
v.clone_from(&two);
assert_eq!(v, two);
v.clone_from(&three);
assert_eq!(v, three)
} | rust_cleaned_test_functions.jsonl/24398 | {
"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,
54742,
5673,
368,
341,
262,
1077,
5206,
348,
284,
7486,
0,
15078,
262,
1077,
2326,
25,
11312,
79852,
32399,
2452,
284,
7486,
20703,
2011,
220,
16,
11,
3745,
220,
17,
11,
3745,
220,
18,
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_byte_array_new_with() -> super::PyResult<()> {
Python::with_gil(|py| -> super::PyResult<()> {
let py_bytearray = PyByteArray::new_with(py, 10, |b: &mut [u8]| {
b.copy_from_slice(b"Hello Rust");
Ok(())
})?;
let bytearray: &[u8] = unsafe { py_bytearray.as_bytes() };
assert_eq!(bytearray, b"Hello Rust");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/47846 | {
"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,
19737,
3858,
5921,
6615,
368,
1464,
2256,
486,
13828,
2077,
71698,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
1464,
2256,
486,
13828,
2077,
71698,
341,
310,
1077,
4510,
19737,
1653,
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_ns_rw() {
{
let e: Element = Element::parse(File::open("tests/data/ns1.xml").unwrap()).unwrap();
let mut buf = Vec::new();
e.write(&mut buf);
let e2 = Element::parse(Cursor::new(buf)).unwrap();
assert_eq!(e, e2);
}
{
let e: Element = Element::parse(File::open("tests/data/ns2.xml").unwrap()).unwrap();
let mut buf = Vec::new();
e.write(&mut buf);
let e2 = Element::parse(Cursor::new(buf)).unwrap();
assert_eq!(e, e2);
}
} | rust_cleaned_test_functions.jsonl/15718 | {
"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,
34728,
49566,
368,
341,
262,
341,
286,
1077,
384,
25,
8543,
284,
8543,
486,
6400,
19821,
486,
2508,
445,
23841,
13167,
82492,
16,
9028,
1827,
15454,
6011,
15454,
1428,
286,
1077,
5206,
6607,
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_set_root_object_properties() {
let mut doc = Frontend::new();
let change_request = doc
.change::<_, InvalidChangeRequest>(Some("set root object".into()), |doc| {
doc.add_change(LocalChange::set(
Path::root().key("bird"),
Value::Primitive(amp::ScalarValue::Str("magpie".to_string())),
))?;
Ok(())
})
.unwrap()
// Remove timestamp which is irrelevant to test
.map(|mut cr| {
cr.time = None;
cr
});
let expected_change = amp::Request {
actor: doc.actor_id,
seq: 1,
version: 0,
time: None,
message: Some("set root object".into()),
undoable: true,
deps: None,
ops: Some(vec![amp::Op {
action: amp::OpType::Set,
obj: ROOT_ID.to_string(),
key: amp::RequestKey::Str("bird".to_string()),
child: None,
value: Some(amp::ScalarValue::Str("magpie".to_string())),
datatype: Some(amp::DataType::Undefined),
insert: false,
}]),
request_type: amp::RequestType::Change,
};
assert_eq!(change_request, Some(expected_change));
} | rust_cleaned_test_functions.jsonl/75976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
12993,
5314,
25158,
368,
341,
262,
1077,
5206,
4629,
284,
14902,
408,
486,
931,
543,
262,
1077,
2297,
7893,
284,
4629,
198,
286,
659,
3373,
27638,
6878,
13882,
4072,
1900,
2235,
8373,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_load_extension() {
let conn = connection_without_transaction();
// disable extension loading
conn.disable_load_extension().unwrap();
// try loading module without enabling extension loading
let result = sql_query("SELECT load_extension('/tmp/foo');")
.execute(&conn)
.expect_err("should have been error");
assert_eq!(&format!("{}", &result), "not authorized");
// enable extension loading
conn.enable_load_extension().unwrap();
// try loading module without enabling extension loading
let result = sql_query("SELECT load_extension('/tmp/foo');")
.execute(&conn)
.expect_err("should have been error");
assert_ne!(&format!("{}", &result), "not authorized");
} | rust_cleaned_test_functions.jsonl/79416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
31035,
368,
341,
262,
1077,
4534,
284,
3633,
39904,
28884,
1428,
262,
442,
11156,
8894,
8277,
198,
262,
4534,
42628,
12411,
31035,
1005,
15454,
1428,
262,
442,
1430,
8277,
4688,
2041,
27362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_snapshots() {
let id = Id::random::<Provider>().expect(line_error!());
let key = Key::<Provider>::random().expect(line_error!());
let blobs = Blob::new();
let mut client = Client::new(id, blobs);
client.add_vault(&key);
let tx_id = client.create_record(key.clone(), b"data".to_vec());
let key_2 = Key::<Provider>::random().expect(line_error!());
let key_3 = Key::<Provider>::random().expect(line_error!());
client.add_vault(&key_2);
let tx_id_2 = client.create_record(key_2.clone(), b"more_data".to_vec());
client.list_valid_ids_for_vault(key.clone());
client.list_valid_ids_for_vault(key_2.clone());
client.read_record(key_2.clone(), tx_id_2.unwrap());
client.read_record(key.clone(), tx_id.unwrap());
client.add_vault(&key_3.clone());
let tx_id_3 = client.create_record(key_3.clone(), b"3rd vault data".to_vec());
client.read_record(key_3.clone(), tx_id_3.unwrap());
client.list_valid_ids_for_vault(key_3.clone());
let snapshot_path = PathBuf::from("./test.snapshot");
serialize_to_snapshot(&snapshot_path, "password", client);
let mut client = deserialize_from_snapshot(&snapshot_path, "password");
client.preform_gc(key.clone());
client.preform_gc(key_2.clone());
client.preform_gc(key_3.clone());
let tx_id_4 = client.create_record(key_3.clone(), b"Another Piece of data in the 3rd vault".to_vec());
client.list_valid_ids_for_vault(key_2.clone());
client.list_valid_ids_for_vault(key.clone());
client.list_valid_ids_for_vault(key_3.clone());
client.read_record(key.clone(), tx_id.unwrap());
client.read_record(key_3.clone(), tx_id_3.unwrap());
client.read_record(key_2.clone(), tx_id_2.unwrap());
client.read_record(key_3, tx_id_4.unwrap());
} | rust_cleaned_test_functions.jsonl/68827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 872
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74175,
27634,
368,
341,
286,
1077,
877,
284,
5223,
486,
11463,
27638,
5179,
10483,
17119,
8797,
4096,
0,
1423,
286,
1077,
1376,
284,
5309,
27638,
5179,
6831,
11463,
1005,
17119,
8797,
4096,
0,
523... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_string_to_binary() {
assert_eq!(hex_string_to_binary("0123456789abcdef"), Ok(vec![0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]));
assert!(hex_string_to_binary("0123456789abcde").is_err());
assert!(hex_string_to_binary("0123456789abcdefg").is_err());
} | rust_cleaned_test_functions.jsonl/115258 | {
"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,
32655,
3904,
2346,
31761,
368,
341,
286,
2060,
10714,
10297,
17308,
3904,
2346,
31761,
445,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
41202,
3975,
7622,
25592,
20703,
15,
87,
15,
16,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_take_pod_class_by_value() {
let cxx = indoc! {"
uint32_t take_bob(Bob a) {
return a.a;
}
"};
let hdr = indoc! {"
#include <cstdint>
class Bob {
public:
uint32_t a;
uint32_t b;
};
uint32_t take_bob(Bob a);
"};
let rs = quote! {
let a = ffi::Bob { a: 12, b: 13 };
assert_eq!(ffi::take_bob(a), 12);
};
run_test(cxx, hdr, rs, &["take_bob"], &["Bob"]);
} | rust_cleaned_test_functions.jsonl/9756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
85337,
4790,
3710,
3142,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
2622,
18,
17,
528,
1896,
880,
674,
5349,
674,
264,
8,
341,
310,
470,
264,
5849,
280,
286,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_domain() {
let spec = ChainSpec::mainnet();
test_domain(Domain::BeaconProposer, spec.domain_beacon_proposer, &spec);
test_domain(Domain::BeaconAttester, spec.domain_beacon_attester, &spec);
test_domain(Domain::Randao, spec.domain_randao, &spec);
test_domain(Domain::Deposit, spec.domain_deposit, &spec);
test_domain(Domain::VoluntaryExit, spec.domain_voluntary_exit, &spec);
} | rust_cleaned_test_functions.jsonl/90750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
20111,
368,
341,
286,
1077,
1398,
284,
28525,
8327,
486,
3817,
4711,
1428,
286,
1273,
20111,
5432,
3121,
486,
3430,
22379,
2008,
23438,
11,
1398,
11003,
880,
12508,
443,
21663,
23438,
11,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_d01_p1_proper() {
let input = generate_input(&std::fs::read_to_string("./input/2018/day1.txt").unwrap());
let result = solve_part_1(&input);
assert_eq!(466, result);
} | rust_cleaned_test_functions.jsonl/71161 | {
"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,
814,
15,
16,
620,
16,
2540,
712,
368,
341,
286,
1077,
1946,
284,
6923,
5898,
2099,
1834,
486,
3848,
486,
878,
2346,
3904,
13988,
1355,
14,
17,
15,
16,
23,
44739,
16,
3909,
1827,
15454,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3mask_not() {
assert_eq!((!Vec3Mask::new(false, false, false)).bitmask(), 0b111);
assert_eq!((!Vec3Mask::new(true, true, true)).bitmask(), 0b000);
assert_eq!((!Vec3Mask::new(true, false, true)).bitmask(), 0b010);
assert_eq!((!Vec3Mask::new(false, true, false)).bitmask(), 0b101);
} | rust_cleaned_test_functions.jsonl/48600 | {
"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,
13251,
18,
11258,
7913,
368,
341,
262,
2060,
10714,
0,
1188,
0,
10050,
18,
12686,
486,
931,
3576,
11,
895,
11,
895,
4579,
4489,
11258,
1507,
220,
15,
65,
16,
16,
16,
317,
262,
2060,
10714,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_virtio_features() {
// Test all feature combinations.
for must_tell_host in vec![true, false].iter() {
for deflate_on_oom in vec![true, false].iter() {
for stats_interval in vec![0, 1].iter() {
let mut balloon =
Balloon::new(0, *must_tell_host, *deflate_on_oom, *stats_interval, false)
.unwrap();
assert_eq!(balloon.device_type(), TYPE_BALLOON);
let features: u64 = (1u64 << VIRTIO_F_VERSION_1)
| ((if *must_tell_host { 1 } else { 0 })
<< VIRTIO_BALLOON_F_MUST_TELL_HOST)
| ((if *deflate_on_oom { 1 } else { 0 })
<< VIRTIO_BALLOON_F_DEFLATE_ON_OOM)
| ((*stats_interval as u64) << VIRTIO_BALLOON_F_STATS_VQ);
assert_eq!(balloon.avail_features_by_page(0), features as u32);
assert_eq!(balloon.avail_features_by_page(1), (features >> 32) as u32);
for i in 2..10 {
assert_eq!(balloon.avail_features_by_page(i), 0u32);
}
for i in 0..10 {
balloon.ack_features_by_page(i, u32::MAX);
}
// Only present features should be acknowledged.
assert_eq!(balloon.acked_features, features);
}
}
}
} | rust_cleaned_test_functions.jsonl/133170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 920
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
14965,
368,
341,
286,
442,
3393,
678,
4565,
27459,
624,
286,
369,
1969,
528,
613,
12848,
304,
7486,
20703,
1866,
11,
895,
936,
2015,
368,
341,
310,
369,
92689,
4470,
62,
4191,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_what_do() {
assert_eq!(
SyncAction::PopulateRemote,
Syncer::what_do(RemoteDataState::Empty, LocalDataState::Unchanged)
);
assert_eq!(
SyncAction::PopulateRemote,
Syncer::what_do(RemoteDataState::Empty, LocalDataState::Changed)
);
assert_eq!(
SyncAction::NoOp,
Syncer::what_do(RemoteDataState::Unchanged, LocalDataState::Unchanged)
);
assert_eq!(
SyncAction::RemoteFastForward,
Syncer::what_do(RemoteDataState::Unchanged, LocalDataState::Changed)
);
assert_eq!(
SyncAction::LocalFastForward,
Syncer::what_do(RemoteDataState::Changed, LocalDataState::Unchanged)
);
assert_eq!(
SyncAction::CombineChanges,
Syncer::what_do(RemoteDataState::Changed, LocalDataState::Changed)
);
} | rust_cleaned_test_functions.jsonl/104885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
12555,
26309,
368,
341,
286,
2060,
10714,
33673,
310,
28937,
2512,
486,
11598,
6334,
24703,
345,
310,
28937,
261,
486,
12555,
26309,
2785,
336,
1272,
1043,
1397,
486,
3522,
11,
8774,
1043,
139... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simd_load_set_invalid() {
let a = Int64Array::from(vec![None, Some(15), Some(5), Some(0)]);
let new_bitmap = &Some(Bitmap::from(Buffer::from([0b00001010])));
let simd_lanes = 8;
let result = unsafe {
simd_load_set_invalid::<Int64Type>(&a, &new_bitmap, 0, simd_lanes, 1)
};
for i in 0..simd_lanes {
if i == 1 {
assert_eq!(15_i64, result.extract(i));
} else if i == 3 {
assert_eq!(0_i64, result.extract(i));
} else {
assert_eq!(1_i64, result.extract(i));
}
}
} | rust_cleaned_test_functions.jsonl/16034 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18314,
67,
12411,
2602,
31433,
368,
341,
286,
1077,
264,
284,
1333,
21,
19,
1857,
486,
1499,
25592,
20703,
4064,
11,
4329,
7,
16,
20,
701,
4329,
7,
20,
701,
4329,
7,
15,
41958,
286,
1077,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_scope() {
let mut compiler = Compiler::new();
compiler.declare_local(String::from("var1"));
compiler.declare_local(String::from("var2"));
compiler.push_scope();
compiler.declare_local(String::from("var3"));
assert_eq!(compiler.locals.len(), 3);
let push_ops = compiler.pop_scope();
assert_eq!(push_ops, vec![Op::Pop]);
assert_eq!(compiler.locals.len(), 2);
} | rust_cleaned_test_functions.jsonl/55424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23199,
368,
341,
262,
1077,
5206,
19415,
284,
45631,
486,
931,
543,
262,
19415,
2285,
67554,
13564,
2242,
486,
1499,
445,
947,
16,
4010,
262,
19415,
2285,
67554,
13564,
2242,
486,
1499,
445,
947,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_series_equal() {
let a = Series::new("a", &[1, 2, 3]);
let b = Series::new("a", &[1, 2, 3]);
assert!(a.series_equal(&b));
let s = Series::new("foo", &[None, Some(1i64)]);
assert!(s.series_equal_missing(&s));
} | rust_cleaned_test_functions.jsonl/22779 | {
"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,
35015,
11478,
368,
341,
286,
1077,
264,
284,
11131,
486,
931,
445,
64,
497,
44590,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
1077,
293,
284,
11131,
486,
931,
445,
64,
497,
44590,
16,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_gtk_element() {
let gtk = Gtk::new(1, GtkInfoTx::_OnlyRx, &vec![24; 16][..]);
assert_eq!(gtk.info.key_id(), 1);
assert_eq!(gtk.info.tx(), 0);
assert_eq!(>k.gtk[..], &vec![24; 16][..]);
} | rust_cleaned_test_functions.jsonl/52436 | {
"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,
8657,
1889,
6242,
7894,
368,
341,
286,
1077,
18692,
284,
27296,
486,
931,
7,
16,
11,
27296,
1731,
31584,
13541,
7308,
50639,
11,
609,
4083,
20703,
17,
19,
26,
220,
16,
21,
1457,
496,
2558,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_count_l1() {
let transformation = make_count::<i64, u32>().unwrap_test();
let arg = vec![1, 2, 3, 4, 5];
let ret = transformation.invoke(&arg).unwrap_test();
let expected = 5;
assert_eq!(ret, expected);
} | rust_cleaned_test_functions.jsonl/109022 | {
"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,
28230,
3180,
907,
16,
368,
341,
286,
1077,
17991,
284,
1281,
3180,
27638,
72,
21,
19,
11,
575,
18,
17,
10483,
15454,
4452,
543,
286,
1077,
1392,
284,
7486,
20703,
16,
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... | 1 |
#[test]
fn test_match_on_a_slash() {
let string = "~a/24";
let option_test: Option<Mechanism<String>>;
option_test = helpers::capture_matches(&string, Kind::A);
let test = option_test.unwrap();
assert_eq!(test.is_softfail(), true);
assert_eq!(test.raw(), "/24");
assert_eq!(test.to_string(), "~a/24");
} | rust_cleaned_test_functions.jsonl/90568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
4470,
4306,
11886,
988,
368,
341,
262,
1077,
914,
284,
51269,
64,
14,
17,
19,
876,
262,
1077,
2999,
4452,
25,
6959,
33274,
4737,
67813,
3464,
2452,
401,
262,
2999,
4452,
284,
30187,
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_compile_shift_left_a() {
let compiled = bitwise::compile_shift_left("A".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b00011101);
} | rust_cleaned_test_functions.jsonl/100599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
22230,
9579,
4306,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
22230,
9579,
445,
32,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
262,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_quote() -> Result<()> {
let sql = quote("Hello, 'World'");
assert_eq!(&sql, "'Hello, ''World'''");
let sql = baquote("Hello, 'World'");
assert_eq!(&sql, "`Hello, 'World'`");
let sql = dquote("Hello, 'World'");
assert_eq!(&sql, "\"Hello, 'World'\"");
Ok(())
} | rust_cleaned_test_functions.jsonl/12584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45236,
368,
1464,
5714,
71698,
341,
286,
1077,
5704,
284,
12641,
445,
9707,
11,
364,
10134,
28116,
286,
2060,
10714,
0,
2099,
3544,
11,
7178,
9707,
11,
3355,
10134,
18788,
3071,
286,
1077,
5704,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_radians() {
let pi: f64 = consts::PI;
let nan: f64 = NAN;
let inf: f64 = INFINITY;
let neg_inf: f64 = NEG_INFINITY;
assert_eq!(0.0f64.to_radians(), 0.0);
assert_approx_eq!(154.6f64.to_radians(), 2.698279);
assert_approx_eq!((-332.31f64).to_radians(), -5.799903);
assert_eq!(180.0f64.to_radians(), pi);
assert!(nan.to_radians().is_nan());
assert_eq!(inf.to_radians(), inf);
assert_eq!(neg_inf.to_radians(), neg_inf);
} | rust_cleaned_test_functions.jsonl/7846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
1710,
20736,
368,
341,
286,
1077,
8938,
25,
282,
21,
19,
284,
95432,
486,
1893,
280,
286,
1077,
20021,
25,
282,
21,
19,
284,
92129,
280,
286,
1077,
4132,
25,
282,
21,
19,
284,
1964,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_public_data_conversions_deposit() {
let expected_op = {
let priority_op = Deposit {
from: Address::from_str("2a0a81e257a2f5d6ed4f07b81dbda09f107bd026").unwrap(),
to: Address::from_str("21abaed8712072e918632259780e587698ef58da").unwrap(),
token: 42,
amount: BigUint::from(42u32),
};
let account_id = 42u32;
DepositOp {
priority_op,
account_id,
}
};
assert_eq!(
hex::encode(expected_op.get_public_data()),
DEPOSIT_PUBLIC_DATA
);
} | rust_cleaned_test_functions.jsonl/130110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
1769,
3382,
28290,
85798,
368,
341,
286,
1077,
3601,
10287,
284,
341,
310,
1077,
10619,
10287,
284,
48471,
341,
394,
504,
25,
9177,
486,
1499,
2895,
445,
17,
64,
15,
64,
23,
16,
68,
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_write_nonblocking() {
let (_s, stream) = Server::new();
stream.set_nonblocking(true).unwrap();
let cx = SslContext::builder(SslMethod::tls()).unwrap().build();
let mut stream = handshake(Ssl::new(&cx).unwrap().connect(stream));
let mut iterations = 0;
loop {
iterations += 1;
if iterations > 7 {
// Probably a safe assumption for the foreseeable future of
// openssl.
panic!("Too many read/write round trips in handshake!!");
}
let result = stream.ssl_write(b"hello");
match result {
Ok(_) => {
break;
}
Err(Error::WantRead(_)) => {
assert!(wait_io(stream.get_ref(), true, 1000));
}
Err(Error::WantWrite(_)) => {
assert!(wait_io(stream.get_ref(), false, 1000));
}
Err(other) => {
panic!("Unexpected SSL Error: {:?}", other);
}
}
}
// Second write should succeed immediately--plenty of space in kernel
stream.write(" there".as_bytes()).unwrap();
} | rust_cleaned_test_functions.jsonl/35530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 549
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
21637,
70356,
368,
341,
262,
1077,
5453,
82,
11,
4269,
8,
284,
8422,
486,
931,
543,
262,
4269,
980,
21637,
70356,
3715,
568,
15454,
543,
262,
1077,
20716,
284,
328,
3226,
1972,
486,
17850,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_method_call_on_partial() -> TestResult {
let p = Polar::new();
p.load_str("g(x) if x.foo();")?;
let mut q = p.new_query_from_term(term!(call!("g", [sym!("a")])), false);
let error = q.next_event().unwrap_err();
assert!(matches!(
error,
PolarError {
kind: ErrorKind::Runtime(RuntimeError::Unsupported { .. }),
..
}
));
Ok(())
} | rust_cleaned_test_functions.jsonl/63017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
13429,
4470,
52068,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
5104,
2895,
445,
70,
2075,
8,
421,
856,
58432,
2129,
899,
37445,
286,
1077,
5206,
2804,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_utf8_input() {
let mut input = "\0ÀÖØöø˿ͰͽͿ⁰Ⰰ、豈﷏ﷰ𐀀".as_input();
assert_eq!(input.head(), In('\u{0}'));
input.step();
assert_eq!(input.head(), In('\u{C0}'));
input.step();
assert_eq!(input.head(), In('\u{D6}'));
input.step();
assert_eq!(input.head(), In('\u{D8}'));
input.step();
assert_eq!(input.head(), In('\u{F6}'));
input.step();
assert_eq!(input.head(), In('\u{F8}'));
input.step();
assert_eq!(input.head(), In('\u{2FF}'));
input.step();
assert_eq!(input.head(), In('\u{370}'));
input.step();
assert_eq!(input.head(), In('\u{37D}'));
input.step();
assert_eq!(input.head(), In('\u{37F}'));
input.step();
assert_eq!(input.head(), In('\u{1FFF}'));
input.step();
assert_eq!(input.head(), In('\u{2070}'));
input.step();
assert_eq!(input.head(), In('\u{218F}'));
input.step();
assert_eq!(input.head(), In('\u{2C00}'));
input.step();
assert_eq!(input.head(), In('\u{2FEF}'));
input.step();
assert_eq!(input.head(), In('\u{3001}'));
input.step();
assert_eq!(input.head(), In('\u{D7FF}'));
input.step();
assert_eq!(input.head(), In('\u{F900}'));
input.step();
assert_eq!(input.head(), In('\u{FDCF}'));
input.step();
assert_eq!(input.head(), In('\u{FDF0}'));
input.step();
assert_eq!(input.head(), In('\u{10000}'));
input.step();
assert_eq!(input.head(), In('\u{EFFFF}'));
input.step();
assert_eq!(input.head(), Out);
} | rust_cleaned_test_functions.jsonl/32348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 974
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
23,
5898,
368,
341,
286,
1077,
5206,
1946,
284,
2917,
15,
71953,
63361,
144050,
2956,
6151,
135,
123,
137,
108,
137,
121,
137,
123,
123955,
123,
52133,
108,
25928,
237,
124374,
222,
126185,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cookie_secure_string_is_added() {
let cookie = CookieOptions {
cookie_name: "".to_string(),
cookie_value: None,
max_age: None,
domain: None,
path: None,
secure: true,
http_only: false,
same_site: None,
};
assert_eq!(cookie.to_string(), "=; Secure");
} | rust_cleaned_test_functions.jsonl/101600 | {
"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,
38663,
73088,
3904,
6892,
37653,
368,
341,
286,
1077,
12544,
284,
24356,
3798,
341,
310,
12544,
1269,
25,
44907,
983,
3904,
3148,
310,
12544,
3142,
25,
2240,
345,
310,
1932,
32053,
25,
2240,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repeat_with_take_collect() {
let mut curr = 1;
let v: Vec<_> = repeat_with(|| { let tmp = curr; curr *= 2; tmp })
.take(5).collect();
assert_eq!(v, vec![1, 2, 4, 8, 16]);
} | rust_cleaned_test_functions.jsonl/54171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41975,
6615,
73261,
68140,
368,
341,
262,
1077,
5206,
9804,
284,
220,
16,
280,
262,
1077,
348,
25,
11312,
32399,
29,
284,
13153,
6615,
79453,
314,
1077,
4174,
284,
9804,
26,
9804,
11404,
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... | 2 |
#[test]
fn test_sanity_on_in_flight_opens() {
do_test_sanity_on_in_flight_opens(0);
do_test_sanity_on_in_flight_opens(0 | 0b1000_0000);
do_test_sanity_on_in_flight_opens(1);
do_test_sanity_on_in_flight_opens(1 | 0b1000_0000);
do_test_sanity_on_in_flight_opens(2);
do_test_sanity_on_in_flight_opens(2 | 0b1000_0000);
do_test_sanity_on_in_flight_opens(3);
do_test_sanity_on_in_flight_opens(3 | 0b1000_0000);
do_test_sanity_on_in_flight_opens(4);
do_test_sanity_on_in_flight_opens(4 | 0b1000_0000);
do_test_sanity_on_in_flight_opens(5);
do_test_sanity_on_in_flight_opens(5 | 0b1000_0000);
do_test_sanity_on_in_flight_opens(6);
do_test_sanity_on_in_flight_opens(6 | 0b1000_0000);
do_test_sanity_on_in_flight_opens(7);
do_test_sanity_on_in_flight_opens(7 | 0b1000_0000);
do_test_sanity_on_in_flight_opens(8);
do_test_sanity_on_in_flight_opens(8 | 0b1000_0000);
} | rust_cleaned_test_functions.jsonl/16863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
38270,
4470,
1243,
90370,
10287,
724,
368,
341,
19935,
4452,
643,
38270,
4470,
1243,
90370,
10287,
724,
7,
15,
317,
19935,
4452,
643,
38270,
4470,
1243,
90370,
10287,
724,
7,
15,
760,
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_io_memory_layout() {
use std::mem;
assert_eq!(mem::size_of::<Io>(), mem::size_of::<sys::ImGuiIO>());
assert_eq!(mem::align_of::<Io>(), mem::align_of::<sys::ImGuiIO>());
use memoffset::offset_of;
use sys::ImGuiIO;
macro_rules! assert_field_offset {
($l:ident, $r:ident) => {
assert_eq!(offset_of!(Io, $l), offset_of!(ImGuiIO, $r));
};
};
assert_field_offset!(config_flags, ConfigFlags);
assert_field_offset!(backend_flags, BackendFlags);
assert_field_offset!(display_size, DisplaySize);
assert_field_offset!(delta_time, DeltaTime);
assert_field_offset!(ini_saving_rate, IniSavingRate);
assert_field_offset!(ini_filename, IniFilename);
assert_field_offset!(log_filename, LogFilename);
assert_field_offset!(mouse_double_click_time, MouseDoubleClickTime);
assert_field_offset!(mouse_double_click_max_dist, MouseDoubleClickMaxDist);
assert_field_offset!(mouse_drag_threshold, MouseDragThreshold);
assert_field_offset!(key_map, KeyMap);
assert_field_offset!(key_repeat_delay, KeyRepeatDelay);
assert_field_offset!(key_repeat_rate, KeyRepeatRate);
assert_field_offset!(user_data, UserData);
assert_field_offset!(fonts, Fonts);
assert_field_offset!(font_global_scale, FontGlobalScale);
assert_field_offset!(font_allow_user_scaling, FontAllowUserScaling);
assert_field_offset!(font_default, FontDefault);
assert_field_offset!(display_framebuffer_scale, DisplayFramebufferScale);
assert_field_offset!(mouse_draw_cursor, MouseDrawCursor);
assert_field_offset!(config_mac_os_behaviors, ConfigMacOSXBehaviors);
assert_field_offset!(config_input_text_cursor_blink, ConfigInputTextCursorBlink);
assert_field_offset!(
config_windows_resize_from_edges,
ConfigWindowsResizeFromEdges
);
assert_field_offset!(
config_windows_move_from_title_bar_only,
ConfigWindowsMoveFromTitleBarOnly
);
assert_field_offset!(backend_platform_name, BackendPlatformName);
assert_field_offset!(backend_renderer_name, BackendRendererName);
assert_field_offset!(backend_platform_user_data, BackendPlatformUserData);
assert_field_offset!(backend_renderer_user_data, BackendRendererUserData);
assert_field_offset!(backend_language_user_data, BackendLanguageUserData);
assert_field_offset!(get_clipboard_text_fn, GetClipboardTextFn);
assert_field_offset!(set_clipboard_text_fn, SetClipboardTextFn);
assert_field_offset!(clipboard_user_data, ClipboardUserData);
assert_field_offset!(ime_set_input_screen_pos_fn, ImeSetInputScreenPosFn);
assert_field_offset!(ime_window_handle, ImeWindowHandle);
assert_field_offset!(render_draw_lists_fn_unused, RenderDrawListsFnUnused);
assert_field_offset!(mouse_pos, MousePos);
assert_field_offset!(mouse_down, MouseDown);
assert_field_offset!(mouse_wheel, MouseWheel);
assert_field_offset!(mouse_wheel_h, MouseWheelH);
assert_field_offset!(key_ctrl, KeyCtrl);
assert_field_offset!(key_shift, KeyShift);
assert_field_offset!(key_alt, KeyAlt);
assert_field_offset!(key_super, KeySuper);
assert_field_offset!(keys_down, KeysDown);
assert_field_offset!(nav_inputs, NavInputs);
assert_field_offset!(want_capture_mouse, WantCaptureMouse);
assert_field_offset!(want_capture_keyboard, WantCaptureKeyboard);
assert_field_offset!(want_text_input, WantTextInput);
assert_field_offset!(want_set_mouse_pos, WantSetMousePos);
assert_field_offset!(want_save_ini_settings, WantSaveIniSettings);
assert_field_offset!(nav_active, NavActive);
assert_field_offset!(nav_visible, NavVisible);
assert_field_offset!(framerate, Framerate);
assert_field_offset!(metrics_render_vertices, MetricsRenderVertices);
assert_field_offset!(metrics_render_indices, MetricsRenderIndices);
assert_field_offset!(metrics_render_windows, MetricsRenderWindows);
assert_field_offset!(metrics_active_windows, MetricsActiveWindows);
assert_field_offset!(metrics_active_allocations, MetricsActiveAllocations);
assert_field_offset!(mouse_delta, MouseDelta);
assert_field_offset!(mouse_pos_prev, MousePosPrev);
assert_field_offset!(mouse_clicked_pos, MouseClickedPos);
assert_field_offset!(mouse_clicked_time, MouseClickedTime);
assert_field_offset!(mouse_clicked, MouseClicked);
assert_field_offset!(mouse_double_clicked, MouseDoubleClicked);
assert_field_offset!(mouse_released, MouseReleased);
assert_field_offset!(mouse_down_owned, MouseDownOwned);
assert_field_offset!(mouse_down_was_double_click, MouseDownWasDoubleClick);
assert_field_offset!(mouse_down_duration, MouseDownDuration);
assert_field_offset!(mouse_down_duration_prev, MouseDownDurationPrev);
assert_field_offset!(mouse_drag_max_distance_abs, MouseDragMaxDistanceAbs);
assert_field_offset!(mouse_drag_max_distance_sqr, MouseDragMaxDistanceSqr);
assert_field_offset!(keys_down_duration, KeysDownDuration);
assert_field_offset!(keys_down_duration_prev, KeysDownDurationPrev);
assert_field_offset!(nav_inputs_down_duration, NavInputsDownDuration);
assert_field_offset!(nav_inputs_down_duration_prev, NavInputsDownDurationPrev);
assert_field_offset!(input_queue_characters, InputQueueCharacters);
} | rust_cleaned_test_functions.jsonl/60544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1988
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16939,
19195,
14466,
368,
341,
262,
990,
1460,
486,
10536,
280,
262,
2060,
10714,
10297,
10536,
486,
2141,
3575,
27638,
42799,
39019,
1833,
486,
2141,
3575,
27638,
7791,
486,
37950,
3810,
32872,
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_block_cache_capacity() {
let path = tempdir_with_prefix("_rust_rocksdb_set_and_get_block_cache_capacity");
let mut opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
opts.create_if_missing(true);
let mut block_opts = BlockBasedOptions::new();
let mut cache_opts = LRUCacheOptions::new();
cache_opts.set_capacity(16 * 1024 * 1024);
block_opts.set_block_cache(&Cache::new_lru_cache(cache_opts));
cf_opts.set_block_based_table_factory(&block_opts);
let db = DB::open_cf(
opts,
path.path().to_str().unwrap(),
vec![("default", cf_opts)],
)
.unwrap();
assert_eq!(
db.get_options().get_block_cache_capacity(),
16 * 1024 * 1024
);
let opt = db.get_options();
opt.set_block_cache_capacity(32 * 1024 * 1024).unwrap();
assert_eq!(
db.get_options().get_block_cache_capacity(),
32 * 1024 * 1024
);
} | rust_cleaned_test_functions.jsonl/34108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
11529,
35603,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
2602,
8378,
3062,
7113,
11529,
35603,
3071,
262,
1077,
5206,
12185,
284,
5952,
3798,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_up() {
let cxx = indoc! {"
Bob::Bob() : a(3) {
}
uint32_t take_bob(const Bob& a) {
return a.a;
}
"};
let hdr = indoc! {"
#include <cstdint>
class Bob {
public:
Bob();
uint32_t a;
};
uint32_t take_bob(const Bob& a);
"};
let rs = quote! {
let a = ffi::Bob::make_unique(); // TODO test with all sorts of arguments.
assert_eq!(ffi::take_bob(a.as_ref().unwrap()), 3);
};
run_test(cxx, hdr, rs, &["Bob", "take_bob"], &[]);
} | rust_cleaned_test_functions.jsonl/9751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
8237,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
14261,
486,
32388,
368,
549,
264,
7,
18,
8,
341,
286,
456,
286,
2622,
18,
17,
528,
1896,
880,
674,
2741,
14261,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pending_versions() {
let search = json!({
"issues": [
{
"key": "KEY-1",
"fields": {}
},
{
"key": "KEY-2",
"fields": {
"the-field": " 1.2, 3.4,5,7.7.7 "
}
},
{
"key": "KEY-3",
"fields": {
"the-field": "1.2, "
}
}
]
});
let expected =
hashmap! {
"KEY-2".to_string() => vec![
version::Version::parse("1.2").unwrap(),
version::Version::parse("3.4").unwrap(),
version::Version::parse("5").unwrap(),
version::Version::parse("7.7.7").unwrap()
],
"KEY-3".to_string() => vec![
version::Version::parse("1.2").unwrap(),
],
};
let versions = parse_pending_versions(&search, "the-field");
assert_eq!(expected, versions);
} | rust_cleaned_test_functions.jsonl/112383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 762
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
37861,
65148,
368,
341,
286,
1077,
2711,
284,
2951,
0,
2262,
310,
330,
18427,
788,
2278,
394,
341,
503,
330,
792,
788,
330,
4784,
12,
16,
756,
503,
330,
9007,
788,
5613,
394,
1153,
394,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_input_error_display() {
assert_eq!(
format!("{}", AppError::InvalidInput("An error".to_owned())),
format!("{} An error", Red.bold().paint("[InvalidInputError]"))
);
} | rust_cleaned_test_functions.jsonl/63281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
5898,
4096,
14825,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
79878,
1845,
1454,
486,
7928,
2505,
445,
2082,
1465,
3263,
983,
51973,
73727,
310,
3561,
17223,
6257,
1527,
1465,
497,
3731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_comment_select() {
let expected_sql = "SELECT \"users\".* FROM \"users\" /* trace_id='5bd66ef5095369c7b0d1f8f4bd33716a', parent_id='c532cb4098ac3dd2' */";
let query = Select::from_table("users")
.comment("trace_id='5bd66ef5095369c7b0d1f8f4bd33716a', parent_id='c532cb4098ac3dd2'");
let (sql, _) = Postgres::build(query).unwrap();
assert_eq!(expected_sql, sql);
} | rust_cleaned_test_functions.jsonl/6451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17638,
13051,
368,
341,
286,
1077,
3601,
18063,
284,
330,
4858,
7245,
4218,
2105,
4908,
4295,
7245,
4218,
2105,
1391,
11655,
842,
1131,
20,
8940,
21,
21,
823,
20,
15,
24,
20,
18,
21,
24,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dynamic_rmq() {
let mut arq = DynamicArq::<AssignMin>::new(false);
let view = arq.build_from_slice(&[0; 10]);
assert_eq!(arq.query(view, 0, 9), 0);
arq.update(view, 2, 4, &-5);
arq.update(view, 5, 7, &-3);
arq.update(view, 1, 6, &1);
assert_eq!(arq.query(view, 0, 9), -3);
} | rust_cleaned_test_functions.jsonl/44435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45992,
1710,
27674,
368,
341,
286,
1077,
5206,
796,
80,
284,
21886,
6953,
80,
27638,
28933,
6217,
6831,
931,
3576,
317,
286,
1077,
1651,
284,
796,
80,
13239,
5673,
26488,
2099,
58,
15,
26,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.