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_from_bytes_empty() {
let data: Vec<u8> = vec![];
let err = HeaderIdentClass::from_bytes((&data, 0));
assert!(matches!(err, Err(_)));
} | rust_cleaned_test_functions.jsonl/38143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
12524,
15124,
368,
341,
286,
1077,
821,
25,
11312,
34837,
23,
29,
284,
7486,
0,
40901,
286,
1077,
1848,
284,
12104,
28301,
1957,
486,
1499,
12524,
42902,
691,
11,
220,
15,
1106,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_resource_request() {
assert_eq!(
parse_resource_request("Abc=10_234").unwrap(),
("Abc".to_string(), 10234)
);
assert_eq!(
parse_resource_request("X = 1").unwrap(),
("X".to_string(), 1)
);
} | rust_cleaned_test_functions.jsonl/107802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17962,
7893,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
17962,
7893,
445,
5830,
66,
28,
16,
15,
62,
17,
18,
19,
1827,
15454,
3148,
310,
3489,
5830,
66,
3263,
983,
3904,
1507,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_should_have_correct_alphabet() {
let lsys: LSystem = LSystem::new("AB".to_string());
assert!(lsys.alphabet.contains(&'A'));
} | rust_cleaned_test_functions.jsonl/101638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
43378,
67301,
31550,
8418,
18485,
368,
341,
286,
1077,
326,
7791,
25,
444,
2320,
284,
444,
2320,
486,
931,
445,
1867,
3263,
983,
3904,
1423,
286,
2060,
10297,
4730,
1047,
12168,
18485,
8786,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rust_reference_method() {
let hdr = indoc! {"
#include <cstdint>
struct RustType;
uint32_t take_rust_reference(const RustType& foo);
"};
let cxx = indoc! {"
#include \"cxxgen.h\"
uint32_t take_rust_reference(const RustType& foo) {
return foo.get();
}"};
let rs = quote! {
let foo = RustType(3);
assert_eq!(ffi::take_rust_reference(&foo), 3);
};
run_test_ex(
cxx,
hdr,
rs,
quote! {
generate!("take_rust_reference")
},
Some(Box::new(EnableAutodiscover)),
None,
Some(quote! {
#[autocxx::extern_rust_type]
pub struct RustType(i32);
impl RustType {
#[autocxx::extern_rust_function]
pub fn get(&self) -> i32 {
return self.0
}
}
}),
);
} | rust_cleaned_test_functions.jsonl/9934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
590,
25433,
9032,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
96975,
1339,
262,
2036,
33789,
929,
280,
262,
2622,
18,
17,
528,
1896,
1710,
590,
25433,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_all_plugins_can_be_fetched() {
let mut plugins: Vec<Plugin> = get_managed_plugins(&get_test_config());
assert_eq!(plugins.len(), 2);
let first: Plugin = plugins.remove(0);
let second: Plugin = plugins.remove(0);
assert_eq!(first.package_name, "hello/world");
assert_eq!(second.package_name, "hello2/world2");
} | rust_cleaned_test_functions.jsonl/42835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
45658,
27421,
21263,
761,
36780,
368,
341,
262,
1077,
5206,
17215,
25,
11312,
27,
11546,
29,
284,
633,
79889,
45658,
2099,
455,
4452,
5332,
5231,
262,
2060,
10714,
10297,
18716,
19406,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_demo_2() {
let network = create_cave_network(vec![
"dc-end",
"HN-start",
"start-kj",
"dc-start",
"dc-HN",
"LN-dc",
"HN-end",
"kj-sa",
"kj-HN",
"kj-dc"
]);
let start_cave = network["start"].clone();
let end_cave = network["end"].clone();
let paths = find_paths(&network, start_cave.clone(), end_cave.clone());
assert_eq!(103, paths.len());
} | rust_cleaned_test_functions.jsonl/70742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
47830,
62,
17,
368,
341,
286,
1077,
3922,
284,
1855,
666,
523,
20966,
25592,
90515,
310,
330,
7628,
13068,
756,
310,
330,
43165,
18935,
756,
310,
330,
2468,
12646,
73,
756,
310,
330,
7628,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_disable_reporting_and_drain_packets() {
// Interface that responds to reads with Report packets until reporting is disabled and an
// FakeZedmonInterface.
struct StillReportingInterface {
inner: fake_device::FakeZedmonInterface,
reporting_enabled: bool,
packets_enqueued: usize,
}
impl StillReportingInterface {
fn new(coordinator: Rc<RefCell<fake_device::Coordinator>>) -> Self {
Self {
inner: fake_device::FakeZedmonInterface::new(coordinator),
reporting_enabled: true,
packets_enqueued: 1,
}
}
fn make_reports(&self) -> Vec<Report> {
let mut reports = Vec::new();
for i in 0..5 {
reports.push(Report {
timestamp_micros: 1000 * (i as u64),
values: vec![Value::I16(i as i16), Value::I16(-(i as i16))],
});
}
reports
}
}
impl usb_bulk::Open<StillReportingInterface> for StillReportingInterface {
fn open<F>(_matcher: &mut F) -> Result<StillReportingInterface, Error>
where
F: FnMut(&InterfaceInfo) -> bool,
{
Err(format_err!("usb_bulk::Open not implemented"))
}
}
impl Read for StillReportingInterface {
fn read(&mut self, buffer: &mut [u8]) -> std::io::Result<usize> {
if self.reporting_enabled {
Ok(serialize_reports(&self.make_reports(), buffer))
} else if self.packets_enqueued > 0 {
self.packets_enqueued = self.packets_enqueued - 1;
Ok(serialize_reports(&self.make_reports(), buffer))
} else {
self.inner.read(buffer)
}
}
}
impl Write for StillReportingInterface {
fn write(&mut self, data: &[u8]) -> std::io::Result<usize> {
if self.reporting_enabled
&& PacketType::from_u8(data[0]).unwrap() == PacketType::DisableReporting
{
self.reporting_enabled = false;
Ok(1)
} else {
self.inner.write(data)
}
}
fn flush(&mut self) -> std::io::Result<()> {
self.inner.flush()
}
}
let device_config = fake_device::DeviceConfiguration {
shunt_resistance: 0.01,
v_shunt_scale: 1e-5,
v_bus_scale: 0.025,
};
let builder = fake_device::CoordinatorBuilder::new(device_config);
let coordinator = builder.build();
let interface = StillReportingInterface::new(coordinator);
assert!(ZedmonClient::new(interface).is_ok());
} | rust_cleaned_test_functions.jsonl/90579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33842,
52376,
8378,
26680,
466,
63569,
368,
341,
286,
442,
20019,
429,
30580,
311,
15804,
448,
8259,
27035,
3080,
12827,
374,
8386,
323,
458,
8945,
286,
442,
36965,
57,
291,
1645,
5051,
624,
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_ttl_iterator() {
let dir = tempfile::TempDir::new().unwrap();
let engine = TestEngineBuilder::new()
.path(dir.path())
.ttl(true)
.build()
.unwrap();
let kvdb = engine.get_rocksdb();
let key1 = b"key1";
let mut value1 = b"value1".to_vec();
append_expire_ts(&mut value1, 10);
kvdb.put_cf(CF_DEFAULT, key1, &value1).unwrap();
let mut value10 = b"value1".to_vec();
append_expire_ts(&mut value10, 20);
kvdb.put_cf(CF_DEFAULT, key1, &value10).unwrap();
let key2 = b"key2";
let mut value2 = b"value2".to_vec();
append_expire_ts(&mut value2, 20);
kvdb.put_cf(CF_DEFAULT, key2, &value2).unwrap();
let mut value20 = b"value2".to_vec();
append_expire_ts(&mut value20, 10);
kvdb.put_cf(CF_DEFAULT, key2, &value20).unwrap();
let key3 = b"key3";
let mut value3 = b"value3".to_vec();
append_expire_ts(&mut value3, 0);
kvdb.put_cf(CF_DEFAULT, key3, &value3).unwrap();
let key4 = b"key4";
let mut value4 = b"value4".to_vec();
append_expire_ts(&mut value4, 10);
kvdb.put_cf(CF_DEFAULT, key4, &value4).unwrap();
let key5 = b"key5";
let mut value5 = b"value5".to_vec();
append_expire_ts(&mut value5, 0);
kvdb.put_cf(CF_DEFAULT, key5, &value5).unwrap();
let mut value50 = b"value5".to_vec();
append_expire_ts(&mut value50, 10);
kvdb.put_cf(CF_DEFAULT, key5, &value50).unwrap();
let snapshot = engine.snapshot(SnapContext::default()).unwrap();
let ttl_snapshot = TTLSnapshot::from(snapshot);
let mut iter = ttl_snapshot
.iter(IterOptions::new(None, None, false))
.unwrap();
iter.seek_to_first().unwrap();
assert_eq!(iter.key(), b"key1");
assert_eq!(iter.value(), b"value1");
assert_eq!(iter.next().unwrap(), true);
assert_eq!(iter.key(), b"key3");
assert_eq!(iter.value(), b"value3");
assert_eq!(iter.next().unwrap(), false);
iter.seek_to_last().unwrap();
assert_eq!(iter.key(), b"key3");
assert_eq!(iter.value(), b"value3");
assert_eq!(iter.prev().unwrap(), true);
assert_eq!(iter.key(), b"key1");
assert_eq!(iter.value(), b"value1");
assert_eq!(iter.prev().unwrap(), false);
iter.seek(&Key::from_encoded_slice(b"key2")).unwrap();
assert_eq!(iter.valid().unwrap(), true);
assert_eq!(iter.key(), b"key3");
assert_eq!(iter.value(), b"value3");
iter.seek(&Key::from_encoded_slice(b"key4")).unwrap();
assert_eq!(iter.valid().unwrap(), false);
iter.seek_for_prev(&Key::from_encoded_slice(b"key2"))
.unwrap();
assert_eq!(iter.valid().unwrap(), true);
assert_eq!(iter.key(), b"key1");
assert_eq!(iter.value(), b"value1");
iter.seek_for_prev(&Key::from_encoded_slice(b"key1"))
.unwrap();
assert_eq!(iter.valid().unwrap(), true);
assert_eq!(iter.key(), b"key1");
assert_eq!(iter.value(), b"value1");
} | rust_cleaned_test_functions.jsonl/15118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87157,
13491,
368,
341,
286,
1077,
5419,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
741,
310,
659,
2343,
14161,
3875,
2398,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert() {
let base_rope: Rope = vec![0, 1, 2, 3].into();
let mut delta_builder = DeltaBuilder::new(base_rope.len());
delta_builder.replace(1..1, Into::<Rope>::into(vec![5]).into_node());
let insertion = delta_builder.build();
let inversion = Action {
delta: insertion.clone(),
}
.invert(&base_rope);
let inserted_rope = base_rope.apply_delta(&insertion);
assert_eq!(&inserted_rope.slice_to_cow(..), &vec![0, 5, 1, 2, 3]);
let uninserted_rope = inserted_rope.apply_delta(&inversion.delta);
assert_eq!(&uninserted_rope.slice_to_cow(..), &vec![0, 1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/10022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
286,
1077,
2331,
26608,
375,
25,
97896,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
936,
18122,
543,
286,
1077,
5206,
9477,
28532,
284,
24957,
3297,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sum_matrix() {
assert_eq!(A + B + C, [A, B, C].iter().sum());
assert_eq!(A + B + C, [A, B, C].iter().cloned().sum());
} | rust_cleaned_test_functions.jsonl/105428 | {
"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,
10160,
10193,
368,
341,
286,
2060,
10714,
10297,
32,
488,
425,
488,
356,
11,
508,
32,
11,
425,
11,
356,
936,
2015,
1005,
1242,
1423,
286,
2060,
10714,
10297,
32,
488,
425,
488,
356,
11,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_semantic_highlighting_information_serialization() {
test_serialization(
&SemanticHighlightingInformation {
line: 10,
tokens: Some(vec![
SemanticHighlightingToken {
character: 0x00000001,
length: 0x0002,
scope: 0x0003,
},
SemanticHighlightingToken {
character: 0x00112222,
length: 0x0FF0,
scope: 0x0202,
},
]),
},
r#"{"line":10,"tokens":"AAAAAQACAAMAESIiD/ACAg=="}"#,
);
test_serialization(
&SemanticHighlightingInformation {
line: 22,
tokens: None,
},
r#"{"line":22}"#,
);
} | rust_cleaned_test_functions.jsonl/73613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 584
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30442,
8159,
74546,
287,
35212,
25602,
2022,
368,
341,
286,
1273,
25602,
2022,
1006,
310,
609,
97931,
29830,
287,
14873,
341,
394,
1555,
25,
220,
16,
15,
345,
394,
11211,
25,
4329,
25592,
90515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_device_band_info() {
assert_eq!(
fidl_common::Band::WlanBand5Ghz,
get_device_band_info(&fake_device_info_ht(fidl_mlme::ChanWidthSet::TwentyForty), 36)
.unwrap()
.band_id
);
} | rust_cleaned_test_functions.jsonl/17786 | {
"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,
3062,
9204,
45344,
3109,
368,
341,
286,
2060,
10714,
33673,
310,
32104,
75,
21107,
486,
33744,
486,
54,
10715,
33744,
20,
38,
37259,
345,
310,
633,
9204,
45344,
3109,
2099,
30570,
9204,
3109,
4908... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_run() {
let (nodes, commit_rxs) = run_nodes(4, 16_300);
let timer = Timer::default();
let duration = Duration::from_secs(60);
for rx in commit_rxs {
let rx = timer.timeout(rx.map_err(drop), duration);
rx.wait().unwrap();
}
for handle in nodes {
handle
.api_tx
.send_external_message(ExternalMessage::Shutdown)
.unwrap();
handle.node_thread.join().unwrap();
}
} | rust_cleaned_test_functions.jsonl/113558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
14007,
368,
341,
262,
1077,
320,
20008,
11,
5266,
1710,
18561,
8,
284,
1598,
14896,
7,
19,
11,
220,
16,
21,
62,
18,
15,
15,
626,
262,
1077,
9021,
284,
17759,
486,
2258,
543,
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... | 3 |
#[test]
fn test_aead_nonce_sizes() {
let nonce_len = aead::NONCE_LEN;
let nonce = vec![0u8; nonce_len * 2];
assert!(aead::Nonce::try_assume_unique_for_key(&nonce[..nonce_len]).is_ok());
assert!(aead::Nonce::try_assume_unique_for_key(&nonce[..(nonce_len - 1)]).is_err());
assert!(aead::Nonce::try_assume_unique_for_key(&nonce[..(nonce_len + 1)]).is_err());
assert!(aead::Nonce::try_assume_unique_for_key(&nonce[..(nonce_len / 2)]).is_err());
assert!(aead::Nonce::try_assume_unique_for_key(&nonce[..(nonce_len * 2)]).is_err());
assert!(aead::Nonce::try_assume_unique_for_key(&[]).is_err());
assert!(aead::Nonce::try_assume_unique_for_key(&nonce[..1]).is_err());
assert!(aead::Nonce::try_assume_unique_for_key(&nonce[..16]).is_err()); // 128 bits.
} | rust_cleaned_test_functions.jsonl/26766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
3149,
48508,
32159,
368,
341,
262,
1077,
39676,
6043,
284,
264,
3149,
486,
29563,
2104,
15536,
280,
262,
1077,
39676,
284,
7486,
20703,
15,
84,
23,
26,
39676,
6043,
353,
220,
17,
4821,
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_skiplist_get() {
let mut list = SkipList::new();
list.insert(7, 7);
list.insert(4, 4);
list.insert(1, 1);
list.insert(2, 2);
list.insert(3, 3);
list.insert(5, 5);
list.insert(8, 8);
list.insert(6, 6);
let maybe_1 = list.get(&1);
assert!(maybe_1.is_some());
assert_eq!(maybe_1.unwrap(), 1);
let maybe_3 = list.get(&3);
assert!(maybe_3.is_some());
assert_eq!(maybe_3.unwrap(), 3);
} | rust_cleaned_test_functions.jsonl/65969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6642,
39934,
3062,
368,
341,
286,
1077,
5206,
1140,
284,
25784,
852,
486,
931,
543,
286,
1140,
7030,
7,
22,
11,
220,
22,
317,
286,
1140,
7030,
7,
19,
11,
220,
19,
317,
286,
1140,
7030,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_established_sliding_window_recv() {
let mut s = socket_established();
// Update our scaling parameters for a TCP with a scaled buffer.
assert_eq!(s.rx_buffer.len(), 0);
s.rx_buffer = SocketBuffer::new(vec![0; 262143]);
s.assembler = Assembler::new(s.rx_buffer.capacity());
s.remote_win_scale = Some(0);
s.remote_last_win = 65535;
s.remote_win_shift = 2;
// Create a TCP segment that will mostly fill an IP frame.
let mut segment: Vec<u8> = Vec::with_capacity(1400);
for _ in 0..100 { segment.extend_from_slice(b"abcdefghijklmn") }
assert_eq!(segment.len(), 1400);
// Send the frame
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
payload: &segment,
..SEND_TEMPL
});
// Ensure that the received window size is shifted right by 2.
recv!(s, [TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1 + 1400),
window_len: 65185,
..RECV_TEMPL
}]);
} | rust_cleaned_test_functions.jsonl/91837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18583,
5102,
291,
11886,
6577,
12571,
36118,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
442,
5549,
1039,
26943,
5029,
369,
264,
26656,
448,
264,
30690,
4147,
624,
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... | 2 |
#[test]
fn test_function_literal_one_param() {
let (parameters, _) = match statement_expression("fn(x) { return 1; }") {
Expression::FunctionLiteral {
parameters, body, ..
} => (parameters, body),
_ => panic!("not a function literal"),
};
assert_eq!(1, parameters.len());
} | rust_cleaned_test_functions.jsonl/64085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
34100,
11667,
4090,
368,
341,
286,
1077,
320,
13786,
11,
27439,
284,
2432,
5114,
28068,
445,
8822,
2075,
8,
314,
470,
220,
16,
26,
335,
899,
341,
310,
16378,
486,
5152,
17350,
341,
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... | 2 |
#[test]
fn test_default_features() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
[features]
default = ["a"]
a = []
[[test]]
name = "foo"
required-features = ["a"]
"#,
).file("tests/foo.rs", "#[test]\nfn test() {}")
.build();
p.cargo("test")
.with_stderr(
"\
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
).with_stdout_contains("test test ... ok")
.run();
p.cargo("test --no-default-features")
.with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
.with_stdout("")
.run();
p.cargo("test --test=foo")
.with_stderr(
"\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/foo-[..][EXE]",
).with_stdout_contains("test test ... ok")
.run();
p.cargo("test --test=foo --no-default-features")
.with_status(101)
.with_stderr(
"\
error: target `foo` in package `foo` requires the features: `a`
Consider enabling them by passing e.g. `--features=\"a\"`
",
).run();
} | rust_cleaned_test_functions.jsonl/73885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 738
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
14965,
368,
341,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
98228,
73494,
75,
756,
310,
435,
2,
698,
310,
508,
4987,
921,
310,
829,
284,
330,
7975,
698,
310,
2319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parses_mutiple_imports() {
parses_to! {
parser: AwsGoEventsParser,
input: "import (\n\"foo\"\n \"bar\"\n)",
rule: Rule::import_multiple,
tokens: [
import_multiple(0, 23, [
import_package(9, 14, [
package_name(10, 13),
]),
import_package(16, 21, [
package_name(17, 20),
]),
]),
]
};
} | rust_cleaned_test_functions.jsonl/8187 | {
"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,
77113,
288,
29523,
3778,
18434,
82,
368,
341,
310,
70835,
2346,
0,
341,
394,
6729,
25,
40083,
10850,
7900,
6570,
345,
394,
1946,
25,
330,
474,
19788,
77,
2105,
7975,
22245,
77,
7245,
2257,
22245... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_backward() {
let mut masm = MacroAssembler::new();
let lbl = masm.create_label();
masm.bind_label(lbl);
masm.emit_label(lbl);
assert_eq!(vec![0xfc, 0xff, 0xff, 0xff], masm.data());
} | rust_cleaned_test_functions.jsonl/17048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70477,
368,
341,
286,
1077,
5206,
9243,
76,
284,
53317,
77858,
486,
931,
543,
286,
1077,
16421,
284,
9243,
76,
2520,
6106,
543,
286,
9243,
76,
6090,
6106,
70491,
317,
286,
9243,
76,
16812,
6106,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_snail_addition() {
let lhs = parse_line("[[[[4,3],4],4],[7,[[8,4],9]]]");
let rhs = parse_line("[1,1]");
assert_eq!("[[[[0,7],4],[[7,8],[6,0]]],[8,1]]", format!("{:?}", add(lhs, rhs).borrow()));
} | rust_cleaned_test_functions.jsonl/51419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28022,
604,
2891,
680,
368,
341,
286,
1077,
22505,
284,
4715,
6528,
10937,
15505,
58,
19,
11,
18,
1125,
19,
1125,
19,
14955,
22,
11,
15505,
23,
11,
19,
1125,
24,
5053,
37389,
286,
1077,
12916,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_view_from_shape_ptr_deny_neg_strides() {
let data = [0, 1, 2, 3, 4, 5];
let _view = unsafe {
RawArrayView::from_shape_ptr((2, 3).strides((-3isize as usize, 1)), data.as_ptr())
};
} | rust_cleaned_test_functions.jsonl/92630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
7122,
5673,
13597,
4348,
814,
32395,
28209,
2895,
3341,
368,
341,
262,
1077,
821,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_half_connect() {
let mut data: &[u8] = &[
0b00010000, 39, 0x00, 0x04, 'M' as u8, 'Q' as u8, 'T' as u8, 'T' as u8, 0x04,
0b11001110,
0x00,
0x0a, // 10 sec
];
assert_eq!(Ok(None), decode_slice(&mut data));
assert_eq!(12, data.len());
} | rust_cleaned_test_functions.jsonl/77896 | {
"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,
40626,
15720,
368,
341,
262,
1077,
5206,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
286,
220,
15,
65,
15,
15,
15,
16,
15,
15,
15,
15,
11,
220,
18,
24,
11,
220,
15,
87,
15,
15,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diameter_of_binary_tree() {
assert_eq!(Solution::diameter_of_binary_tree(tree!(1, 2, 3, 4, 5)), 3);
assert_eq!(Solution::diameter_of_binary_tree(tree!(1, 2)), 1);
} | rust_cleaned_test_functions.jsonl/69694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
36044,
3575,
31761,
11663,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
67,
36044,
3575,
31761,
11663,
21298,
10297,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
5731,
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_broadcast_ack_single_account_single_peer() {
let batch_size = 3;
let (mut smp, validator, full_node) = SharedMempoolNetwork::bootstrap_vfn_network(3);
// add txns to FN
// txns from single account
let mut all_txns = vec![];
for i in 0..10 {
all_txns.push(TestTransaction::new(1, i, 1));
}
smp.add_txns(&full_node, all_txns.clone());
// FN discovers new peer V
smp.send_connection_event(
&full_node,
ConnectionStatusNotification::NewPeer(validator, Multiaddr::empty()),
);
// deliver messages until FN mempool is empty
let mut remaining_txn_index = batch_size;
while remaining_txn_index < all_txns.len() + 1 {
// deliver message
let (_transactions, recipient) = smp.deliver_message(&full_node);
assert_eq!(validator, recipient);
// check that txns on FN have been GC'ed
let mempool = smp.mempools.get(&full_node).unwrap();
let block = mempool.lock().unwrap().get_block(100, HashSet::new());
let remaining_txns = &all_txns[remaining_txn_index..];
assert_eq!(block.len(), remaining_txns.len());
for txn in remaining_txns {
assert!(block.contains(&txn.make_signed_transaction_with_max_gas_amount(5)));
}
// update remaining txn index
if remaining_txn_index == all_txns.len() {
remaining_txn_index += batch_size;
} else {
remaining_txn_index = std::cmp::min(remaining_txn_index + batch_size, all_txns.len());
}
}
} | rust_cleaned_test_functions.jsonl/31477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 678
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74923,
48447,
19487,
13500,
19487,
45159,
368,
341,
262,
1077,
7162,
2368,
284,
220,
18,
280,
262,
1077,
320,
6984,
274,
1307,
11,
22935,
11,
2480,
5084,
8,
284,
16990,
44,
3262,
1749,
12320,
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... | 5 |
#[test]
fn test_to_year() {
let a: PrimitiveArray<Date16Type> = vec![Some(1), None, Some(366)].into();
let b = date16_to_year(&a).unwrap();
assert_eq!(1970, b.value(0));
assert_eq!(false, b.is_valid(1));
assert_eq!(1971, b.value(2));
} | rust_cleaned_test_functions.jsonl/109393 | {
"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,
2346,
14645,
368,
341,
286,
1077,
264,
25,
51460,
1857,
98879,
16,
21,
929,
29,
284,
7486,
20703,
8373,
7,
16,
701,
2240,
11,
4329,
7,
18,
21,
21,
26169,
18122,
1428,
286,
1077,
293,
284,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_char_event_lowercase() {
assert_eq!(
parse_event(b"c", false).unwrap(),
Some(InternalEvent::Event(Event::Key(KeyEvent::new(
KeyCode::Char('c'),
KeyModifiers::empty()
)))),
);
} | rust_cleaned_test_functions.jsonl/21334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9232,
6748,
93129,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
6748,
1883,
96946,
497,
895,
568,
15454,
3148,
310,
4329,
7,
11569,
1556,
486,
1556,
30469,
486,
1592,
67108,
486,
931,
1006... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_alu_binary() {
disasm!(
"entrypoint:
add64 r1, r2
sub64 r1, r2
mul64 r1, r2
div64 r1, r2
or64 r1, r2
and64 r1, r2
lsh64 r1, r2
rsh64 r1, r2
mod64 r1, r2
xor64 r1, r2
mov64 r1, r2
arsh64 r1, r2
"
);
disasm!(
"entrypoint:
add64 r1, 2
sub64 r1, 2
mul64 r1, 2
div64 r1, 2
or64 r1, 2
and64 r1, 2
lsh64 r1, 2
rsh64 r1, 2
mod64 r1, 2
xor64 r1, 2
mov64 r1, 2
arsh64 r1, 2
"
);
disasm!(
"entrypoint:
add32 r1, r2
sub32 r1, r2
mul32 r1, r2
div32 r1, r2
or32 r1, r2
and32 r1, r2
lsh32 r1, r2
rsh32 r1, r2
mod32 r1, r2
xor32 r1, r2
mov32 r1, r2
arsh32 r1, r2
"
);
disasm!(
"entrypoint:
add32 r1, 2
sub32 r1, 2
mul32 r1, 2
div32 r1, 2
or32 r1, 2
and32 r1, 2
lsh32 r1, 2
rsh32 r1, 2
mod32 r1, 2
xor32 r1, 2
mov32 r1, 2
arsh32 r1, 2
"
);
} | rust_cleaned_test_functions.jsonl/68762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8418,
84,
31761,
368,
341,
262,
827,
10530,
33673,
286,
330,
4085,
2768,
510,
262,
912,
21,
19,
435,
16,
11,
435,
17,
198,
262,
1186,
21,
19,
435,
16,
11,
435,
17,
198,
262,
15602,
21,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_supplies_buy_ammo_success() {
let mut supplies = Supplies::new();
supplies.buy_ammo(200).unwrap();
assert_eq!(500, supplies.money);
assert_eq!(200, supplies.ammo);
} | rust_cleaned_test_functions.jsonl/28662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
7202,
46348,
22880,
6355,
18632,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
16720,
63871,
22880,
6355,
7,
17,
15,
15,
568,
15454,
543,
1066,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_addr() {
assert!(parse_addr("2000").is_ok());
assert!(parse_addr("127.0.0.5:2000").is_ok());
assert!(parse_addr("[::1]:2000").is_ok());
assert_eq!(Err("Invalid port number".to_owned()), parse_addr("127.0.0.1"));
assert_eq!(Err("Invalid address".to_owned()), parse_addr("::1"));
assert_eq!(Err("Invalid address".to_owned()), parse_addr("[::1]"));
} | rust_cleaned_test_functions.jsonl/132865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
7387,
368,
341,
286,
2060,
10297,
6400,
7387,
445,
17,
15,
15,
15,
1827,
285,
19817,
1423,
286,
2060,
10297,
6400,
7387,
445,
16,
17,
22,
13,
15,
13,
15,
13,
20,
25,
17,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_atomicrmw() {
let context = Context::create();
let module = context.create_module("rmw");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
let fn_value = module.add_function("", fn_type, None);
let entry = context.append_basic_block(fn_value, "entry");
let builder = context.create_builder();
builder.position_at_end(entry);
let i32_type = context.i32_type();
let i64_type = context.i64_type();
let i31_type = context.custom_width_int_type(31);
let i4_type = context.custom_width_int_type(4);
let ptr_value = i32_type.ptr_type(AddressSpace::Zero).get_undef();
let zero_value = i32_type.const_zero();
let result = builder.build_atomicrmw(
AtomicRMWBinOp::Add,
ptr_value,
zero_value,
AtomicOrdering::Unordered,
);
assert!(result.is_ok());
let ptr_value = i64_type.ptr_type(AddressSpace::Zero).get_undef();
let zero_value = i32_type.const_zero();
let result = builder.build_atomicrmw(
AtomicRMWBinOp::Add,
ptr_value,
zero_value,
AtomicOrdering::Unordered,
);
assert!(result.is_err());
let ptr_value = i31_type.ptr_type(AddressSpace::Zero).get_undef();
let zero_value = i31_type.const_zero();
let result = builder.build_atomicrmw(
AtomicRMWBinOp::Add,
ptr_value,
zero_value,
AtomicOrdering::Unordered,
);
assert!(result.is_err());
let ptr_value = i4_type.ptr_type(AddressSpace::Zero).get_undef();
let zero_value = i4_type.const_zero();
let result = builder.build_atomicrmw(
AtomicRMWBinOp::Add,
ptr_value,
zero_value,
AtomicOrdering::Unordered,
);
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/125178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 773
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51367,
8719,
86,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
8719,
86,
3071,
262,
1077,
737,
1819,
284,
2266,
13,
1004,
1819,
543,
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_to_simple_string() {
let yyid = Yyid::new();
let ystr = yyid.to_simple_ref().to_string();
assert!(ystr.len() == 32);
assert!(ystr.chars().all(|c| c.is_digit(16)));
} | rust_cleaned_test_functions.jsonl/134733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
30015,
3904,
368,
341,
286,
1077,
13197,
307,
284,
809,
88,
307,
486,
931,
543,
286,
1077,
379,
495,
284,
13197,
307,
2389,
30015,
7793,
1005,
983,
3904,
1428,
286,
2060,
10297,
88,
495,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bsonc_as_json() {
let document = doc! { "key" : "value" };
let bsonc = super::Bsonc::from_document(&document).unwrap();
assert_eq!("{ \"key\" : \"value\" }".to_owned(), bsonc.as_json());
} | rust_cleaned_test_functions.jsonl/30633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
930,
66,
11898,
9455,
368,
341,
286,
1077,
2197,
284,
4629,
0,
314,
330,
792,
1,
549,
330,
957,
1,
2605,
286,
1077,
50980,
66,
284,
2256,
486,
33,
930,
66,
486,
1499,
26231,
2099,
6062,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uvarint() {
use super::ReadEx;
use std::io::Cursor;
let bytes = [194_u8, 10];
let mut cursor = Cursor::new(bytes);
let actual = cursor.read_uvarint().unwrap();
assert_eq!(actual, 1346)
} | rust_cleaned_test_functions.jsonl/39153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
7300,
947,
396,
368,
341,
262,
990,
2256,
486,
4418,
840,
280,
262,
990,
1460,
486,
815,
486,
14543,
401,
262,
1077,
5820,
284,
508,
16,
24,
19,
7300,
23,
11,
220,
16,
15,
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_checkout_add_tree_with_locally_deleted_blob() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
rm!(repo: "foo");
let target = commit! {
foo {
bar < "bar contents"
}
};
bit_checkout!(repo: &rev!(target))?;
assert_eq!(cat!(repo: "foo/bar"), "bar contents");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68186,
2891,
11663,
6615,
13400,
745,
39418,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
18998,
10297,
23476,
25,
330,
7975,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_method_this_binding_2() {
check_output_default(
"class Thing {\
getCallback() {\
fun localFunction() {\
print this;\
}\
\
return localFunction;\
}\
}\
\
var callback = Thing().getCallback();\
callback();",
"LoxInstance(Thing)",
)
} | rust_cleaned_test_functions.jsonl/111853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
24868,
60815,
62,
17,
368,
341,
286,
1779,
7645,
9993,
1006,
310,
330,
1040,
37200,
95519,
2290,
633,
7494,
368,
95519,
338,
2464,
2205,
5152,
368,
95519,
4293,
1173,
419,
55783,
338,
335,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_variables_mutated_in_block() {
let block = {
let mut block = Block::new(0);
block.assign(variable("x"), expr_const(1)).unwrap();
block.load(variable("y"), variable("z").into()).unwrap();
block.assign(variable("x"), variable("y").into()).unwrap();
block
};
assert_eq!(
variables_mutated_in_block(&block),
vec![&variable("x"), &variable("y")].into_iter().collect()
);
} | rust_cleaned_test_functions.jsonl/13490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28182,
29523,
657,
1243,
7113,
368,
341,
286,
1077,
2504,
284,
341,
310,
1077,
5206,
2504,
284,
8362,
486,
931,
7,
15,
317,
310,
2504,
17870,
45029,
445,
87,
3975,
15169,
13610,
7,
16,
4579,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extend_truncate() {
let a = vec3a(1.0, 2.0, 3.0);
let b = a.extend(4.0);
assert_eq!((1.0, 2.0, 3.0, 4.0), b.into());
let c = Vec3A::from(b);
assert_eq!(a, c);
} | rust_cleaned_test_functions.jsonl/23490 | {
"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,
70265,
3547,
26900,
368,
341,
262,
1077,
264,
284,
7486,
18,
64,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
317,
262,
1077,
293,
284,
264,
15831,
7,
19,
13,
15,
317,
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_primitive_array_from_vec() {
let buf = Buffer::from_slice_ref(&[0, 1, 2, 3, 4]);
let arr = Int32Array::from(vec![0, 1, 2, 3, 4]);
assert_eq!(buf, arr.data.buffers()[0]);
assert_eq!(5, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(0, arr.null_count());
for i in 0..5 {
assert!(!arr.is_null(i));
assert!(arr.is_valid(i));
assert_eq!(i as i32, arr.value(i));
}
} | rust_cleaned_test_functions.jsonl/27274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
5673,
13251,
368,
341,
286,
1077,
6607,
284,
10312,
486,
1499,
26488,
7793,
2099,
58,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
2558,
286,
1077,
2890,
284,
1333,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multi_selector_match() {
let doc_text = br#"
<html>
<b>cool</b><a>rad</a>
</html>
"#;
let css_text = br#"
* {
color: black;
}
a,b {
color:red;
}
"#;
let (doc, stylesheet,stree,lbox, rbox) = standard_test_run(doc_text, css_text).unwrap();
let snode = stree.root.borrow();
println!("doc is {:#?} {:#?} {:#?}",doc,stylesheet,snode);
//check html element
assert_eq!(snode.specified_values.get("color").unwrap(),
&Keyword(String::from("black")));
// check html b element
assert_eq!(snode.children.borrow()[0].specified_values.get("color").unwrap(),
&Keyword(String::from("red")));
// check html a element
assert_eq!(snode.children.borrow()[1].specified_values.get("color").unwrap(),
&Keyword(String::from("red")));
} | rust_cleaned_test_functions.jsonl/101341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 443
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
28890,
10708,
368,
341,
262,
1077,
4629,
4326,
284,
1411,
2,
698,
262,
366,
1551,
397,
286,
366,
65,
29,
42196,
522,
65,
1784,
64,
29,
13281,
522,
64,
397,
262,
690,
1551,
397,
262,
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_block_loot() {
for version_folder in std::fs::read_dir(MC_DATA_DIR).unwrap() {
let dir = version_folder.unwrap();
let mut path = dir.path();
path.push("blockLoot.json");
if path.exists() {
println!("{}", path.display());
let contents = std::fs::read_to_string(path).unwrap();
let _shapes: BlockLoot = serde_json::from_str(&contents).unwrap();
}
}
} | rust_cleaned_test_functions.jsonl/21704 | {
"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,
7113,
5560,
354,
368,
341,
286,
369,
2319,
15268,
304,
1460,
486,
3848,
486,
878,
4334,
3189,
34,
7896,
8291,
568,
15454,
368,
341,
310,
1077,
5419,
284,
2319,
15268,
55395,
543,
310,
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... | 3 |
#[test]
fn test_converter_arrow_source_target_different() {
let raw_data = vec![Some(1i16), None, Some(2i16), Some(3i16)];
// Construct record reader
let mut record_reader = {
// Construct column schema
let message_type = "
message test_schema {
OPTIONAL INT32 leaf;
}
";
let def_levels = [1i16, 0i16, 1i16, 1i16];
build_record_reader(
message_type,
&[1, 2, 3],
0i16,
None,
1i16,
Some(&def_levels),
10,
)
};
let array = Int16Converter::convert(&mut record_reader).unwrap();
let array = array
.as_any()
.downcast_ref::<PrimitiveArray<Int16Type>>()
.unwrap();
assert!(array.equals(&PrimitiveArray::<Int16Type>::from(raw_data)));
} | rust_cleaned_test_functions.jsonl/34256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74073,
46566,
10347,
11123,
82741,
368,
341,
286,
1077,
7112,
1769,
284,
7486,
20703,
8373,
7,
16,
72,
16,
21,
701,
2240,
11,
4329,
7,
17,
72,
16,
21,
701,
4329,
7,
18,
72,
16,
21,
73663,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_manager_or() {
let id_id = 1;
let age_id = 2;
let mut or_compare = message::LogicalCompare::new();
or_compare.set_compare(message::CompareType::OR_RELATION);
let mut age_compare = message::LogicalCompare::new();
age_compare.set_prop_id(age_id);
age_compare.set_compare(message::CompareType::GT);
let mut age_value = message::Value::new();
age_value.set_value_type(message::VariantType::VT_INT);
age_value.set_int_value(29);
age_compare.set_value(age_value);
or_compare.mut_child_compare_list().push(age_compare);
let mut id_compare = message::LogicalCompare::new();
id_compare.set_prop_id(id_id);
id_compare.set_compare(message::CompareType::GT);
let mut id_value = message::Value::new();
id_value.set_value_type(message::VariantType::VT_LONG);
id_value.set_long_value(3);
id_compare.set_value(id_value);
or_compare.mut_child_compare_list().push(id_compare);
let compare_list = vec![or_compare];
let filter_manager = FilterManager::new(&compare_list, Arc::new(LocalGraphSchema::new(Arc::new(build_modern_mock_schema()))));
filter_native_vertex(&filter_manager, id_id, age_id);
filter_message_vertex(&filter_manager, id_id, age_id);
} | rust_cleaned_test_functions.jsonl/43853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 611
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
12144,
8734,
368,
341,
286,
1077,
877,
842,
284,
220,
16,
280,
286,
1077,
4231,
842,
284,
220,
17,
401,
286,
1077,
5206,
476,
32235,
284,
1943,
486,
64312,
27374,
486,
931,
543,
286,
476... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_custom_charset_id_for_glyph_format1() {
let ranges = ReadArrayCow::Owned(vec![Range {
first: 34,
n_left: 5,
}]);
let charset = CustomCharset::Format1 { ranges };
// glpyh id 0 is .notdef and is implicitly encoded
assert_eq!(charset.id_for_glyph(0), Some(0));
assert_eq!(charset.id_for_glyph(1), Some(34));
assert_eq!(charset.id_for_glyph(6), Some(39));
assert_eq!(charset.id_for_glyph(7), None);
} | rust_cleaned_test_functions.jsonl/85347 | {
"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,
15875,
65883,
842,
5478,
88703,
8955,
16,
368,
341,
286,
1077,
21283,
284,
4457,
1857,
89915,
486,
57641,
25592,
20703,
6046,
341,
310,
1156,
25,
220,
18,
19,
345,
310,
308,
9579,
25,
220,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove() {
let mut m: TMap = Map::new();
let add_ctx = m.len().derive_add_ctx(1);
let mut inner_map: Map<TKey, TVal, TActor> = Map::new();
inner_map.apply(inner_map.update(110, add_ctx, |r, ctx| r.write(0, ctx)));
let add_ctx = m.len().derive_add_ctx(1);
m.apply(m.update(101, add_ctx, |m, ctx| {
m.update(110, ctx, |r, ctx| r.write(0, ctx))
}));
assert_eq!(m.get(&101).val, Some(inner_map));
assert_eq!(m.len().val, 1);
m.apply(m.rm(101, m.get(&101).derive_rm_ctx()));
assert_eq!(m.get(&101).val, None);
assert_eq!(m.len().val, 0);
} | rust_cleaned_test_functions.jsonl/61623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
368,
341,
262,
1077,
5206,
296,
25,
350,
2227,
284,
5027,
486,
931,
1428,
262,
1077,
912,
15147,
284,
296,
19406,
1005,
27098,
2891,
15147,
7,
16,
317,
262,
1077,
5206,
9179,
5376,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_box_slice() {
let s = vec![1, 2, 3].into_boxed_slice();
let r: Rc<[u32]> = Rc::from(s);
assert_eq!(&r[..], [1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/4676 | {
"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,
5673,
10194,
26488,
368,
341,
286,
1077,
274,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
936,
18122,
10194,
291,
26488,
543,
286,
1077,
435,
25,
81463,
66746,
84,
18,
17,
25669,
284,
8146... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_interval() {
let mut poller = Poller::new().unwrap();
let registrar = poller.get_registrar();
let timer_id = registrar.set_interval(TIMEOUT).unwrap();
let now = Instant::now();
for i in 1..5 {
let notifications = poller.wait(POLL_TIMEOUT).unwrap();
let elapsed = now.elapsed();
assert_eq!(1, notifications.len());
assert_eq!(timer_id, notifications[0].id);
assert!(elapsed > Duration::from_millis(i*TIMEOUT as u64));
assert!(elapsed < Duration::from_millis(POLL_TIMEOUT as u64));
}
assert!(registrar.cancel_timeout(timer_id).is_ok());
let now = Instant::now();
let notifications = poller.wait(FINAL_POLL_TIMEOUT).unwrap();
assert!(now.elapsed() > Duration::from_millis(FINAL_POLL_TIMEOUT as u64));
assert_eq!(0, notifications.len());
} | rust_cleaned_test_functions.jsonl/13101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
20541,
368,
341,
262,
1077,
5206,
7085,
261,
284,
24385,
261,
486,
931,
1005,
15454,
543,
262,
1077,
61467,
284,
7085,
261,
670,
4920,
34765,
543,
262,
1077,
9021,
842,
284,
61467,
980,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sign_verify() {
for ciphersuite in Config::supported_ciphersuites() {
let keypair = ciphersuite.new_signature_keypair().unwrap();
let payload = &[1, 2, 3];
let signature = keypair.sign(payload).unwrap();
assert!(keypair.verify(&signature, payload));
}
} | rust_cleaned_test_functions.jsonl/34690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
35638,
368,
341,
262,
369,
272,
82077,
9302,
304,
5532,
486,
18216,
666,
82077,
3083,
288,
368,
341,
286,
1077,
1376,
12670,
284,
272,
82077,
9302,
4618,
39859,
3097,
12670,
1005,
15454,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_try_from_patch_netif() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
let body = "{ \
\"iface_id\": \"string\" \
}";
sender
.write_all(http_request("PATCH", "/network-interfaces/string", Some(&body)).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/106594 | {
"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,
53283,
5673,
39643,
19722,
333,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_summary_ranges() {
let mut sr = SummaryRanges::new();
sr.add_num(1);
assert_eq!(sr.get_intervals(), vec![vec![1, 1]]);
sr.add_num(3);
assert_eq!(sr.get_intervals(), vec![vec![1, 1], vec![3, 3]]);
sr.add_num(7);
assert_eq!(sr.get_intervals(), vec![vec![1, 1], vec![3, 3], vec![7, 7]]);
sr.add_num(2);
assert_eq!(sr.get_intervals(), vec![vec![1, 3], vec![7, 7]]);
sr.add_num(6);
assert_eq!(sr.get_intervals(), vec![vec![1, 3], vec![6, 7]]);
} | rust_cleaned_test_functions.jsonl/57493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27251,
58748,
368,
341,
286,
1077,
5206,
18962,
284,
21517,
74902,
486,
931,
543,
286,
18962,
1364,
4273,
7,
16,
317,
286,
2060,
10714,
10297,
15094,
670,
90807,
1507,
7486,
20703,
4083,
20703,
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_real_as_unsigned_real() {
let cs = vec![
// not in union
// TODO: add test case of negative real to unsigned real
(u64::MIN as f64, u64::MIN as f64, false),
(1.0, 1.0, false),
(i64::MAX as f64, i64::MAX as f64, false),
(u64::MAX as f64, u64::MAX as f64, false),
(f64::MAX, f64::MAX, false),
// in union
(-1.0, 0.0, true),
(i64::MIN as f64, 0.0, true),
(u64::MIN as f64, 0.0, true),
(f64::MIN, 0.0, true),
(1.0, 1.0, true),
(i64::MAX as f64, i64::MAX as f64, true),
(u64::MAX as f64, u64::MAX as f64, true),
(f64::MAX, f64::MAX, true),
];
for (input, expect, in_union) in cs {
let metadata = make_metadata(in_union);
let r = cast_real_as_unsigned_real(&metadata, Some(Real::new(input).as_ref().unwrap()));
let r = r.map(|x| x.map(|x| x.into_inner()));
let log = format!(
"input: {}, expect: {}, in_union: {}",
input, expect, in_union
);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/1961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 758
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
11898,
67830,
15266,
368,
341,
286,
1077,
10532,
284,
7486,
90515,
3374,
310,
442,
537,
304,
11300,
198,
310,
442,
5343,
25,
912,
1273,
1142,
315,
8225,
1931,
311,
3774,
1931,
18574,
34642,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_insert_at_in_mem_empty() {
let key1 = HashValue::from_slice(&[0; 32]).unwrap();
let value1_hash = b"hello".test_only_hash();
let key2 = update_byte(&key1, 0, 0b01000000);
let value2_hash = b"world".test_only_hash();
let key3 = update_byte(&key1, 0, 0b10000000);
let value3: StateValue = vec![1, 2, 3].into();
let internal = SubTree::new_internal(
SubTree::new_leaf_with_value_hash(key1, value1_hash, 0 /* generation */),
SubTree::new_leaf_with_value_hash(key2, value2_hash, 0 /* generation */),
0, /* generation */
);
let internal_hash = internal.hash();
let root = SubTree::new_internal(internal, SubTree::new_empty(), 0 /* generation */);
let smt = SparseMerkleTree::new_with_root(root);
let root_hash = hash_internal(internal_hash, hash_leaf(key3, value3.hash()));
let updated = smt
.batch_update(vec![(key3, &value3)], &ProofReader::default())
.unwrap();
assert_eq!(updated.root_hash(), root_hash);
} | rust_cleaned_test_functions.jsonl/63253 | {
"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,
17678,
3752,
1243,
12976,
15124,
368,
341,
262,
1077,
1376,
16,
284,
6531,
1130,
486,
1499,
26488,
2099,
58,
15,
26,
220,
18,
17,
10697,
15454,
543,
262,
1077,
897,
16,
8950,
284,
293,
1,
1499... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup1_values() {
assert_eq!(lookup1_values(1025, 10), 2);
assert_eq!(lookup1_values(1024, 10), 2);
assert_eq!(lookup1_values(1023, 10), 1);
assert_eq!(lookup1_values(3126, 5), 5);
assert_eq!(lookup1_values(3125, 5), 5);
assert_eq!(lookup1_values(3124, 5), 4);
assert_eq!(lookup1_values(1, 1), 1);
assert_eq!(lookup1_values(0, 15), 0);
assert_eq!(lookup1_values(0, 0), 0);
assert_eq!(lookup1_values(1, 0), ::std::u32::MAX);
assert_eq!(lookup1_values(400, 0), ::std::u32::MAX);
} | rust_cleaned_test_functions.jsonl/8407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
16,
9146,
368,
341,
11120,
6948,
10714,
10297,
21020,
16,
9146,
7,
16,
15,
17,
20,
11,
220,
16,
15,
701,
220,
17,
317,
6948,
10714,
10297,
21020,
16,
9146,
7,
16,
15,
17,
19,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create() {
let req = LeaseProtocolRequest::create(1000, "789", "bucket");
let json = serde_json::to_string(&req).unwrap();
let after: LeaseProtocolRequest = serde_json::from_str(json.as_str()).unwrap();
assert_eq!(after, req)
} | rust_cleaned_test_functions.jsonl/21173 | {
"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,
8657,
368,
341,
286,
1077,
4232,
284,
80651,
20689,
1900,
486,
3182,
7,
16,
15,
15,
15,
11,
330,
22,
23,
24,
497,
330,
30410,
797,
286,
1077,
2951,
284,
61570,
9455,
486,
983,
3904,
2099,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_has_no_sigs() {
let sig = Signature::default();
let blockhash = hash(Hash::default().as_ref());
let status_cache = BankStatusCache::default();
assert_eq!(
status_cache.get_signature_status(&sig, &blockhash, &HashMap::new()),
None
);
assert_eq!(status_cache.get_signature_slot(&sig, &HashMap::new()), None);
} | rust_cleaned_test_functions.jsonl/23938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
21778,
6536,
643,
14462,
368,
341,
286,
1077,
8366,
284,
32232,
486,
2258,
543,
286,
1077,
2504,
8296,
284,
5175,
7,
6370,
486,
2258,
1005,
300,
7793,
1423,
286,
1077,
2639,
11529,
284,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_grades_when_several_students_have_the_same_grade() {
let mut s = school::School::new();
s.add(2, "Aimee");
s.add(2, "Logan");
s.add(2, "Blair");
assert_eq!(s.grades(), vec!(2));
} | rust_cleaned_test_functions.jsonl/127489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15682,
3452,
47636,
3453,
17539,
71644,
67301,
16068,
33574,
50515,
368,
341,
262,
1077,
5206,
274,
284,
2906,
486,
32749,
486,
931,
543,
262,
274,
1364,
7,
17,
11,
330,
32,
545,
68,
797,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resource_block_with_undeclared_local_shorthand_rule_head() {
let p = Polar::new();
p.register_constant(sym!("Org"), term!("unimportant"))
.unwrap();
expect_error(
&p,
r#"resource Org{"member" if "owner";}"#,
r#"Undeclared term "member" referenced in rule in 'Org' resource block. Did you mean to declare it as a role, permission, or relation?"#,
);
} | rust_cleaned_test_functions.jsonl/31741 | {
"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,
17962,
7113,
6615,
62,
28865,
86251,
13564,
3712,
61679,
21124,
13138,
368,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
9929,
34967,
62512,
17223,
42437,
3975,
4647,
17223,
359,
15333,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rchunks_nth() {
let v: &[i32] = &[0, 1, 2, 3, 4, 5];
let mut c = v.rchunks(2);
assert_eq!(c.nth(1).unwrap(), &[2, 3]);
assert_eq!(c.next().unwrap(), &[0, 1]);
let v2: &[i32] = &[0, 1, 2, 3, 4];
let mut c2 = v2.rchunks(3);
assert_eq!(c2.nth(1).unwrap(), &[0, 1]);
assert_eq!(c2.next(), None);
} | rust_cleaned_test_functions.jsonl/9661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
84263,
78342,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
272,
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_rect_size_truncation() {
for width in 256u16..300u16 {
for height in 256u16..300u16 {
let rect = Rect::new(0, 0, width, height);
rect.area(); // Should not panic.
assert!(rect.width < width || rect.height < height);
// The target dimensions are rounded down so the math will not be too precise
// but let's make sure the ratios don't diverge crazily.
assert!(
(f64::from(rect.width) / f64::from(rect.height)
- f64::from(width) / f64::from(height))
.abs()
< 1.0
)
}
}
let width = 900;
let height = 100;
let rect = Rect::new(0, 0, width, height);
assert_ne!(rect.width, 900);
assert_ne!(rect.height, 100);
assert!(rect.width < width || rect.height < height);
} | rust_cleaned_test_functions.jsonl/22806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16979,
2368,
3547,
1347,
367,
368,
341,
286,
369,
2374,
304,
220,
17,
20,
21,
84,
16,
21,
496,
18,
15,
15,
84,
16,
21,
341,
310,
369,
2608,
304,
220,
17,
20,
21,
84,
16,
21,
496,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_assign() {
let mut input = parse::parse_lua_source(
b"a = 4
b = {}
b.a = 4",
)
.unwrap();
let mut interpreter = Interpreter::new();
interpreter.visit_chunk(&mut input);
assert_eq!(interpreter.get_variable("a"), LuaValue::Number(4.0));
assert_eq!(
interpreter
.get_variable("b")
.to_table()
.unwrap()
.get_value_by_name(format!("a"))
.unwrap()
.get_lua_value(),
LuaValue::Number(4.0)
);
} | rust_cleaned_test_functions.jsonl/118770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20688,
368,
341,
286,
1077,
5206,
1946,
284,
4715,
486,
6400,
76013,
10347,
1006,
310,
293,
56693,
284,
220,
19,
198,
1060,
293,
284,
5613,
1060,
293,
5849,
284,
220,
19,
756,
286,
1727,
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_cleanup_last() {
let mut index = AccountsIndex::<bool>::default();
index.add_root(0);
index.add_root(1);
index.cleanup_dead_slot(1);
assert!(!index.is_root(1));
assert!(index.is_root(0));
} | rust_cleaned_test_functions.jsonl/20402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42444,
12195,
368,
341,
1789,
286,
1077,
5206,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
543,
286,
1922,
1364,
12993,
7,
15,
317,
286,
1922,
1364,
12993,
7,
16,
317,
286,
1922,
87689,
534... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_xchacha20_basic() {
let key = [
0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a,
0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08,
0x44, 0xf6, 0x83, 0x89,
];
let nonce = [
0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc,
0x73, 0xd6, 0x82, 0x19, 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37,
];
let input = [0u8; 139];
let mut stream = [0u8; 139];
let result = [
0x4f, 0xeb, 0xf2, 0xfe, 0x4b, 0x35, 0x9c, 0x50, 0x8d, 0xc5, 0xe8, 0xb5, 0x98, 0x0c,
0x88, 0xe3, 0x89, 0x46, 0xd8, 0xf1, 0x8f, 0x31, 0x34, 0x65, 0xc8, 0x62, 0xa0, 0x87,
0x82, 0x64, 0x82, 0x48, 0x01, 0x8d, 0xac, 0xdc, 0xb9, 0x04, 0x17, 0x88, 0x53, 0xa4,
0x6d, 0xca, 0x3a, 0x0e, 0xaa, 0xee, 0x74, 0x7c, 0xba, 0x97, 0x43, 0x4e, 0xaf, 0xfa,
0xd5, 0x8f, 0xea, 0x82, 0x22, 0x04, 0x7e, 0x0d, 0xe6, 0xc3, 0xa6, 0x77, 0x51, 0x06,
0xe0, 0x33, 0x1a, 0xd7, 0x14, 0xd2, 0xf2, 0x7a, 0x55, 0x64, 0x13, 0x40, 0xa1, 0xf1,
0xdd, 0x9f, 0x94, 0x53, 0x2e, 0x68, 0xcb, 0x24, 0x1c, 0xbd, 0xd1, 0x50, 0x97, 0x0d,
0x14, 0xe0, 0x5c, 0x5b, 0x17, 0x31, 0x93, 0xfb, 0x14, 0xf5, 0x1c, 0x41, 0xf3, 0x93,
0x83, 0x5b, 0xf7, 0xf4, 0x16, 0xa7, 0xe0, 0xbb, 0xa8, 0x1f, 0xfb, 0x8b, 0x13, 0xaf,
0x0e, 0x21, 0x69, 0x1d, 0x7e, 0xce, 0xc9, 0x3b, 0x75, 0xe6, 0xe4, 0x18, 0x3a,
];
let mut xchacha20 = ChaCha20::new_xchacha20(&key, &nonce);
xchacha20.process(&input, &mut stream);
assert!(stream[..] == result[..]);
} | rust_cleaned_test_functions.jsonl/25216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
331,
51576,
17,
15,
34729,
368,
341,
73363,
286,
1077,
1376,
284,
2278,
310,
220,
15,
87,
16,
65,
11,
220,
15,
87,
17,
22,
11,
220,
15,
87,
20,
20,
11,
220,
15,
87,
21,
19,
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_plaintext_incorrect_file() {
let file = "!Name: My name\n.O\n..Owrong characters\nOOO";
assert!(parse_plaintext_file(&file).is_err())
} | rust_cleaned_test_functions.jsonl/43501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6317,
1641,
427,
1243,
19928,
2458,
368,
341,
262,
1077,
1034,
284,
53074,
675,
25,
3017,
829,
1699,
8382,
1699,
496,
46,
34870,
5766,
1699,
19499,
46,
876,
262,
2060,
10297,
6400,
6317,
1641,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_zero_lamport_without_clean() {
with_create_zero_lamport(|_| {
// just do nothing; this should behave identically with test_create_zero_lamport_with_clean
});
} | rust_cleaned_test_functions.jsonl/73056 | {
"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,
8657,
19359,
907,
309,
403,
39904,
19573,
368,
341,
286,
448,
8657,
19359,
907,
309,
403,
22428,
35395,
341,
310,
442,
1101,
653,
4302,
26,
419,
1265,
35692,
3524,
2673,
448,
1273,
8657,
19359,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_tips() {
let client = TestClient::new();
let (abi, _tvc) = TestClient::package(EVENTS, Some(2));
let err = client.request::<_, DecodedMessageBody>(
"abi.decode_message",
ParamsOfDecodeMessage {
abi: abi.clone(),
message: "te6ccgEBAgEAlgAB4a3f2/jCeWWvgMoAXOakv3VSD56sQrDPT76n1cbrSvpZ0BCs0KEUy2Duvo3zPExePONW3TYy0MCA1i+FFRXcSIXTHxAj/Hd67jWQF7peccWoU/dbMCBJBB6YdPCVZcJlJkAAAF0ZyXLg19VzGQVviwSgAQBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=".into(),
..Default::default()
},
).expect_err("Error expected");
assert!(
err.message.contains("Tip: Please check that you have specified the message's BOC, not body, as a parameter."),
"{}",
err.message
);
let err = client.request::<_, DecodedMessageBody>(
"abi.decode_message_body",
ParamsOfDecodeMessageBody {
abi: abi.clone(),
body: "te6ccgEBAwEAvAABRYgAC31qq9KF9Oifst6LU9U6FQSQQRlCSEMo+A3LN5MvphIMAQHhrd/b+MJ5Za+AygBc5qS/dVIPnqxCsM9PvqfVxutK+lnQEKzQoRTLYO6+jfM8TF4841bdNjLQwIDWL4UVFdxIhdMfECP8d3ruNZAXul5xxahT91swIEkEHph08JVlwmUmQAAAXRnJcuDX1XMZBW+LBKACAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==".into(),
..Default::default()
},
).expect_err("Error expected");
assert!(
err.message
.contains("Tip: Please check that you specified message's body, not full BOC."),
"{}",
err.message
);
} | rust_cleaned_test_functions.jsonl/4931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 769
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
3077,
368,
341,
262,
1077,
2943,
284,
3393,
2959,
486,
931,
543,
262,
1077,
320,
25084,
11,
716,
83,
7362,
8,
284,
3393,
2959,
486,
1722,
72458,
50,
11,
4329,
7,
17,
1106,
262,
1077,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_header_no_quality() {
let a: Accept = header::Header::parse_header([b"text/plain; charset=utf-8".to_vec()].as_slice()).unwrap();
let b = Accept(vec![
shared::QualityItem{item: mime::Mime(mime::TopLevel::Text, mime::SubLevel::Plain, vec![(mime::Attr::Charset, mime::Value::Utf8)]), quality: 1f32},
]);
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/51464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8757,
6536,
55074,
368,
341,
262,
1077,
264,
25,
20829,
284,
4247,
486,
4047,
486,
6400,
8757,
2561,
65,
66251,
36971,
26,
11617,
22264,
12,
23,
3263,
983,
13251,
57590,
300,
26488,
6011,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_non_terminate_early() {
test_interpreter_and_jit_asm!(
"
mov64 r6, 0x0
mov64 r1, 0x0
mov64 r2, 0x0
mov64 r3, 0x0
mov64 r4, 0x0
mov64 r5, r6
syscall Unresolved
add64 r6, 0x1
ja -0x8
exit",
[],
(),
{
|_vm, res: Result| {
matches!(res.unwrap_err(),
EbpfError::ElfError(ElfError::UnresolvedSymbol(a, b, c))
if a == "Unknown" && b == 35 && c == 48
)
}
},
7
);
} | rust_cleaned_test_functions.jsonl/59063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
62,
48061,
62,
22140,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
21,
19,
435,
21,
11,
220,
15,
87,
15,
198,
286,
1974,
21,
19,
435,
16,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_input_cursor() {
use super::super::Input;
let e: Event = Input::Cursor(false).into();
let x: Option<Event> = CursorEvent::from_cursor(true, &e);
let y: Option<Event> = x.clone()
.unwrap()
.cursor(|cursor| CursorEvent::from_cursor(cursor, x.as_ref().unwrap()))
.unwrap();
assert_eq!(x, y);
} | rust_cleaned_test_functions.jsonl/86814 | {
"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,
5898,
28601,
368,
341,
286,
990,
2256,
486,
9522,
486,
2505,
401,
286,
1077,
384,
25,
3665,
284,
5571,
486,
14543,
3576,
568,
18122,
543,
286,
1077,
856,
25,
6959,
51357,
29,
284,
28067,
1556,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_header_error() {
let mut c = ParseHeaderErrorConsumer {};
let p = Parser::new(ZERO_BOUND_HEADER, &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!("parse header error", format!("{}", err));
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/85746 | {
"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,
73969,
21039,
8757,
4096,
368,
341,
286,
1077,
5206,
272,
284,
14775,
4047,
1454,
29968,
9321,
286,
1077,
281,
284,
21102,
486,
931,
27855,
17297,
73644,
20330,
11,
609,
6984,
272,
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... | 2 |
#[test]
fn test_incomplete_block_parsing() {
let magic = 0x0709110b;
let raw_blocks = hex_decode(fixture("incomplete_block.hex")).unwrap();
let blocks = parse_blocks(raw_blocks, magic).unwrap();
assert_eq!(blocks.len(), 2);
assert_eq!(
blocks[1].bitcoin_hash().into_inner().to_vec(),
hex_decode("d55acd552414cc44a761e8d6b64a4d555975e208397281d115336fc500000000").unwrap()
);
} | rust_cleaned_test_functions.jsonl/89312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
14737,
7113,
620,
28598,
368,
341,
286,
1077,
10963,
284,
220,
15,
87,
15,
22,
15,
24,
16,
16,
15,
65,
280,
286,
1077,
7112,
25201,
284,
12371,
15227,
94886,
445,
258,
14737,
7113,
45639... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addv() {
let a = [1.2, 1.3, 1.4];
let b = [1.3, 1.5, 2.4];
let c = a.addv(&b);
let c_expected: [f64; 3] = [2.5, 2.8, 3.8];
for i in 0..c.len() {
assert_approx_eq!(c[i], c_expected[i]);
}
} | rust_cleaned_test_functions.jsonl/66744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
85,
368,
341,
286,
1077,
264,
284,
508,
16,
13,
17,
11,
220,
16,
13,
18,
11,
220,
16,
13,
19,
935,
286,
1077,
293,
284,
508,
16,
13,
18,
11,
220,
16,
13,
20,
11,
220,
17,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_unrecognized_option() {
let long_args = vec!("--untest".to_string());
let opts = vec!(optmulti("t", "test", "testing", "TEST"));
let rs = getopts(&long_args, &opts);
match rs {
Err(UnrecognizedOption(_)) => {},
_ => panic!()
}
let short_args = vec!("-u".to_string());
match getopts(&short_args, &opts) {
Err(UnrecognizedOption(_)) => {},
_ => panic!()
}
} | rust_cleaned_test_functions.jsonl/64005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
46067,
9672,
368,
341,
286,
1077,
1293,
8384,
284,
7486,
17223,
313,
359,
1944,
3263,
983,
3904,
1423,
286,
1077,
12185,
284,
7486,
10297,
2912,
26268,
445,
83,
497,
330,
1944,
497,
330,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_vectors_hkdf() {
let tests = [
TestVector::new("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"000102030405060708090a0b0c",
"f0f1f2f3f4f5f6f7f8f9",
"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5",
"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865").unwrap(),
TestVector::new("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf",
"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244",
"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87"
).unwrap(),
TestVector::new("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"",
"",
"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04",
"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8"
).unwrap(),
];
for (i, test) in tests.iter().enumerate() {
println!("{}", i);
let mut prk = HKDFExtract::extract(&test.salt, &test.ikm);
assert_eq!(&prk.prk[..], &test.prk[..]);
let mut okm = vec![0u8; test.okm.len()];
prk.expand(&test.info, &mut okm);
assert_eq!(okm, test.okm);
}
} | rust_cleaned_test_functions.jsonl/77546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49158,
1523,
74,
2940,
368,
341,
286,
1077,
7032,
284,
2278,
310,
3393,
3781,
486,
931,
445,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_zinc_parse_str_bad() {
let mut input = Cursor::new(r#"""#.as_bytes());
let mut scanner = super::Scanner::make(&mut input).expect("Scanner");
assert!(parse_str(&mut scanner).is_err());
let mut input = Cursor::new(r#""ala bala"#.as_bytes());
let mut scanner = super::Scanner::make(&mut input).expect("Scanner");
let str = parse_str(&mut scanner);
assert!(str.is_err());
{
let mut input = Cursor::new("\"x".as_bytes());
let mut scanner = super::Scanner::make(&mut input).expect("Scanner");
let str = parse_str(&mut scanner);
assert!(str.is_err())
}
} | rust_cleaned_test_functions.jsonl/80278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
2840,
21039,
2895,
34199,
368,
341,
286,
1077,
5206,
1946,
284,
28067,
486,
931,
2601,
2,
12599,
87846,
300,
12524,
1423,
286,
1077,
5206,
20775,
284,
2256,
486,
31002,
486,
6927,
2099,
6984... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_http_404_when_route_not_match() {
let rocket = rocket::ignite().mount("/", routes![get_index]);
let client = Client::new(rocket).unwrap();
let response = client.get("/abc").dispatch();
assert_eq!(response.status(), Status::NotFound);
} | rust_cleaned_test_functions.jsonl/110574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25888,
62,
19,
15,
19,
47636,
28109,
7913,
10708,
368,
341,
286,
1077,
24306,
284,
24306,
486,
95408,
1005,
16557,
35460,
11291,
20703,
455,
3560,
10149,
286,
1077,
2943,
284,
8423,
486,
931,
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_scans_attribute_start() {
let mut scanner = Scanner::new(
"<?php
#[Sample([], [])]
function test() {}
",
);
scanner.scan().unwrap();
assert_eq!(
token_list!(scanner.tokens),
"<?php #[ Sample ( [ ] , [ ] ) ] function test ( ) { } "
);
} | rust_cleaned_test_functions.jsonl/52954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
596,
16791,
4906,
368,
341,
286,
1077,
5206,
20775,
284,
17170,
486,
931,
1006,
310,
40271,
1208,
198,
310,
11506,
17571,
40056,
42182,
921,
310,
729,
1273,
368,
5613,
286,
21796,
286,
3475... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_follower_append_entries() {
setup_for_test();
let mut tests = vec![
(
2,
2,
vec![empty_entry(3, 3)],
vec![empty_entry(1, 1), empty_entry(2, 2), empty_entry(3, 3)],
vec![empty_entry(3, 3)],
),
(
1,
1,
vec![empty_entry(3, 2), empty_entry(4, 3)],
vec![empty_entry(1, 1), empty_entry(3, 2), empty_entry(4, 3)],
vec![empty_entry(3, 2), empty_entry(4, 3)],
),
(
0,
0,
vec![empty_entry(1, 1)],
vec![empty_entry(1, 1), empty_entry(2, 2)],
vec![],
),
(
0,
0,
vec![empty_entry(3, 1)],
vec![empty_entry(3, 1)],
vec![empty_entry(3, 1)],
),
];
for (i, (index, term, ents, wents, wunstable)) in tests.drain(..).enumerate() {
let s = new_storage();
s.wl()
.append(&[empty_entry(1, 1), empty_entry(2, 2)])
.expect("");
let mut r = new_test_raft(1, vec![1, 2, 3], 10, 1, s);
r.become_follower(2, 2);
let mut m = new_message(2, 1, MessageType::MsgAppend, 0);
m.set_term(2);
m.set_log_term(term);
m.set_index(index);
m.set_entries(RepeatedField::from_vec(ents));
r.step(m).expect("");
let g = r.raft_log.all_entries();
if g != wents {
panic!("#{}: ents = {:?}, want {:?}", i, g, wents);
}
let g = r.raft_log.unstable_entries();
let wunstable = if wunstable.is_empty() {
None
} else {
Some(&*wunstable)
};
if g != wunstable {
panic!("#{}: unstable_entries = {:?}, want {:?}", i, g, wunstable);
}
}
} | rust_cleaned_test_functions.jsonl/54479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
29034,
26041,
26092,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
7032,
284,
7486,
90515,
286,
2399,
310,
220,
17,
345,
310,
220,
17,
345,
310,
7486,
20703,
3194,
9078,
7,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_override_with_wrong_return_type() {
err(
"@open class A { @open fun f() {} }
class B extends A { @override fun f(): Int32 { return 1; } }",
pos(2, 44),
SemError::OverrideMismatch,
);
} | rust_cleaned_test_functions.jsonl/128699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48576,
6615,
75198,
12511,
1819,
368,
341,
286,
1848,
1006,
310,
8428,
2508,
536,
362,
314,
569,
2508,
2464,
282,
368,
4687,
456,
1797,
536,
425,
2239,
362,
314,
569,
9199,
2464,
282,
4555,
1333... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero() {
assert!(LogProb::zero().is_zero());
assert!(Prob::zero().is_zero());
assert!(PHREDProb::zero().is_zero());
} | rust_cleaned_test_functions.jsonl/128293 | {
"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,
19359,
368,
341,
286,
2060,
10297,
2201,
36980,
486,
14154,
1005,
285,
19359,
1423,
286,
2060,
10297,
36980,
486,
14154,
1005,
285,
19359,
1423,
286,
2060,
10297,
10842,
6504,
36980,
486,
14154,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_one_channel() {
let commands = super::channels_to_commands(&vec!["spot/trade:BTC-USDT".to_string()], true);
assert_eq!(1, commands.len());
assert_eq!(
r#"{"op":"subscribe","args":["spot/trade:BTC-USDT"]}"#,
commands[0]
);
} | rust_cleaned_test_functions.jsonl/9439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
14571,
368,
341,
286,
1077,
11293,
284,
2256,
486,
32425,
2346,
44151,
2099,
4083,
0,
1183,
18648,
21485,
1021,
25,
59118,
32340,
10599,
3263,
983,
3904,
79558,
830,
317,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_forwarding_entry_device() {
let ctx = FakeConversionContext::new();
let subnet_bytes = [192, 168, 0, 0];
let prefix = 24;
let (core, fidl) = create_forwarding_entry(
create_subnet(create_addr_v4(subnet_bytes), prefix),
create_local_dest_entry(ctx.binding, ctx.core),
);
assert_eq!(fidl, core.try_into_fidl_with_ctx(&ctx).unwrap());
assert_eq!(core, fidl.try_into_core_with_ctx(&ctx).unwrap());
} | rust_cleaned_test_functions.jsonl/42863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32121,
287,
9078,
9204,
368,
341,
286,
1077,
5635,
284,
36965,
48237,
1972,
486,
931,
543,
286,
1077,
51457,
12524,
284,
508,
16,
24,
17,
11,
220,
16,
21,
23,
11,
220,
15,
11,
220,
15,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_azure_time() {
let t = super::from_azure_time("Sun, 27 Sep 2009 17:26:40 GMT").unwrap();
assert_eq!(t.day(), 27);
assert_eq!(t.month(), 9);
assert_eq!(t.hour(), 17);
assert_eq!(t.second(), 40);
} | rust_cleaned_test_functions.jsonl/124954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
62,
39495,
3009,
368,
341,
286,
1077,
259,
284,
2256,
486,
1499,
62,
39495,
3009,
445,
30092,
11,
220,
17,
22,
17449,
220,
17,
15,
15,
24,
220,
16,
22,
25,
17,
21,
25,
19,
15,
24488,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_descending_into_non_descendable() {
let mut builder = ConfigurationBuilder::default();
builder.add(
InMemorySource::from_string_slice(TEST_JSON.trim()),
Json::default(),
);
let configuration = builder.build().unwrap().merge_owned().unwrap();
let result: Result<Option<i32>, ConfigurationError> =
configuration.get_result("map:entry:value1:[66]"); // trying to index into bool
let error = result.unwrap_err();
assert!(std::matches!(
error.get_code(),
ErrorCode::WrongNodeType(..)
));
let error_string = error.to_string();
assert!(error_string.contains("map-->entry-->value1-->[66]"))
} | rust_cleaned_test_functions.jsonl/20039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
10986,
2459,
45514,
21637,
10986,
408,
480,
368,
341,
262,
1077,
5206,
7363,
284,
12221,
3297,
486,
2258,
543,
262,
7363,
1364,
1006,
286,
758,
10642,
3608,
486,
1499,
3904,
26488,
50320,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_branch_lowering() {
let name = ExternalName::testcase("test0");
let mut sig = Signature::new(CallConv::SystemV);
sig.params.push(AbiParam::new(I32));
sig.returns.push(AbiParam::new(I32));
let mut func = Function::with_name_signature(name, sig);
let bb0 = func.dfg.make_block();
let arg0 = func.dfg.append_block_param(bb0, I32);
let bb1 = func.dfg.make_block();
let bb2 = func.dfg.make_block();
let bb3 = func.dfg.make_block();
let mut pos = FuncCursor::new(&mut func);
pos.insert_block(bb0);
let v0 = pos.ins().iconst(I32, 0x1234);
let v1 = pos.ins().iadd(arg0, v0);
pos.ins().brnz(v1, bb1, &[]);
pos.ins().jump(bb2, &[]);
pos.insert_block(bb1);
pos.ins().brnz(v1, bb2, &[]);
pos.ins().jump(bb3, &[]);
pos.insert_block(bb2);
let v2 = pos.ins().iadd(v1, v0);
pos.ins().brnz(v2, bb2, &[]);
pos.ins().jump(bb1, &[]);
pos.insert_block(bb3);
let v3 = pos.ins().isub(v1, v0);
pos.ins().return_(&[v3]);
let mut shared_flags_builder = settings::builder();
shared_flags_builder.set("opt_level", "none").unwrap();
let shared_flags = settings::Flags::new(shared_flags_builder);
let isa_flags = s390x_settings::Flags::new(&shared_flags, s390x_settings::builder());
let backend = S390xBackend::new_with_flags(
Triple::from_str("s390x").unwrap(),
shared_flags,
isa_flags,
);
let result = backend
.compile_function(&mut func, /* want_disasm = */ false)
.unwrap();
let code = result.buffer.data();
// FIXME: the branching logic should be optimized more
// jglh label1 ; jg label2
// jg label6
// jg label3
// jglh label4 ; jg label5
// jg label3
// jg label6
// jglh label7 ; jg label8
// jg label3
let golden = vec![
167, 42, 18, 52, 167, 46, 0, 0, 192, 100, 0, 0, 0, 11, 236, 50, 18, 52, 0, 216, 167,
62, 0, 0, 192, 100, 255, 255, 255, 251, 167, 46, 0, 0, 192, 100, 255, 255, 255, 246,
167, 42, 237, 204, 7, 254,
];
assert_eq!(code, &golden[..]);
} | rust_cleaned_test_functions.jsonl/119769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28031,
30425,
287,
368,
341,
286,
1077,
829,
284,
30936,
675,
486,
1944,
5638,
445,
1944,
15,
797,
286,
1077,
5206,
8366,
284,
32232,
486,
931,
55224,
34892,
486,
2320,
53,
317,
286,
8366,
9003,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encryption() {
for _ in 0..10 {
let msg1 = Message::random().unwrap();
let sk1 = PrivateKey::new().unwrap();
let sk2 = PrivateKey::new().unwrap();
let pk2 = PublicKey::new(sk2);
let cyph = encrypt(msg1, pk2, sk1).unwrap();
let msg2 = decrypt(cyph, sk2).unwrap();
assert_eq!(msg1, msg2)
}
} | rust_cleaned_test_functions.jsonl/42590 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13781,
15597,
368,
341,
262,
369,
716,
304,
220,
15,
496,
16,
15,
341,
286,
1077,
3750,
16,
284,
4856,
486,
11463,
1005,
15454,
543,
286,
1077,
1901,
16,
284,
9679,
1592,
486,
931,
1005,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_retain_setter_only_access() {
test_same(concat!(
"var a = {",
" set property(v) {}",
"};",
"a.property;",
));
} | rust_cleaned_test_functions.jsonl/494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
466,
2602,
465,
18410,
12759,
368,
341,
262,
1273,
33574,
96360,
33673,
286,
330,
947,
264,
284,
314,
497,
715,
286,
330,
220,
738,
3343,
3747,
8,
4687,
756,
286,
330,
11061,
756,
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 |
#[test]
fn test_prod_float_negative() {
assert_eq!(
rune!(f32 => pub fn main() { [1.0, 0.5, 2.0, 0.0 - 3.0].iter().product() }),
-3.0
)
} | rust_cleaned_test_functions.jsonl/33617 | {
"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,
34984,
17586,
53865,
368,
341,
262,
2060,
10714,
33673,
286,
63499,
10297,
69,
18,
17,
589,
6675,
5168,
1887,
368,
314,
508,
16,
13,
15,
11,
220,
15,
13,
20,
11,
220,
17,
13,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_surface() {
let mut pixels: [u32; 4] = Default::default();
let mut canvas = Canvas::from_raster_direct_n32((2, 2), pixels.as_mut(), None).unwrap();
let ii = canvas.image_info();
let mut surface = canvas.new_surface(&ii, None).unwrap();
dbg!(&mut canvas as *mut _);
drop(canvas);
let canvas = surface.canvas();
dbg!(canvas as *mut _);
canvas.clear(Color::RED);
} | rust_cleaned_test_functions.jsonl/125502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
31030,
368,
972,
286,
1077,
5206,
15751,
25,
508,
84,
18,
17,
26,
220,
19,
60,
284,
7899,
486,
2258,
1647,
286,
1077,
5206,
10041,
284,
25698,
486,
1499,
1710,
2300,
32871,
1089,
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_cmap_format_4() {
let font = parse(&FONT_DATA).unwrap();
let cmap = font.cmap.as_ref().unwrap();
assert!(cmap.get_encoding_record(cmap.get_num_tables()).is_none());
assert!(cmap.get_encoding(cmap.get_num_tables()).is_none());
assert_eq!(font.lookup_glyph_id('A' as u32).unwrap(), 36);
assert_eq!(font.lookup_glyph_id(0x3c8).unwrap(), 405);
assert_eq!(font.lookup_glyph_id(0xfffd).unwrap(), 589);
assert_eq!(font.lookup_glyph_id(0x232B).is_none(), true);
assert_eq!(font.lookup_glyph_id(0x1000232B).is_none(), true);
// test for panics
for i in 0..0x1ffff {
font.lookup_glyph_id(i);
}
} | rust_cleaned_test_functions.jsonl/32198 | {
"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,
666,
2186,
8955,
62,
19,
368,
341,
286,
1077,
3301,
284,
4715,
2099,
43382,
7896,
568,
15454,
543,
286,
1077,
40778,
284,
3301,
520,
2186,
5357,
7793,
1005,
15454,
543,
286,
2060,
10297,
66,
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... | 2 |
#[test]
fn test_slot_to_key() {
assert_eq!(slot_to_key(0), "0000000000000000");
assert_eq!(slot_to_key(!0), "ffffffffffffffff");
} | rust_cleaned_test_functions.jsonl/28817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27563,
2346,
3097,
368,
341,
286,
2060,
10714,
10297,
21537,
2346,
3097,
7,
15,
701,
330,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
797,
286,
2060,
10714,
10297,
2153... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_0169_example_1() {
let nums = vec![3, 2, 3];
let result = 3;
assert_eq!(Solution::majority_element(nums), result);
} | rust_cleaned_test_functions.jsonl/50319 | {
"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,
62,
15,
16,
21,
24,
39304,
62,
16,
368,
341,
286,
1077,
10307,
284,
7486,
20703,
18,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
1102,
284,
220,
18,
401,
286,
2060,
10714,
10297,
36842,
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 |
#[test]
fn test_jsx() {
validate_src_jsx("<foo />").unwrap();
validate_src_jsx("<foo bar={1} />").unwrap();
validate_src_jsx("<foo bar='abc' />").unwrap();
validate_src_jsx("<foo><bar></bar></foo>").unwrap();
validate_src_jsx("<foo><bar>abc</bar></foo>").unwrap();
} | rust_cleaned_test_functions.jsonl/14176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26250,
87,
368,
341,
262,
9593,
16274,
26250,
87,
9639,
7975,
6206,
1827,
15454,
543,
262,
9593,
16274,
26250,
87,
9639,
7975,
3619,
1165,
16,
92,
6206,
1827,
15454,
543,
262,
9593,
16274,
26250,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_of_bytes() {
let parent = &[1, 2, 3, 4][..];
let sub = &parent[1..2];
assert_eq!(Span::from(sub).of(parent).unwrap(), sub);
let non_span = Span::from(&[1, 2, 2, 4][..]);
assert_eq!(non_span.of(parent), None);
} | rust_cleaned_test_functions.jsonl/124292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3575,
12524,
368,
341,
262,
1077,
2681,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
1457,
496,
935,
262,
1077,
1186,
284,
609,
3765,
58,
16,
496,
17,
935,
262,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reset() {
let mut stoch = SlowStochastic::new(3, 2).unwrap();
assert_eq!(stoch.next(10.0), 50.0);
assert_eq!(stoch.next(50.0).round(), 83.0);
assert_eq!(stoch.next(50.0).round(), 94.0);
stoch.reset();
assert_eq!(stoch.next(10.0), 50.0);
} | rust_cleaned_test_functions.jsonl/72386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18983,
368,
341,
286,
1077,
5206,
357,
4953,
284,
38147,
623,
65954,
486,
931,
7,
18,
11,
220,
17,
568,
15454,
543,
286,
2060,
10714,
10297,
267,
4953,
4529,
7,
16,
15,
13,
15,
701,
220,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_program_spec_not_logged_in() {
let context_builder = ContextBuilder::new();
let conn = context_builder.db_conn();
let hw_spec = HardwareSpecFactory::default().name("HW 1").insert(conn);
let values_list: InputValue = InputValue::list(
[1, 2, 3].iter().map(|v| InputValue::scalar(*v)).collect(),
);
let runner = QueryRunner::new(context_builder);
assert_eq!(
runner.query(
QUERY,
hashmap! {
"hardwareSpecId" => InputValue::scalar(hw_spec.id.to_string()),
"name" => InputValue::scalar(""),
"description" => InputValue::scalar("description!"),
"input" => values_list.clone(),
"expectedOutput" => values_list,
}
),
(
serde_json::Value::Null,
vec![json!({
"locations": [{"line": 9, "column": 9}],
"message": "Not logged in",
"path": ["createProgramSpec"],
})]
)
);
} | rust_cleaned_test_functions.jsonl/90809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25096,
13594,
7913,
47333,
1243,
368,
341,
262,
1077,
2266,
28532,
284,
9608,
3297,
486,
931,
543,
262,
1077,
4534,
284,
2266,
28532,
7076,
17241,
1428,
262,
1077,
31256,
13594,
284,
36765,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_syscall_name_from_arch() {
let name = get_syscall_name_from_arch(ScmpArch::Arm, 5).unwrap();
println!(
"test_get_syscall_from_name: Got syscall name of 5 on ARM arch as {}",
name
);
} | rust_cleaned_test_functions.jsonl/66422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
20344,
6659,
1269,
5673,
34330,
368,
341,
286,
1077,
829,
284,
633,
20344,
6659,
1269,
5673,
34330,
7,
3326,
1307,
18727,
486,
32913,
11,
220,
20,
568,
15454,
1428,
286,
13751,
33673,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_valid_redshift_create_cluster() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"redshift-create-cluster.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = CreateClusterMessage::default();
let result = client.create_cluster(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/12105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
26058,
13418,
8657,
28441,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
1151,
13418,
39679,
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_sparse_mixed() {
let mut builder = UnionBuilder::new_sparse(5);
builder.append::<Int32Type>("a", 1).unwrap();
builder.append::<Float64Type>("c", 3.0).unwrap();
builder.append::<Int32Type>("a", 4).unwrap();
builder.append::<Float64Type>("c", 5.0).unwrap();
builder.append::<Int32Type>("a", 6).unwrap();
let union = builder.build().unwrap();
let expected_type_ids = vec![0_i8, 1, 0, 1, 0];
// Check type ids
assert_eq!(
Buffer::from_slice_ref(&expected_type_ids),
union.data().buffers()[0]
);
for (i, id) in expected_type_ids.iter().enumerate() {
assert_eq!(id, &union.type_id(i));
}
assert_eq!(union.data().buffers().len(), 1);
for i in 0..union.len() {
let slot = union.value(i);
assert_eq!(false, union.is_null(i));
match i {
0 => {
let slot = slot.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert_eq!(1_i32, value);
}
1 => {
let slot = slot.as_any().downcast_ref::<Float64Array>().unwrap();
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert!(value - 3_f64 < f64::EPSILON);
}
2 => {
let slot = slot.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert_eq!(4_i32, value);
}
3 => {
let slot = slot.as_any().downcast_ref::<Float64Array>().unwrap();
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert!(5_f64 - value < f64::EPSILON);
}
4 => {
let slot = slot.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert_eq!(6_i32, value);
}
_ => unreachable!(),
}
}
} | rust_cleaned_test_functions.jsonl/25636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71123,
717,
3286,
368,
341,
286,
1077,
5206,
7363,
284,
9145,
3297,
486,
931,
71123,
7,
20,
317,
286,
7363,
2057,
27638,
1072,
18,
17,
929,
13211,
64,
497,
220,
16,
568,
15454,
543,
286,
7363,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_change_trust_with_source_account() {
let kp = keypair0();
let kp1 = keypair1();
let kp2 = keypair2();
let asset = Asset::new_credit("FOOBAR", kp1.public_key().clone()).unwrap();
let op = Operation::new_change_trust()
.with_source_account(kp2.public_key().clone())
.with_asset(asset)
.with_limit(Some(Stroops::max()))
.unwrap()
.build()
.unwrap();
let mut tx = Transaction::builder(kp.public_key().clone(), 3556091187167235, MIN_BASE_FEE)
.add_operation(op)
.into_transaction()
.unwrap();
tx.sign(&kp, &Network::new_test()).unwrap();
let envelope = tx.to_envelope();
let xdr = envelope.xdr_base64().unwrap();
let expected = "AAAAAgAAAADg3G3hclysZlFitS+s5zWyiiJD5B0STWy5LXCj6i5yxQAAAGQADKI/AAAAAwAAAAAAAAAAAAAAAQAAAAEAAAAAfhHLNNY19eGrAtSgLD3VpaRm2AjNjxIBWQg9zS4VWZgAAAAGAAAAAkZPT0JBUgAAAAAAAAAAAAAlyvHaD8duz+iEXkJUUbsHkklIlH46oMrMMYrt0odkfn//////////AAAAAAAAAAHqLnLFAAAAQOLqKZ6HQ5VeJvRyWk9FBA5z6UVoxKPXAODzj7c0sOr6tGYzbAtHW1ahOPdIOI03J4lGjM21ROvgi3ClSfZVUAc=";
assert_eq!(expected, xdr);
let back = TransactionEnvelope::from_xdr_base64(&xdr).unwrap();
assert_eq!(envelope, back);
} | rust_cleaned_test_functions.jsonl/8898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 706
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15947,
3547,
590,
6615,
10347,
13500,
368,
341,
286,
1077,
60319,
284,
1376,
12670,
15,
543,
286,
1077,
60319,
16,
284,
1376,
12670,
16,
543,
286,
1077,
60319,
17,
284,
1376,
12670,
17,
1428,
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_size() {
assert_eq!(std::mem::size_of::<Name<'_>>(), 16);
assert_eq!(std::mem::size_of::<Option<Name<'_>>>(), 16);
} | rust_cleaned_test_functions.jsonl/109230 | {
"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,
2368,
368,
341,
197,
6948,
10714,
10297,
1834,
486,
10536,
486,
2141,
3575,
27638,
675,
18291,
62,
2452,
1507,
220,
16,
21,
317,
197,
6948,
10714,
10297,
1834,
486,
10536,
486,
2141,
3575,
27638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.