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_exhaustive() {
const BATCH_SIZE: u32 = 1_000_000;
let counter = Arc::new(AtomicUsize::new(0));
let finished = Arc::new(AtomicUsize::new(0));
let mut workers = Vec::new();
for _ in 0..num_cpus::get() {
let counter = counter.clone();
let finished = finished.clone();
workers.push(thread::spawn(move || loop {
let batch = counter.fetch_add(1, Ordering::SeqCst) as u32;
if batch > u32::max_value() / BATCH_SIZE {
return;
}
let min = batch * BATCH_SIZE;
let max = if batch == u32::max_value() / BATCH_SIZE {
u32::max_value()
} else {
min + BATCH_SIZE - 1
};
let mut bytes = [0u8; 24];
let mut buffer = ryu::Buffer::new();
for u in min..=max {
let f = f32::from_bits(u);
if !f.is_finite() {
continue;
}
let n = unsafe { ryu::raw::format32(f, &mut bytes[0]) };
assert_eq!(Ok(Ok(f)), str::from_utf8(&bytes[..n]).map(str::parse));
assert_eq!(Ok(f), buffer.format_finite(f).parse());
}
let increment = (max - min + 1) as usize;
let update = finished.fetch_add(increment, Ordering::SeqCst);
println!("{}", update + increment);
}));
}
for w in workers {
w.join().unwrap();
}
} | rust_cleaned_test_functions.jsonl/121410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 798
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
15074,
533,
368,
341,
262,
733,
98791,
4098,
25,
575,
18,
17,
284,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
280,
262,
1077,
5546,
284,
19689,
486,
931,
7,
65857,
52,
2141,
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... | 8 |
#[test]
fn test_tz_res_loading_with_validation_invalid() -> Result<(), Error> {
let result = Loader::new_with_tz_resources_and_validation(
"/config/data/tzdata/icu/44/le",
"/pkg/data/test_inconsistent_revision.txt",
);
let err = result.unwrap_err();
assert_matches!(err, Error::Status(zx::Status::IO_DATA_INTEGRITY, Some(_)));
Ok(())
} | rust_cleaned_test_functions.jsonl/22256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
89,
4918,
57726,
6615,
19416,
31433,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1102,
284,
27811,
486,
931,
6615,
528,
89,
35569,
8378,
19416,
1006,
310,
3521,
1676,
13167,
5523,
89,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fahduration_deserialize() {
let s = r#""0.00 secs""#;
let result: FAHDuration = serde_json::from_str(s).unwrap();
assert_eq!(result.0.unwrap().num_seconds(), 0);
let s = r#""1 days""#;
let result: FAHDuration = serde_json::from_str(s).unwrap();
assert_eq!(result.0.unwrap().num_days(), 1);
let s = r#""1.1 days""#;
let result: FAHDuration = serde_json::from_str(s).unwrap();
assert_eq!(result.0.unwrap().num_days(), 1);
assert_eq!(result.0.unwrap().num_milliseconds(), 95040000);
} | rust_cleaned_test_functions.jsonl/118342 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
1466,
17021,
15768,
9050,
368,
341,
286,
1077,
274,
284,
435,
2,
3014,
15,
13,
15,
15,
49749,
3014,
2,
280,
286,
1077,
1102,
25,
15008,
39,
12945,
284,
61570,
9455,
486,
1499,
2895,
1141,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recv_into_iter_borrowed() {
let (tx, rx) = channel::<i32>();
tx.send(1).unwrap();
tx.send(2).unwrap();
drop(tx);
let mut iter = (&rx).into_iter();
assert_eq!(iter.next().unwrap(), 1);
assert_eq!(iter.next().unwrap(), 2);
assert_eq!(iter.next().is_none(), true);
} | rust_cleaned_test_functions.jsonl/39265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36118,
45514,
11723,
880,
7768,
291,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
27638,
72,
18,
17,
3913,
286,
9854,
5219,
7,
16,
568,
15454,
543,
286,
9854,
5219,
7,
17,
568,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contiguous_chunks_three_chunk() {
// create a partition with 3 chunks
let id_orders = vec![(1, 1), (2, 2), (3, 3)];
let partition = make_partitition_for_chunks_with_ids_orders(&id_orders);
let mut ids = BTreeSet::new();
ids.insert(ChunkId::new_test(1));
ids.insert(ChunkId::new_test(2));
let order_range =
RangeInclusive::new(ChunkOrder::new(1).unwrap(), ChunkOrder::new(2).unwrap());
assert!(partition.contiguous_chunks(&ids, &order_range).unwrap());
let mut ids = BTreeSet::new();
ids.insert(ChunkId::new_test(3));
ids.insert(ChunkId::new_test(2));
let order_range =
RangeInclusive::new(ChunkOrder::new(2).unwrap(), ChunkOrder::new(3).unwrap());
assert!(partition.contiguous_chunks(&ids, &order_range).unwrap());
let mut ids = BTreeSet::new();
ids.insert(ChunkId::new_test(3));
ids.insert(ChunkId::new_test(1));
let order_range =
RangeInclusive::new(ChunkOrder::new(1).unwrap(), ChunkOrder::new(3).unwrap());
assert!(!partition.contiguous_chunks(&ids, &order_range).unwrap());
} | rust_cleaned_test_functions.jsonl/69768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10260,
27029,
65470,
50016,
30539,
368,
341,
286,
442,
1855,
264,
16658,
448,
220,
18,
26757,
198,
286,
1077,
877,
37129,
284,
7486,
0,
9697,
16,
11,
220,
16,
701,
320,
17,
11,
220,
17,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strings() {
test_unchanged("abc");
test_unchanged("a c");
test_unchanged("éèê");
test(r#""{~r}{~n}{~t}""#, "\r\n\t".quote());
test(r#""'{"}\{{}}""#, "'\"\\{}".quote());
test(r#""{~u7f}ÿ""#, "\x7F\u{FF}".quote());
test(r#""Ā{~uffff}""#, "\u{100}\u{FFFF}".quote());
test(r#""က{~u10ffff}""#, "\u{1000}\u{10FFFF}".quote());
test(r#""ab{~u200b}""#, "ab\u{200B}".quote());
test(r#""{~u10d4ea}{~r}""#, "\u{10D4EA}\r".quote());
} | rust_cleaned_test_functions.jsonl/30100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33500,
368,
341,
262,
1273,
62,
3185,
3726,
445,
13683,
797,
262,
1273,
62,
3185,
3726,
445,
64,
272,
797,
262,
1273,
62,
3185,
3726,
445,
963,
4458,
5498,
3071,
262,
1273,
2601,
2,
3014,
90,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drain_filter_drop_panic_leak() {
let a = CrashTestDummy::new(0);
let b = CrashTestDummy::new(1);
let c = CrashTestDummy::new(2);
let mut set = BTreeSet::new();
set.insert(a.spawn(Panic::Never));
set.insert(b.spawn(Panic::InDrop));
set.insert(c.spawn(Panic::Never));
catch_unwind(move || drop(set.drain_filter(|dummy| dummy.query(true)))).ok();
assert_eq!(a.queried(), 1);
assert_eq!(b.queried(), 1);
assert_eq!(c.queried(), 0);
assert_eq!(a.dropped(), 1);
assert_eq!(b.dropped(), 1);
assert_eq!(c.dropped(), 1);
} | rust_cleaned_test_functions.jsonl/13747 | {
"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,
26680,
466,
8727,
29584,
620,
31270,
11751,
585,
368,
341,
262,
1077,
264,
284,
50335,
2271,
43344,
486,
931,
7,
15,
317,
262,
1077,
293,
284,
50335,
2271,
43344,
486,
931,
7,
16,
317,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_m4v() {
let format = FileFormat::from_file("fixtures/video/sample.m4v").unwrap();
assert_eq!(format, FileFormat::AppleItunesVideo);
} | rust_cleaned_test_functions.jsonl/115185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
19,
85,
368,
341,
262,
1077,
3561,
284,
2887,
4061,
486,
1499,
2458,
445,
45247,
41303,
69851,
744,
19,
85,
1827,
15454,
543,
262,
2060,
10714,
10297,
2243,
11,
2887,
4061,
486,
26567,
2132... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_write_enum() {
let animal = Dog;
assert_eq!(
with_str_writer(|writer| {
let mut encoder = Encoder::new(writer);
animal.encode(&mut encoder).unwrap();
}),
"\"Dog\""
);
assert_eq!(
with_str_writer(|writer| {
let mut encoder = PrettyEncoder::new(writer);
animal.encode(&mut encoder).unwrap();
}),
"\"Dog\""
);
let animal = Frog("Henry".into_string(), 349);
assert_eq!(
with_str_writer(|writer| {
let mut encoder = Encoder::new(writer);
animal.encode(&mut encoder).unwrap();
}),
"{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}"
);
assert_eq!(
with_str_writer(|writer| {
let mut encoder = PrettyEncoder::new(writer);
animal.encode(&mut encoder).unwrap();
}),
"{\n \
\"variant\": \"Frog\",\n \
\"fields\": [\n \
\"Henry\",\n \
349\n \
]\n\
}"
);
} | rust_cleaned_test_functions.jsonl/6537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 732
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
31054,
368,
341,
286,
1077,
9864,
284,
14254,
280,
286,
2060,
10714,
33673,
310,
448,
2895,
28908,
22428,
18189,
91,
341,
394,
1077,
5206,
23668,
284,
55115,
486,
931,
38356,
317,
394,
9864,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fetch_proposal_ok() {
let (shutdown_handle, join_handle, bind_url) =
run_rest_api_on_open_port(vec![make_fetch_proposal_resource(MockProposalStore)]);
let url = Url::parse(&format!(
"http://{}/admin/proposals/{}",
bind_url,
get_proposal().circuit_id
))
.expect("Failed to parse URL");
let req = Client::new()
.get(url)
.header("SplinterProtocolVersion", protocol::ADMIN_PROTOCOL_VERSION);
let resp = req.send().expect("Failed to perform request");
assert_eq!(resp.status(), StatusCode::OK);
let proposal: JsonValue = resp.json().expect("Failed to deserialize body");
assert_eq!(
proposal,
to_value(ProposalResponse::from(&get_proposal()))
.expect("failed to convert expected data")
);
shutdown_handle
.shutdown()
.expect("unable to shutdown rest api");
join_handle.join().expect("Unable to join rest api thread");
} | rust_cleaned_test_functions.jsonl/48752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
21663,
32556,
19817,
368,
341,
286,
1077,
320,
59547,
10630,
11,
5138,
10630,
11,
10719,
2903,
8,
4035,
310,
1598,
32231,
11697,
4470,
11311,
8716,
25592,
20703,
6927,
11803,
21663,
32556,
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_compatibility() {
assert!(check_version(VERSION, "foo path").is_ok());
// Current release if OK
assert!(check_version("0.17.0", "foo path").is_ok());
// Prev major release is ERR
// - Not yet
assert!(check_version("0.16.0", "foo path").is_err());
// Prev bugfix release is OK
// Next major release is ERR
assert!(check_version("1.17.0", "foo path").is_err());
// Next minor release is ERR
assert!(check_version("0.18.0", "foo path").is_err());
assert!(check_version("0.17.1", "foo path").is_err());
} | rust_cleaned_test_functions.jsonl/120409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
53053,
368,
341,
286,
2060,
10297,
2028,
9438,
7,
17636,
11,
330,
7975,
1815,
1827,
285,
19817,
5231,
286,
442,
9125,
4879,
421,
10402,
198,
286,
2060,
10297,
2028,
9438,
445,
15,
13,
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_iter_categorical() {
use crate::reset_string_cache;
use crate::SINGLE_LOCK;
let _lock = SINGLE_LOCK.lock();
reset_string_cache();
let ca =
Utf8Chunked::new_from_opt_slice("", &[Some("foo"), None, Some("bar"), Some("ham")]);
let ca = ca.cast::<CategoricalType>().unwrap();
let v: Vec<_> = ca.into_iter().collect();
assert_eq!(v, &[Some(0), None, Some(1), Some(2)]);
} | rust_cleaned_test_functions.jsonl/68263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
87455,
368,
341,
286,
990,
17717,
486,
9716,
3904,
11529,
280,
286,
990,
17717,
486,
50,
25696,
27661,
280,
286,
1077,
716,
1023,
284,
66759,
27661,
21003,
543,
286,
7585,
3904,
11529,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_style_color_indexing() {
let (_guard, mut ctx) = crate::test::test_ctx();
let style = ctx.style_mut();
let value = [0.1, 0.2, 0.3, 1.0];
style[StyleColor::Tab] = value;
assert_eq!(style[StyleColor::Tab], value);
assert_eq!(style.colors[StyleColor::Tab as usize], value);
} | rust_cleaned_test_functions.jsonl/13995 | {
"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,
15117,
6714,
3560,
287,
368,
341,
262,
1077,
5453,
26098,
11,
5206,
5635,
8,
284,
17717,
486,
1944,
486,
1944,
15147,
543,
262,
1077,
1707,
284,
5635,
7353,
29523,
543,
262,
1077,
897,
284,
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,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_histogram() {
let client = new_nop_client("client.test");
let expected = Histogram::new("client.test.", "histogram.key", 20);
assert_eq!(expected, client.histogram("histogram.key", 20).unwrap());
} | rust_cleaned_test_functions.jsonl/47006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
68564,
368,
341,
262,
1077,
2943,
284,
501,
1089,
453,
8179,
445,
2972,
5958,
797,
262,
1077,
3601,
284,
82138,
486,
931,
445,
2972,
5958,
10465,
330,
21158,
12958,
4735,
497,
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_to_value_unit_enum() {
let test = TestUnitExternalEnum {
a: UnitExternalEnum::Val1,
};
let expected = Value::Record(vec![("a".to_owned(), Value::Enum(0, "Val1".to_owned()))]);
assert_eq!(
to_value(test).unwrap(),
expected,
"Error serializing unit external enum"
);
let test = TestUnitInternalEnum {
a: UnitInternalEnum::Val1,
};
let expected = Value::Record(vec![(
"a".to_owned(),
Value::Record(vec![("t".to_owned(), Value::String("Val1".to_owned()))]),
)]);
assert_eq!(
to_value(test).unwrap(),
expected,
"Error serializing unit internal enum"
);
let test = TestUnitAdjacentEnum {
a: UnitAdjacentEnum::Val1,
};
let expected = Value::Record(vec![(
"a".to_owned(),
Value::Record(vec![("t".to_owned(), Value::String("Val1".to_owned()))]),
)]);
assert_eq!(
to_value(test).unwrap(),
expected,
"Error serializing unit adjacent enum"
);
let test = TestUnitUntaggedEnum {
a: UnitUntaggedEnum::Val1,
};
let expected = Value::Record(vec![("a".to_owned(), Value::Null)]);
assert_eq!(
to_value(test).unwrap(),
expected,
"Error serializing unit untagged enum"
);
} | rust_cleaned_test_functions.jsonl/52762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 781
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3142,
14832,
31054,
368,
341,
286,
1077,
1273,
284,
3393,
4562,
25913,
10766,
341,
310,
264,
25,
7954,
25913,
10766,
486,
2208,
16,
345,
286,
3634,
286,
1077,
3601,
284,
5162,
486,
6471,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_no_such_bucket_error() {
let mock = MockRequestDispatcher::with_status(404).with_body(
r#"<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<RequestId>4442587FB7D0A2F9</RequestId>
</Error>"#,
);
let request = ListObjectsV2Request {
bucket: "no-such-bucket".to_owned(),
..Default::default()
};
let client = S3Client::new_with(mock, MockCredentialsProvider, Region::UsEast1);
let result = client.list_objects_v2(request).sync();
assert!(result.is_err());
let err = result.err().unwrap();
assert_eq!(
RusotoError::Service(ListObjectsV2Error::NoSuchBucket(
"The specified bucket does not exist".to_owned()
)),
err
);
} | rust_cleaned_test_functions.jsonl/110093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6536,
643,
1387,
38749,
4096,
368,
341,
262,
1077,
7860,
284,
14563,
1900,
21839,
486,
4197,
4773,
7,
19,
15,
19,
568,
4197,
14114,
1006,
286,
435,
55543,
1316,
6455,
2319,
428,
16,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_membership_tsv() -> Result<(), Error> {
let mut rdr = ReaderBuilder::new()
.delimiter(b'\t')
.from_path("tests/data/import-test/m.tsv")?;
rdr.deserialize()
.collect::<Result<Vec<MozilliansGroupMembership>, csv::Error>>()?;
Ok(())
} | rust_cleaned_test_functions.jsonl/52236 | {
"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,
84635,
528,
3492,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
66984,
284,
25166,
3297,
486,
931,
741,
310,
659,
58116,
1883,
15777,
83,
1305,
310,
659,
1499,
2638,
445,
23841,
13167,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_find_all_refs_nested_module() {
check(
r#"
//- /lib.rs
mod foo { mod bar; }
fn f<|>() {}
//- /foo/bar.rs
use crate::f;
fn g() { f(); }
"#,
expect![[r#"
f Function FileId(0) 22..31 25..26 Other
FileId(1) 11..12 Other
FileId(1) 24..25 StructLiteral
"#]],
);
} | rust_cleaned_test_functions.jsonl/47785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
66279,
10750,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
314,
1463,
3619,
26,
555,
8822,
282,
27,
91,
13555,
10086,
61463,
608,
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_vmhd() {
let src_box = VmhdBox {
version: 0,
flags: 1,
graphics_mode: 0,
op_color: RgbColor {
red: 0,
green: 0,
blue: 0,
},
};
let mut buf = Vec::new();
src_box.write_box(&mut buf).unwrap();
assert_eq!(buf.len(), src_box.box_size() as usize);
let mut reader = Cursor::new(&buf);
let header = BoxHeader::read(&mut reader).unwrap();
assert_eq!(header.name, BoxType::VmhdBox);
assert_eq!(src_box.box_size(), header.size);
let dst_box = VmhdBox::read_box(&mut reader, header.size).unwrap();
assert_eq!(src_box, dst_box);
} | rust_cleaned_test_functions.jsonl/63905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39008,
15990,
368,
341,
286,
1077,
2286,
10194,
284,
647,
76,
15990,
1611,
341,
310,
2319,
25,
220,
15,
345,
310,
8042,
25,
220,
16,
345,
310,
14181,
7302,
25,
220,
15,
345,
310,
1179,
6714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f4p() {
let format = FileFormat::from_file("fixtures/video/sample.f4p").unwrap();
assert_eq!(format, FileFormat::AdobeFlashPlayerProtectedVideo);
} | rust_cleaned_test_functions.jsonl/115182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
19,
79,
368,
341,
262,
1077,
3561,
284,
2887,
4061,
486,
1499,
2458,
445,
45247,
41303,
69851,
833,
19,
79,
1827,
15454,
543,
262,
2060,
10714,
10297,
2243,
11,
2887,
4061,
486,
81605,
2387... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_media_task_ending_ends_future() {
let mut exec = fasync::TestExecutor::new().expect("failed to create an executor");
let mut task_builder = TestMediaTaskBuilder::new();
let mut stream = Stream::build(
make_sbc_endpoint(1, avdtp::EndpointType::Source),
task_builder.builder(),
);
let next_task_fut = task_builder.next_task();
let peer_id = PeerId(1);
let remote_id = 1_u8.try_into().expect("good id");
let sbc_codec_cap = sbc_mediacodec_capability();
let expected_codec_config =
MediaCodecConfig::try_from(&sbc_codec_cap).expect("codec config");
assert!(exec.run_singlethreaded(stream.configure(&peer_id, &remote_id, vec![])).is_err());
assert!(exec
.run_singlethreaded(stream.configure(&peer_id, &remote_id, vec![sbc_codec_cap]))
.is_ok());
stream.endpoint_mut().establish().expect("establishment should start okay");
let (_remote, transport) = Channel::create();
stream.endpoint_mut().receive_channel(transport).expect("should be ready for a channel");
let stream_finish_fut = stream.start().expect("start to succeed with a future");
pin_mut!(stream_finish_fut);
let task = {
pin_mut!(next_task_fut);
match exec.run_until_stalled(&mut next_task_fut) {
Poll::Ready(Some(task)) => task,
x => panic!("Expected next task to be sent after start, got {:?}", x),
}
};
assert_eq!(task.peer_id, PeerId(1));
assert_eq!(task.codec_config, expected_codec_config);
// Does not need to be polled to be started.
assert!(task.is_started());
assert!(exec.run_until_stalled(&mut stream_finish_fut).is_pending());
task.end_prematurely(Some(Ok(())));
assert!(!task.is_started());
match exec.run_until_stalled(&mut stream_finish_fut) {
Poll::Ready(Ok(())) => {}
x => panic!("Expected to get ready Ok from finish future, but got {:?}", x),
};
// Should still be able to suspend the stream.
assert!(stream.suspend().is_ok());
// And be able to restart it.
let result_fut = stream.start().expect("start to succeed with a future");
let next_task_fut = task_builder.next_task();
pin_mut!(next_task_fut);
let task = match exec.run_until_stalled(&mut next_task_fut) {
Poll::Ready(Some(task)) => task,
x => panic!("Expected next task to be sent during configure, got {:?}", x),
};
assert!(task.is_started());
// Dropping the result future shouldn't stop the media task.
drop(result_fut);
assert!(task.is_started());
} | rust_cleaned_test_functions.jsonl/125334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29173,
12184,
62,
2459,
90729,
59740,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
1077,
5206,
3383,
2853... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_table_id() {
let tests = vec![0, 2, 3, 1024, i64::MAX];
for &tid in &tests {
let k = encode_row_key(tid, 1);
assert_eq!(tid, decode_table_id(&k).unwrap());
let k = encode_index_seek_key(tid, 1, &k);
assert_eq!(tid, decode_table_id(&k).unwrap());
assert!(decode_table_id(b"xxx").is_err());
}
} | rust_cleaned_test_functions.jsonl/3835 | {
"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,
15227,
5237,
842,
368,
341,
286,
1077,
7032,
284,
7486,
20703,
15,
11,
220,
17,
11,
220,
18,
11,
220,
16,
15,
17,
19,
11,
600,
21,
19,
486,
10586,
935,
286,
369,
609,
24449,
304,
609,
2384... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tap_configure() {
// the end of the function.
let tap_ip_guard = TAP_IP_LOCK.lock().unwrap();
let tap = Tap::new(1).unwrap();
let ip_addr: net::Ipv4Addr = (*tap_ip_guard).parse().unwrap();
let netmask: net::Ipv4Addr = SUBNET_MASK.parse().unwrap();
let ret = tap.set_ip_addr(ip_addr);
assert!(ret.is_ok());
let ret = tap.set_netmask(netmask);
assert!(ret.is_ok());
} | rust_cleaned_test_functions.jsonl/55542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
391,
75887,
368,
341,
73363,
286,
442,
279,
835,
315,
279,
729,
624,
286,
1077,
15239,
10385,
36796,
284,
350,
2537,
16607,
27661,
21003,
1005,
15454,
1428,
286,
1077,
15239,
284,
36134,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_invalid_windows_1257_to_cow_without_bom_handling_and_without_replacement() {
assert!(WINDOWS_1257
.decode_without_bom_handling_and_without_replacement(b"abc\x80\xA1\xE4")
.is_none());
} | rust_cleaned_test_functions.jsonl/90264 | {
"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,
15227,
31433,
58220,
62,
16,
17,
20,
22,
2346,
666,
363,
39904,
880,
316,
75642,
8378,
39904,
1288,
16101,
368,
341,
286,
2060,
10297,
75067,
62,
16,
17,
20,
22,
198,
310,
659,
18196,
39904,
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_human_compute_value () {
use crate::lib::model::card::Deck;
use crate::lib::model::player::Player;
use crate::lib::model::player::Human;
let mut d = Deck::new();
let mut h = Human::new();
//before drawing cards hand value at zero
let mut i: u8 = h.compute_value();
assert!(i == 0);
//after drawing cards hand value greater than zero
h.draw_card(&mut d);
i = h.compute_value();
assert!(i > 0);
} | rust_cleaned_test_functions.jsonl/125159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86247,
57028,
3142,
1719,
341,
1789,
286,
990,
17717,
486,
2740,
486,
2528,
486,
4951,
486,
39368,
280,
286,
990,
17717,
486,
2740,
486,
2528,
486,
3434,
486,
4476,
280,
286,
990,
17717,
486,
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_projection_plan() -> Result<()> {
use pretty_assertions::assert_eq;
let schema = DataSchemaRefExt::create(vec![DataField::new("a", DataType::Utf8, false)]);
let empty_plan = EmptyPlan::create_with_schema(schema.clone());
let projection = PlanNode::Projection(ProjectionPlan {
expr: vec![col("a")],
schema: DataSchemaRefExt::create(vec![DataField::new("a", DataType::Utf8, false)]),
input: Arc::from(PlanBuilder::from(&PlanNode::Empty(empty_plan)).build()?),
});
let _ = projection.schema();
let expect = "Projection: a:Utf8";
let actual = format!("{:?}", projection);
assert_eq!(expect, actual);
Ok(())
} | rust_cleaned_test_functions.jsonl/117021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72738,
26564,
368,
1464,
5714,
71698,
341,
262,
990,
5020,
16553,
908,
486,
2207,
10714,
401,
262,
1077,
10802,
284,
2885,
8632,
3945,
6756,
486,
3182,
25592,
20703,
1043,
1877,
486,
931,
445,
64,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_program_native_noop() {
solana_logger::setup();
let (genesis_config, alice_keypair) = create_genesis_config(50);
let program_id = solana_sdk::pubkey::new_rand();
let bank = Bank::new(&genesis_config);
bank.add_native_program("solana_noop_program", &program_id);
// Call user program
let instruction = create_invoke_instruction(alice_keypair.pubkey(), program_id, &1u8);
let bank_client = BankClient::new(bank);
bank_client
.send_and_confirm_instruction(&alice_keypair, instruction)
.unwrap();
} | rust_cleaned_test_functions.jsonl/705 | {
"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,
25096,
44494,
6536,
453,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
320,
77894,
5332,
11,
70433,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
317,
262,
1077,
202... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_declaration_invalid_missing_body() {
let mut p = make_parser("function name");
assert_eq!(Err(UnexpectedEOF), p.function_declaration());
let mut p = make_parser("function name()");
assert_eq!(Err(UnexpectedEOF), p.function_declaration());
let mut p = make_parser("name()");
assert_eq!(Err(UnexpectedEOF), p.function_declaration());
} | rust_cleaned_test_functions.jsonl/69870 | {
"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,
9174,
77926,
31433,
40447,
14114,
368,
341,
262,
1077,
5206,
281,
284,
1281,
18517,
445,
1688,
829,
797,
262,
2060,
10714,
10297,
7747,
7,
29430,
23483,
701,
281,
20086,
77926,
1423,
262,
1077,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_byte_equal_vbuf_vbuf() {
use impls::ROIobuf;
let b0 = [
ROIobuf::from_str("1234"),
ROIobuf::from_str("5678"),
ROIobuf::from_str("9"),
];
let b1 = [
ROIobuf::from_str("12"),
ROIobuf::from_str("34567"),
ROIobuf::from_str("89"),
];
let b2 = [
ROIobuf::from_str("123456789"),
];
let b3 = [
ROIobuf::from_str("123456780"),
];
let b4 = [
ROIobuf::from_str("11111111111111"),
];
assert!(byte_equal_vbuf_vbuf(&b0, &b1));
assert!(byte_equal_vbuf_vbuf(&b1, &b0));
assert!(byte_equal_vbuf_vbuf(&b0, &b2));
assert!(byte_equal_vbuf_vbuf(&b2, &b0));
assert!(byte_equal_vbuf_vbuf(&b1, &b2));
assert!(byte_equal_vbuf_vbuf(&b2, &b1));
assert!(!byte_equal_vbuf_vbuf(&b0, &b3));
assert!(!byte_equal_vbuf_vbuf(&b1, &b3));
assert!(!byte_equal_vbuf_vbuf(&b2, &b3));
assert!(!byte_equal_vbuf_vbuf(&b0, &b4));
assert!(!byte_equal_vbuf_vbuf(&b1, &b4));
assert!(!byte_equal_vbuf_vbuf(&b2, &b4));
assert!(!byte_equal_vbuf_vbuf(&b3, &b4));
} | rust_cleaned_test_functions.jsonl/5463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
11478,
2273,
5909,
2273,
5909,
368,
341,
220,
990,
11605,
82,
486,
71270,
18464,
401,
220,
1077,
293,
15,
284,
2278,
262,
50652,
18464,
486,
1499,
2895,
445,
16,
17,
18,
19,
4461,
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_format_bytes() {
// Valid UTF-8 string.
assert_eq!("🚀oak⭐", format_bytes("🚀oak⭐".as_bytes()));
// Incorret_eq!("[0, 159, 146, 150]", format_bytes(&[0, 159, 146, 150]));
} | rust_cleaned_test_functions.jsonl/87522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
12524,
368,
341,
262,
442,
7818,
20076,
12,
23,
914,
624,
262,
2060,
10714,
17223,
145836,
78,
585,
144363,
497,
3561,
12524,
445,
145836,
78,
585,
144363,
3263,
300,
12524,
7392,
262,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamp_raw() -> Result<()> {
let db = Connection::open_in_memory()?;
let sql = "BEGIN;
CREATE TABLE timestamp (sec TIMESTAMP_S, milli TIMESTAMP_MS, micro TIMESTAMP_US, nano TIMESTAMP_NS );
INSERT INTO timestamp VALUES (NULL,NULL,NULL,NULL );
INSERT INTO timestamp VALUES ('2008-01-01 00:00:01','2008-01-01 00:00:01.594','2008-01-01 00:00:01.88926','2008-01-01 00:00:01.889268321' );
INSERT INTO timestamp VALUES (NULL,NULL,NULL,1199145601889268321 );
END;";
db.execute_batch(sql)?;
let v = db.query_row(
"SELECT sec, milli, micro, nano FROM timestamp WHERE sec is not null",
[],
|row| <(i64, i64, i64, i64)>::try_from(row),
)?;
assert_eq!(v, (1199145601, 1199145601594, 1199145601889260, 1199145601889268000));
Ok(())
} | rust_cleaned_test_functions.jsonl/133820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 482
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
16067,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
94136,
286,
1077,
5704,
284,
330,
37588,
280,
4293,
30776,
14363,
11441,
320,
5024,
92592,
1098,
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_rng_32_reseed() {
let s = task_rng().gen_vec::<u32>(256);
let mut r: IsaacRng = SeedableRng::from_seed(s.as_slice());
let string1 = r.gen_ascii_str(100);
r.reseed(s.as_slice());
let string2 = r.gen_ascii_str(100);
assert_eq!(string1, string2);
} | rust_cleaned_test_functions.jsonl/85140 | {
"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,
66849,
62,
18,
17,
1288,
22602,
368,
341,
286,
1077,
274,
284,
3383,
66849,
1005,
4370,
13251,
27638,
84,
18,
17,
2235,
17,
20,
21,
317,
286,
1077,
5206,
435,
25,
41508,
49,
968,
284,
35822,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_annotation_in_comments_a() {
let comments = vec![CommentText {
position: 0,
text: "".to_string().chars().collect(),
}];
let annotations = find_annotations_in_comments(&comments);
assert_eq!(annotations.len(), 0);
} | rust_cleaned_test_functions.jsonl/126913 | {
"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,
21814,
61237,
1243,
30359,
4306,
368,
341,
286,
1077,
6042,
284,
7486,
20703,
10677,
1178,
341,
310,
2309,
25,
220,
15,
345,
310,
1467,
25,
44907,
983,
3904,
1005,
19255,
1005,
17384,
3148,
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_new_ship() {
let ship = Ship::new(Coordinates { x: 0, y: 0 }, Heading::East, 2);
assert_eq!(ship.origin.x, 0);
assert_eq!(ship.origin.y, 0);
assert_eq!(ship.heading, Heading::East);
} | rust_cleaned_test_functions.jsonl/99679 | {
"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,
5921,
31042,
368,
341,
286,
1077,
8284,
284,
26803,
486,
931,
3025,
78,
8742,
314,
856,
25,
220,
15,
11,
379,
25,
220,
15,
2470,
51349,
486,
36340,
11,
220,
17,
317,
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,
1... | 1 |
#[test]
fn test_empty_key_in_object_pattern_removed() {
test("const {f: {}} = {};", "");
test("const {f: []} = {};", "");
test("const {f: {}, g} = {};", "const {g} = {};");
test("const {f: [], g} = {};", "const {g} = {};");
test_same("const {[foo()]: {}} = {};");
} | rust_cleaned_test_functions.jsonl/481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
3097,
1243,
5314,
21260,
68248,
368,
341,
262,
1273,
445,
1024,
314,
69,
25,
314,
3417,
284,
4687,
32503,
14498,
262,
1273,
445,
1024,
314,
69,
25,
3056,
92,
284,
4687,
32503,
14498,
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_command() {
let valid_command = Command {
application_id: Some(Id::new(1)),
default_permission: None,
description: "a".repeat(100),
guild_id: Some(Id::new(2)),
id: Some(Id::new(3)),
kind: CommandType::ChatInput,
name: "b".repeat(32),
options: Vec::new(),
version: Id::new(4),
};
assert!(command(&valid_command).is_ok());
let invalid_command = Command {
description: "c".repeat(101),
name: "d".repeat(33),
..valid_command
};
assert!(command(&invalid_command).is_err());
} | rust_cleaned_test_functions.jsonl/101279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10811,
368,
341,
286,
1077,
2697,
10811,
284,
7348,
341,
310,
3766,
842,
25,
4329,
55924,
486,
931,
7,
16,
6965,
310,
1638,
37971,
25,
2240,
345,
310,
4008,
25,
330,
64,
3263,
30624,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_external_word() {
let _ = pretty_env_logger::try_init();
equal_tokens!(
"cargo +nightly run" ->
b::pipeline(vec![(
None,
b::call(
b::bare("cargo"),
vec![
b::sp(),
b::external_word("+nightly"),
b::sp(),
b::bare("run")
]
),
None
)])
);
equal_tokens!(
"rm foo%bar" ->
b::pipeline(vec![(
None,
b::call(b::bare("rm"), vec![b::sp(), b::external_word("foo%bar"),]),
None
)])
);
equal_tokens!(
"rm foo%bar" ->
b::pipeline(vec![(
None,
b::call(b::bare("rm"), vec![b::sp(), b::external_word("foo%bar"),]),
None
)])
);
} | rust_cleaned_test_functions.jsonl/46730 | {
"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,
47432,
13533,
368,
341,
286,
1077,
716,
284,
5020,
15879,
27413,
486,
1539,
6137,
1428,
286,
6144,
28838,
33673,
310,
330,
66715,
488,
9287,
398,
1598,
1,
12381,
310,
293,
486,
51258,
25592,
20703... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transactions_from_packets() {
use analog_sdk::feature_set::FeatureSet;
let keypair = Keypair::new();
let transfer_tx =
system_transaction::transfer(&keypair, &keypair.pubkey(), 1, Hash::default());
let vote_tx = vote_transaction::new_vote_transaction(
vec![42],
Hash::default(),
Hash::default(),
&keypair,
&keypair,
&keypair,
None,
);
// packets with no votes
{
let vote_indexes = vec![];
let (packets, packet_indexes) =
make_test_packets(vec![transfer_tx.clone(), transfer_tx.clone()], vote_indexes);
let mut votes_only = false;
let (txs, tx_packet_index, _retryable_packet_indexes) =
BankingStage::transactions_from_packets(
&packets,
&packet_indexes,
&Arc::new(FeatureSet::default()),
&RwLock::new(CostTracker::default()).read().unwrap(),
&BankingStageStats::default(),
false,
votes_only,
&Arc::new(RwLock::new(CostModel::default())),
);
assert_eq!(2, txs.len());
assert_eq!(vec![0, 1], tx_packet_index);
votes_only = true;
let (txs, tx_packet_index, _retryable_packet_indexes) =
BankingStage::transactions_from_packets(
&packets,
&packet_indexes,
&Arc::new(FeatureSet::default()),
&RwLock::new(CostTracker::default()).read().unwrap(),
&BankingStageStats::default(),
false,
votes_only,
&Arc::new(RwLock::new(CostModel::default())),
);
assert_eq!(0, txs.len());
assert_eq!(0, tx_packet_index.len());
}
// packets with some votes
{
let vote_indexes = vec![0, 2];
let (packets, packet_indexes) = make_test_packets(
vec![vote_tx.clone(), transfer_tx, vote_tx.clone()],
vote_indexes,
);
let mut votes_only = false;
let (txs, tx_packet_index, _retryable_packet_indexes) =
BankingStage::transactions_from_packets(
&packets,
&packet_indexes,
&Arc::new(FeatureSet::default()),
&RwLock::new(CostTracker::default()).read().unwrap(),
&BankingStageStats::default(),
false,
votes_only,
&Arc::new(RwLock::new(CostModel::default())),
);
assert_eq!(3, txs.len());
assert_eq!(vec![0, 1, 2], tx_packet_index);
votes_only = true;
let (txs, tx_packet_index, _retryable_packet_indexes) =
BankingStage::transactions_from_packets(
&packets,
&packet_indexes,
&Arc::new(FeatureSet::default()),
&RwLock::new(CostTracker::default()).read().unwrap(),
&BankingStageStats::default(),
false,
votes_only,
&Arc::new(RwLock::new(CostModel::default())),
);
assert_eq!(2, txs.len());
assert_eq!(vec![0, 2], tx_packet_index);
}
// packets with all votes
{
let vote_indexes = vec![0, 1, 2];
let (packets, packet_indexes) = make_test_packets(
vec![vote_tx.clone(), vote_tx.clone(), vote_tx],
vote_indexes,
);
let mut votes_only = false;
let (txs, tx_packet_index, _retryable_packet_indexes) =
BankingStage::transactions_from_packets(
&packets,
&packet_indexes,
&Arc::new(FeatureSet::default()),
&RwLock::new(CostTracker::default()).read().unwrap(),
&BankingStageStats::default(),
false,
votes_only,
&Arc::new(RwLock::new(CostModel::default())),
);
assert_eq!(3, txs.len());
assert_eq!(vec![0, 1, 2], tx_packet_index);
votes_only = true;
let (txs, tx_packet_index, _retryable_packet_indexes) =
BankingStage::transactions_from_packets(
&packets,
&packet_indexes,
&Arc::new(FeatureSet::default()),
&RwLock::new(CostTracker::default()).read().unwrap(),
&BankingStageStats::default(),
false,
votes_only,
&Arc::new(RwLock::new(CostModel::default())),
);
assert_eq!(3, txs.len());
assert_eq!(vec![0, 1, 2], tx_packet_index);
}
} | rust_cleaned_test_functions.jsonl/4999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3005
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68182,
5673,
63569,
368,
341,
286,
990,
23400,
61783,
486,
12753,
2602,
486,
13859,
1649,
280,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
8317,
17805,
4035,
310,
1849... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_div32_high_divisor() {
test_interpreter_and_jit_asm!(
"
mov r0, 12
lddw r1, 0x100000004
div32 r0, r1
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x3 } },
4
);
} | rust_cleaned_test_functions.jsonl/58957 | {
"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,
16237,
18,
17,
22680,
16237,
15841,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
220,
16,
17,
198,
286,
326,
631,
86,
435,
16,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_count_by() -> Fallible<()> {
let arg = vec![true, true, true, false, true, false, false, false, true, true];
let transformation = make_count_by::<L2Distance<f64>, bool, i8>()?;
let ret = transformation.invoke(&arg)?;
let mut expected = HashMap::new();
expected.insert(true, 6);
expected.insert(false, 4);
assert_eq!(ret, expected);
assert!(!transformation.check(&6, &4.2426)?);
assert!(transformation.check(&6, &4.24265)?);
Ok(())
} | rust_cleaned_test_functions.jsonl/109026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
3180,
3710,
368,
1464,
14785,
1238,
71698,
341,
286,
1077,
1392,
284,
7486,
20703,
1866,
11,
830,
11,
830,
11,
895,
11,
830,
11,
895,
11,
895,
11,
895,
11,
830,
11,
830,
935,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_offset_calculation() {
assert_eq!(calculate_allocation(128, 8, 15, 1, 4, 4), (8, 0, 148, false));
assert_eq!(calculate_allocation(3, 1, 2, 1, 1, 1), (1, 0, 6, false));
assert_eq!(calculate_allocation(6, 2, 12, 4, 24, 8), (8, 0, 48, false));
assert_eq!(calculate_offsets(128, 15, 1, 4), (128, 144, false));
assert_eq!(calculate_offsets(3, 2, 1, 1), (3, 5, false));
assert_eq!(calculate_offsets(6, 12, 4, 8), (8, 24, false));
} | rust_cleaned_test_functions.jsonl/39865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6917,
38241,
2914,
368,
341,
262,
2060,
10714,
10297,
35597,
81267,
7,
16,
17,
23,
11,
220,
23,
11,
220,
16,
20,
11,
220,
16,
11,
220,
19,
11,
220,
220,
19,
701,
320,
23,
11,
220,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_matrix() {
let mut builder = DictionaryBuilder::default();
let mut writer = Cursor::new(vec![]);
let mut matrix_reader =
Cursor::new("2 3\n0 0 0\n0 1 1\n0 2 2\n\n1 0 3\n1 1 4\n1 2 5\n".as_bytes());
builder
.write_matrix(&mut matrix_reader, &mut writer)
.unwrap();
writer.seek(SeekFrom::Start(0)).unwrap();
let mut buf = [0, 0];
writer.read_exact(&mut buf).unwrap();
assert_eq!(2, i16::from_le_bytes(buf));
let mut buf = [0, 0];
writer.read_exact(&mut buf).unwrap();
assert_eq!(3, i16::from_le_bytes(buf));
writer.seek(SeekFrom::Start(4)).unwrap();
let mut buf = [0, 0];
writer.read_exact(&mut buf).unwrap();
assert_eq!(0, u16::from_le_bytes(buf));
writer.seek(SeekFrom::Start(4 + 6)).unwrap();
let mut buf = [0, 0];
writer.read_exact(&mut buf).unwrap();
assert_eq!(4, u16::from_le_bytes(buf));
} | rust_cleaned_test_functions.jsonl/134075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
10193,
368,
341,
262,
1077,
5206,
7363,
284,
10466,
3297,
486,
2258,
543,
262,
1077,
5206,
6916,
284,
28067,
486,
931,
25592,
0,
56703,
262,
1077,
5206,
6172,
22306,
4035,
414,
28067,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reserved_key() {
use super::check_reserved_keys;
use crate::event::Key;
assert!(
check_reserved_keys(Key::Enter).is_err(),
"Enter key should be reserved"
);
} | rust_cleaned_test_functions.jsonl/2766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74913,
3097,
368,
341,
262,
990,
2256,
486,
2028,
74913,
12631,
280,
262,
990,
17717,
486,
3087,
486,
1592,
401,
262,
2060,
33673,
414,
1779,
74913,
12631,
21358,
486,
6269,
568,
285,
9266,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_next() {
let mut ppo = Ppo::new(3, 6, 4).unwrap();
assert_eq!(round(ppo.next(2.0).into()), (0.0, 0.0, 0.0));
assert_eq!(round(ppo.next(3.0).into()), (9.38, 3.75, 5.63));
assert_eq!(round(ppo.next(4.2).into()), (18.26, 9.56, 8.71));
assert_eq!(round(ppo.next(7.0).into()), (28.62, 17.18, 11.44));
assert_eq!(round(ppo.next(6.7).into()), (24.01, 19.91, 4.09));
assert_eq!(round(ppo.next(6.5).into()), (17.84, 19.08, -1.24));
} | rust_cleaned_test_functions.jsonl/131869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
368,
341,
286,
1077,
5206,
281,
5368,
284,
393,
5368,
486,
931,
7,
18,
11,
220,
21,
11,
220,
19,
568,
15454,
1428,
286,
2060,
10714,
10297,
1049,
7,
39480,
4529,
7,
17,
13,
15,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_n_triples_literal_node_with_language_formatting() {
let formatter = NTriplesFormatter::new();
let node = Node::LiteralNode {
literal: "literal".to_string(),
data_type: None,
language: Some("en".to_string()),
};
assert_eq!(formatter.format_node(&node), "\"literal\"@en".to_string());
} | rust_cleaned_test_functions.jsonl/64044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
3547,
37458,
34100,
5084,
6615,
29021,
8955,
1280,
368,
341,
286,
1077,
24814,
284,
17658,
4561,
642,
14183,
486,
931,
543,
286,
1077,
2436,
284,
6018,
486,
17350,
1955,
341,
310,
23141,
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_locate() -> Result<(), IndexError> {
let mut x: MyVec<usize> = MyVec::new();
List::insert(&mut x, 0, 11)?;
assert_eq!(PartialEqListExt::locate(&x, &11), Some(0));
Ok(())
} | rust_cleaned_test_functions.jsonl/24006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13400,
349,
368,
1464,
5714,
68843,
60203,
29,
341,
262,
1077,
5206,
856,
25,
3017,
10050,
90244,
29,
284,
3017,
10050,
486,
931,
543,
262,
1759,
486,
4208,
2099,
6984,
856,
11,
220,
15,
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... | 2 |
#[test]
fn test_username_parser() {
assert_eq!(parse_username("<@12345>").unwrap(), 12_345);
assert_eq!(parse_username("<@!12345>").unwrap(), 12_345);
} | rust_cleaned_test_functions.jsonl/58600 | {
"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,
21588,
18517,
368,
341,
286,
2060,
10714,
10297,
6400,
21588,
9639,
31,
16,
17,
18,
19,
20,
61032,
15454,
1507,
220,
16,
17,
62,
18,
19,
20,
317,
286,
2060,
10714,
10297,
6400,
21588,
9639,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_replace_result_unwrap_with_match() {
check_assist(
replace_unwrap_with_match,
r"
enum Result<T, E> { Ok(T), Err(E) }
fn i<T>(a: T) -> T { a }
fn main() {
let x: Result<i32, i32> = Result::Ok(92);
let y = i(x).<|>unwrap();
}
",
r"
enum Result<T, E> { Ok(T), Err(E) }
fn i<T>(a: T) -> T { a }
fn main() {
let x: Result<i32, i32> = Result::Ok(92);
let y = <|>match i(x) {
Ok(a) => a,
_ => unreachable!(),
};
}
",
)
} | rust_cleaned_test_functions.jsonl/67848 | {
"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,
10633,
5287,
4907,
10097,
6615,
10708,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8290,
4907,
10097,
6615,
10708,
345,
310,
435,
698,
9018,
5714,
3125,
11,
468,
29,
314,
7622,
4140,
701,
15495,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_in_set() {
let cases = vec![
("foo", "foo,bar", 1),
("foo", "foobar,bar", 0),
(" foo ", "foo, foo ", 2),
("", "foo,bar,", 3),
("", "", 0),
("a,b", "a,b,c", 0),
];
for (s, sl, expect) in cases {
let sl = Datum::Bytes(sl.as_bytes().to_vec());
let s = Datum::Bytes(s.as_bytes().to_vec());
let got = eval_func(ScalarFuncSig::FindInSet, &[s, sl]).unwrap();
assert_eq!(got, Datum::I64(expect))
}
let null_cases = vec![
(Datum::Bytes(b"foo".to_vec()), Datum::Null, Datum::Null),
(Datum::Null, Datum::Bytes(b"bar".to_vec()), Datum::Null),
(Datum::Null, Datum::Null, Datum::Null),
];
for (s, sl, exp) in null_cases {
let got = eval_func(ScalarFuncSig::FindInSet, &[s, sl]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/44154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 556
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
1243,
2602,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
7975,
497,
330,
7975,
11,
2257,
497,
220,
16,
1326,
310,
3489,
7975,
497,
330,
50267,
11,
2257,
497,
220,
15,
1326,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_last_msg() {
let tmpdir = setup("git_repo_last_msg");
let tarball = tmpdir.mash("../../alpine-base.tgz");
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(tar::extract_all(&tarball, &tmpdir).is_ok());
assert_eq!(git::Repo::new(&tmpdir).unwrap().last_msg().unwrap(), "Use the workflow name for the badge".to_string());
assert!(sys::remove_all(&tmpdir).is_ok());
} | rust_cleaned_test_functions.jsonl/114252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
6483,
368,
341,
286,
1077,
4174,
3741,
284,
6505,
445,
12882,
37784,
12195,
6483,
797,
286,
1077,
12183,
3959,
284,
4174,
3741,
744,
988,
36800,
278,
38038,
30013,
734,
46589,
797,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_predicate() {
// create execution context
let mut ctx = ExecutionContext::local();
ctx.register_scalar_function(Rc::new(STPointFunc {}));
ctx.register_scalar_function(Rc::new(STAsText {}));
// ctx.sql(
// "CREATE EXTERNAL TABLE uk_cities (\
let schema = Schema::new(vec![
Field::new("city", DataType::Utf8, false),
Field::new("lat", DataType::Float64, false),
Field::new("lng", DataType::Float64, false),
]);
let df = ctx
.load_csv("./test/data/uk_cities.csv", &schema, false, None)
.unwrap();
ctx.register("uk_cities", df);
// define the SQL statement
let sql = "SELECT ST_AsText(ST_Point(lat, lng)) FROM uk_cities WHERE lat < 53.0";
// create a data frame
let df1 = ctx.sql(&sql).unwrap();
// write the results to a file
ctx.write_csv(df1, "./target/test_simple_predicate.csv")
.unwrap();
let expected_result = read_file("test/data/expected/test_simple_predicate.csv");
assert_eq!(
expected_result,
read_file("./target/test_simple_predicate.csv")
);
} | rust_cleaned_test_functions.jsonl/2512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
97474,
368,
341,
286,
442,
1855,
11320,
2266,
198,
286,
1077,
5206,
5635,
284,
85451,
486,
2438,
543,
286,
5635,
9929,
41652,
9174,
2785,
66,
486,
931,
40650,
2609,
9626,
99007,
286,
5635,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_archive_unpack_genesis_ok() {
let mut header = Header::new_gnu();
header.set_path("genesis.bin").unwrap();
header.set_size(4);
header.set_cksum();
let data: &[u8] = &[1, 2, 3, 4];
let mut archive = Builder::new(Vec::new());
archive.append(&header, data).unwrap();
let result = finalize_and_unpack_genesis(archive);
assert_matches!(result, Ok(()));
} | rust_cleaned_test_functions.jsonl/18327 | {
"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,
42873,
54889,
16322,
13774,
19817,
368,
341,
286,
1077,
5206,
4247,
284,
12104,
486,
931,
1889,
8933,
543,
286,
4247,
980,
2638,
445,
77894,
29394,
1827,
15454,
543,
286,
4247,
980,
2368,
7,
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_validator_extend() {
let extend = ValidatorExtend {
bls_pub_key: Hex::from_string("0x04102947214862a503c73904deb5818298a186d68c7907bb609583192a7de6331493835e5b8281f4d9ee705537c0e765580e06f86ddce5867812fceb42eecefd209f0eddd0389d6b7b0100f00fb119ef9ab23826c6ea09aadcc76fa6cea6a32724".to_owned()).unwrap(),
pub_key: Hex::from_string("0x02ef0cb0d7bc6c18b4bea1f5908d9106522b35ab3c399369605d4242525bda7e60".to_owned()).unwrap(),
address: "muta14e0lmgck835vm2dfm0w3ckv6svmez8fdgdl705".parse().unwrap(),
propose_weight: 1,
vote_weight: 1,
};
let decoded = ValidatorExtend::decode_fixed(extend.encode_fixed().unwrap()).unwrap();
assert_eq!(decoded, extend);
} | rust_cleaned_test_functions.jsonl/58378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64959,
70265,
368,
341,
286,
1077,
13036,
284,
32566,
72136,
341,
1843,
1501,
82,
34014,
3097,
25,
27228,
486,
1499,
3904,
445,
15,
87,
15,
19,
16,
15,
17,
24,
19,
22,
17,
16,
19,
23,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_closure_while_false() {
assert_eq!(
eval_ok(
"let x = 1.
{
x = x * 2.
x > 10
}
whileFalse.
x"
)
.integer(),
16
);
} | rust_cleaned_test_functions.jsonl/15568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72823,
86069,
36015,
368,
341,
262,
2060,
10714,
33673,
286,
5603,
19817,
1006,
310,
330,
1149,
856,
284,
220,
16,
624,
1797,
341,
394,
856,
284,
856,
353,
220,
17,
624,
394,
856,
861,
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_truncate_binary() {
let s = b"123456789".to_vec();
let mut s1 = s.clone();
truncate_binary(&mut s1, cop_datatype::UNSPECIFIED_LENGTH);
assert_eq!(s1, s);
let mut s2 = s.clone();
truncate_binary(&mut s2, isize::MAX);
assert_eq!(s2, s);
let mut s3 = s;
truncate_binary(&mut s3, 0);
assert!(s3.is_empty());
} | rust_cleaned_test_functions.jsonl/75527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26900,
31761,
368,
341,
286,
1077,
274,
284,
293,
1,
16,
17,
18,
19,
20,
21,
22,
23,
24,
3263,
983,
13251,
543,
286,
1077,
5206,
274,
16,
284,
274,
15997,
543,
286,
56772,
31761,
2099,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_c0000000_rle() {
let data = include_bytes!("../../../data/RLEs/Chr/C00/c0000000.rle");
let rle = parse_rle(0, data).unwrap();
} | rust_cleaned_test_functions.jsonl/72391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
15,
15,
15,
15,
15,
15,
15,
1710,
273,
368,
972,
286,
1077,
821,
284,
2924,
12524,
17223,
26744,
691,
19382,
867,
82,
14,
87225,
11295,
15,
15,
2899,
15,
15,
15,
15,
15,
15,
15,
1746,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_blog_adding() {
let mut clusters = BlogClusters::new();
clusters.add_tags(
"life
things about current life
work
about my works
fun
maybe some gameplay",
);
clusters.add_blogs(&vec![(
"test-blog".to_string(),
"Test Blog
2000/9/27
life | work | fun
---
lolololololol
---
ololololololo
"
.to_string(),
)]);
let blogs = clusters.get_blogs();
assert_eq!(blogs.len(), 1);
let blog = &blogs[0];
assert_eq!(blog.year, 2000);
assert_eq!(blog.month, 9);
assert_eq!(blog.day, 27);
assert_eq!(blog.tags.len(), 3);
assert_eq!(blog.title, "Test Blog");
assert_eq!(blog.preview, "lolololololol");
assert_eq!(blog.content, "ololololololo");
} | rust_cleaned_test_functions.jsonl/39033 | {
"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,
35815,
2891,
287,
368,
341,
286,
1077,
5206,
26968,
284,
14163,
94992,
486,
931,
543,
286,
26968,
1364,
16333,
1006,
310,
330,
14450,
198,
310,
2513,
911,
1482,
2272,
271,
310,
975,
198,
310,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dat_exact_match_search() {
let mut f = File::open("./priv/dict.big.bincode").unwrap();
let da = DoubleArrayTrie::load(&mut f).unwrap();
let input1 = "中华人民共和国";
let result1: Vec<&str> = da
.common_prefix_search(input1)
.unwrap()
.iter()
.map(|&(end_idx, _)| &input1[..end_idx])
.collect();
assert_eq!(result1, vec!["中", "中华", "中华人民", "中华人民共和国"]);
let input2 = "网球拍卖会";
let result2: Vec<&str> = da
.common_prefix_search(input2)
.unwrap()
.iter()
.map(|&(end_idx, _)| &input2[..end_idx])
.collect();
assert_eq!(result2, vec!["网", "网球", "网球拍"]);
} | rust_cleaned_test_functions.jsonl/6375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15353,
71084,
10708,
10716,
368,
341,
286,
1077,
5206,
282,
284,
2887,
486,
2508,
13988,
11887,
3446,
849,
57678,
29394,
1851,
1827,
15454,
543,
286,
1077,
2994,
284,
7093,
1857,
51,
7231,
486,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_str() {
assert_eq!(from_str("\""), Err(SyntaxError(EOFWhileParsingString, 1, 2)));
assert_eq!(from_str("\"lol"), Err(SyntaxError(EOFWhileParsingString, 1, 5)));
assert_eq!(from_str("\"\""), Ok(String("".into_string())));
assert_eq!(from_str("\"foo\""), Ok(String("foo".into_string())));
assert_eq!(from_str("\"\\\"\""), Ok(String("\"".into_string())));
assert_eq!(from_str("\"\\b\""), Ok(String("\x08".into_string())));
assert_eq!(from_str("\"\\n\""), Ok(String("\n".into_string())));
assert_eq!(from_str("\"\\r\""), Ok(String("\r".into_string())));
assert_eq!(from_str("\"\\t\""), Ok(String("\t".into_string())));
assert_eq!(from_str(" \"foo\" "), Ok(String("foo".into_string())));
assert_eq!(from_str("\"\\u12ab\""), Ok(String("\u{12ab}".into_string())));
assert_eq!(from_str("\"\\uAB12\""), Ok(String("\u{AB12}".into_string())));
} | rust_cleaned_test_functions.jsonl/6545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2895,
368,
341,
286,
2060,
10714,
10297,
1499,
2895,
38915,
3975,
262,
15495,
93549,
1454,
7,
23483,
7983,
68839,
703,
11,
220,
16,
11,
220,
17,
4945,
286,
2060,
10714,
10297,
1499,
2895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iso0() {
let KEY: &Vec<u8> = &hex::decode(&KEY_STR).unwrap();
match generate_pin_block(&ISO0, "1234", "4111111111111111", &KEY) {
Ok(p) => {
match verify_pin(&ISO0, "1234", &p, "4111111111111111", &KEY) {
Ok(res) => {
assert_eq!(res, true)
}
Err(e) => {
assert!(false, e.msg.to_string());
}
}
}
Err(e) => {
assert!(false, e.msg.to_string());
}
}
match generate_pin_block(&ISO0, "12341123456", "4111111111111111", &KEY) {
Ok(p) => {
match verify_pin(&ISO0, "12341123456", &p, "4111111111111111", &KEY) {
Ok(res) => {
assert_eq!(res, true)
}
Err(e) => {
assert!(false, e.msg.to_string());
}
}
}
Err(e) => {
assert!(false, e.msg.to_string());
}
}
} | rust_cleaned_test_functions.jsonl/4811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49660,
15,
368,
341,
286,
1077,
12013,
25,
609,
10050,
34837,
23,
29,
284,
609,
17308,
486,
18196,
2099,
4784,
7159,
568,
15454,
1428,
286,
2432,
6923,
26296,
7113,
2099,
24167,
15,
11,
330,
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... | 5 |
#[test]
fn test_array_no_size() {
let mut l = Lexer::<DefaultContext>::new(b"unsigned short foo[]");
let p = TypeDeclaratorParser::new(&mut l);
let mut context = Context::default();
let (_, decl) = p.parse(None, None, true, &mut context).unwrap();
let decl = decl.unwrap();
assert_eq!(
decl,
Rc::new(TypeDeclarator {
typ: Type {
base: BaseType::Array(Box::new(Array {
base: Some(Type {
base: BaseType::Primitive(Primitive::UnsignedShort),
cv: CVQualifier::empty(),
pointers: None,
}),
dimensions: vec![Dimension {
size: None,
attributes: None,
}],
})),
cv: CVQualifier::empty(),
pointers: None,
},
specifier: Specifier::empty(),
identifier: Identifier {
identifier: Some(mk_id!("foo")),
attributes: None
},
init: None,
bitfield_size: None,
})
);
} | rust_cleaned_test_functions.jsonl/117537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 804
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
6536,
2368,
368,
341,
286,
1077,
5206,
326,
284,
85082,
27638,
3675,
1972,
6831,
931,
1883,
1,
3626,
2805,
15229,
1294,
797,
286,
1077,
281,
284,
3990,
1912,
12821,
850,
6570,
486,
931,
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_to_port_range() {
let port_ranges = to_port_range(netfilter::PortRange { start: 1000, end: 2000 });
assert_eq!(port_ranges.is_some(), true);
let p = port_ranges.unwrap();
assert_eq!(p[0].from, 1000);
assert_eq!(p[0].to, 2000);
} | rust_cleaned_test_functions.jsonl/52753 | {
"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,
2346,
8716,
9698,
368,
341,
286,
1077,
2635,
58748,
284,
311,
8716,
9698,
30723,
5315,
486,
7084,
6046,
314,
1191,
25,
220,
16,
15,
15,
15,
11,
835,
25,
220,
17,
15,
15,
15,
1625,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_8601_5() {
let interval = Interval::from_iso("P1Y1M1DT1H10M").unwrap();
let interval_exp = Interval::new(13, 1, 4200000000);
assert_eq!(interval, interval_exp);
} | rust_cleaned_test_functions.jsonl/90524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
62,
23,
21,
15,
16,
62,
20,
368,
341,
286,
1077,
9873,
284,
40584,
486,
1499,
49660,
445,
47,
16,
56,
16,
44,
16,
10599,
16,
39,
16,
15,
44,
1827,
15454,
543,
286,
1077,
9873,
14214,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_config() {
let mut deps = mock_dependencies(&[]);
let owner = String::from("creator");
let msg = default_init();
let info = mock_info(&owner, &coins(1000, "earth"));
let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap();
assert_eq!(0, res.messages.len());
//check call from invalid owner
let invalid_owner = String::from("invalid_owner");
let update_config_msg = ExecuteMsg::UpdateConfig {
owner: Some(String::from("some_addr")),
hub_contract: None,
bluna_reward_contract: None,
stluna_reward_denom: None,
bluna_reward_denom: None,
lido_fee_address: None,
lido_fee_rate: None,
};
let info = mock_info(&invalid_owner, &[]);
let res = execute(deps.as_mut(), mock_env(), info, update_config_msg);
assert_eq!(res.unwrap_err(), StdError::generic_err("unauthorized"));
// change owner
let new_owner = String::from("new_owner");
let update_config_msg = ExecuteMsg::UpdateConfig {
owner: Some(new_owner.clone()),
hub_contract: None,
bluna_reward_contract: None,
stluna_reward_denom: None,
bluna_reward_denom: None,
lido_fee_address: None,
lido_fee_rate: None,
};
let info = mock_info(&owner, &[]);
let res = execute(deps.as_mut(), mock_env(), info, update_config_msg);
assert!(res.is_ok());
let config = CONFIG.load(&deps.storage).unwrap();
let new_owner_raw = deps.api.addr_canonicalize(&new_owner).unwrap();
assert_eq!(new_owner_raw, config.owner);
// change hub_contract
let update_config_msg = ExecuteMsg::UpdateConfig {
owner: None,
hub_contract: Some(String::from("some_address")),
bluna_reward_contract: None,
stluna_reward_denom: None,
bluna_reward_denom: None,
lido_fee_address: None,
lido_fee_rate: None,
};
let info = mock_info(&new_owner, &[]);
let res = execute(deps.as_mut(), mock_env(), info, update_config_msg);
assert!(res.is_ok());
let config = CONFIG.load(&deps.storage).unwrap();
assert_eq!(
deps.api
.addr_canonicalize(&String::from("some_address"))
.unwrap(),
config.hub_contract
);
// change bluna_reward_contract
let update_config_msg = ExecuteMsg::UpdateConfig {
owner: None,
hub_contract: None,
bluna_reward_contract: Some(String::from("some_address")),
stluna_reward_denom: None,
bluna_reward_denom: None,
lido_fee_address: None,
lido_fee_rate: None,
};
let info = mock_info(&new_owner, &[]);
let res = execute(deps.as_mut(), mock_env(), info, update_config_msg);
assert!(res.is_ok());
let config = CONFIG.load(&deps.storage).unwrap();
assert_eq!(
deps.api
.addr_canonicalize(&String::from("some_address"))
.unwrap(),
config.bluna_reward_contract
);
// change stluna_reward_denom
let update_config_msg = ExecuteMsg::UpdateConfig {
owner: None,
hub_contract: None,
bluna_reward_contract: None,
stluna_reward_denom: Some(String::from("new_denom")),
bluna_reward_denom: None,
lido_fee_address: None,
lido_fee_rate: None,
};
let info = mock_info(&new_owner, &[]);
let res = execute(deps.as_mut(), mock_env(), info, update_config_msg);
assert!(res.is_err());
assert_eq!(
Some(StdError::generic_err(
"updating stluna reward denom is forbidden"
)),
res.err()
);
let config = CONFIG.load(&deps.storage).unwrap();
assert_eq!(String::from("uluna"), config.stluna_reward_denom);
// change bluna_reward_denom
let update_config_msg = ExecuteMsg::UpdateConfig {
owner: None,
hub_contract: None,
bluna_reward_contract: None,
stluna_reward_denom: None,
bluna_reward_denom: Some(String::from("new_denom")),
lido_fee_address: None,
lido_fee_rate: None,
};
let info = mock_info(&new_owner, &[]);
let res = execute(deps.as_mut(), mock_env(), info, update_config_msg);
assert!(res.is_err());
assert_eq!(
Some(StdError::generic_err(
"updating bluna reward denom is forbidden"
)),
res.err()
);
let config = CONFIG.load(&deps.storage).unwrap();
assert_eq!(String::from("uusd"), config.bluna_reward_denom);
// change lido_fee_address
let update_config_msg = ExecuteMsg::UpdateConfig {
owner: None,
hub_contract: None,
bluna_reward_contract: None,
stluna_reward_denom: None,
bluna_reward_denom: None,
lido_fee_address: Some(String::from("some_address")),
lido_fee_rate: None,
};
let info = mock_info(&new_owner, &[]);
let res = execute(deps.as_mut(), mock_env(), info, update_config_msg);
assert!(res.is_ok());
let config = CONFIG.load(&deps.storage).unwrap();
assert_eq!(
deps.api
.addr_canonicalize(&String::from("some_address"))
.unwrap(),
config.lido_fee_address
);
// change lido_fee_rate
let update_config_msg = ExecuteMsg::UpdateConfig {
owner: None,
hub_contract: None,
bluna_reward_contract: None,
stluna_reward_denom: None,
bluna_reward_denom: None,
lido_fee_address: None,
lido_fee_rate: Some(Decimal::one()),
};
let info = mock_info(&new_owner, &[]);
let res = execute(deps.as_mut(), mock_env(), info, update_config_msg);
assert!(res.is_ok());
let config = CONFIG.load(&deps.storage).unwrap();
assert_eq!(Decimal::one(), config.lido_fee_rate);
} | rust_cleaned_test_functions.jsonl/50310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2605
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5332,
368,
341,
262,
1077,
5206,
48178,
284,
7860,
71841,
2099,
1294,
626,
262,
1077,
6372,
284,
923,
486,
1499,
445,
32398,
797,
262,
1077,
3750,
284,
1638,
6137,
543,
262,
1077,
3546,
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_manage_nervous_system_parameters_proposal_execution() {
local_test_on_sns_subnet(|runtime| {
async move {
// Initialize the ledger with an account for a user.
let user = Sender::from_keypair(&TEST_USER1_KEYPAIR);
let alloc = Tokens::from_tokens(1000).unwrap();
let sys_params = NervousSystemParameters {
neuron_claimer_permissions: Some(NeuronPermissionList {
permissions: NeuronPermissionType::all(),
}),
..NervousSystemParameters::with_default_values()
};
let sns_init_payload = SnsInitPayloadsBuilder::new()
.with_ledger_account(user.get_principal_id().into(), alloc)
.with_nervous_system_parameters(sys_params)
.build();
let sns_canisters = SnsCanisters::set_up(&runtime, sns_init_payload).await;
let neuron_id = sns_canisters
.stake_and_claim_neuron(&user, Some(ONE_YEAR_SECONDS as u32))
.await;
let subaccount = neuron_id
.subaccount()
.expect("Error creating the subaccount");
// Assert that invalid params are rejected on proposal submission
let proposal_payload = Proposal {
title: "Test invalid ManageNervousSystemParameters proposal".into(),
action: Some(Action::ManageNervousSystemParameters(
NervousSystemParameters {
max_number_of_neurons: Some(
NervousSystemParameters::MAX_NUMBER_OF_NEURONS_CEILING + 1,
),
..Default::default()
},
)),
..Default::default()
};
let error = sns_canisters
.make_proposal(&user, &subaccount, proposal_payload)
.await
.unwrap_err();
assert_eq!(error.error_type, ErrorType::InvalidProposal as i32);
// Assert that valid params cause Governance system parameters to be updated
let proposal_payload = Proposal {
title: "Test valid ManageNervousSystemParameters proposal".into(),
action: Some(Action::ManageNervousSystemParameters(
NervousSystemParameters {
transaction_fee_e8s: Some(120_001),
neuron_minimum_stake_e8s: Some(398_002_900),
..Default::default()
},
)),
..Default::default()
};
// Submit a proposal. It should then be executed because the submitter
// has a majority stake and submitting also votes automatically.
let proposal_id = sns_canisters
.make_proposal(&user, &subaccount, proposal_payload)
.await
.unwrap();
let proposal = sns_canisters.get_proposal(proposal_id).await;
assert_eq!(proposal.action, 2);
assert_ne!(proposal.decided_timestamp_seconds, 0);
assert_ne!(proposal.executed_timestamp_seconds, 0);
let live_sys_params: NervousSystemParameters = sns_canisters
.governance
.query_("get_nervous_system_parameters", candid_one, ())
.await?;
assert_eq!(live_sys_params.transaction_fee_e8s, Some(120_001));
assert_eq!(live_sys_params.neuron_minimum_stake_e8s, Some(398_002_900));
Ok(())
}
})
} | rust_cleaned_test_functions.jsonl/93504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1873
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56473,
1089,
648,
782,
17687,
18263,
21663,
32556,
60948,
368,
341,
262,
2205,
4452,
4470,
643,
4412,
95681,
22428,
22255,
91,
341,
286,
3312,
3271,
341,
310,
442,
9008,
279,
46933,
448,
458,
2692... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_cie_bad_id_32() {
let kind = debug_frame_be();
let section = Section::with_endian(kind.endian())
// Initial length
.B32(4)
// Not the CIE Id.
.B32(0xbad1_bad2);
assert_parse_cie(kind, section, 8, Err(Error::NotCieId));
} | rust_cleaned_test_functions.jsonl/9297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
666,
645,
34199,
842,
62,
18,
17,
368,
341,
286,
1077,
3093,
284,
7390,
8929,
21263,
543,
286,
1077,
3772,
284,
11113,
486,
4197,
87193,
62697,
5073,
1103,
2398,
310,
442,
4127,
3084,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_rpn_long_command() {
let port_values_buf: [u8; REMOTE_PORT_NEGOTIATION_VALUES_LENGTH] = [
0b00010000, // Octet 1: Baud Rate = 16.
0b00111100,
0b00000010, // Octet 3: Flow Control = 2.
0b00000001, // Octet 4: XOn = 1.
0b00000011, // Octet 5: XOff = 3.
0b00000000,
0b00000000,
];
let command = RemotePortNegotiationParams {
dlci: DLCI::try_from(9).unwrap(),
port_values: Some(PortValues(port_values_buf)),
};
let mut buf = vec![0; command.encoded_len()];
assert!(command.encode(&mut buf).is_ok());
let expected = vec![0b00100111]; // DLCI = 9.
let expected = [expected, port_values_buf.to_vec()].concat();
assert_eq!(buf, expected);
} | rust_cleaned_test_functions.jsonl/29048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
1710,
19958,
17799,
10811,
368,
341,
286,
1077,
2635,
9146,
10363,
25,
508,
84,
23,
26,
25587,
19158,
12377,
62368,
1793,
40,
3495,
58662,
15023,
60,
284,
2278,
310,
220,
15,
65,
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_iter_as_ref() {
let xs = [1, 2, 5, 10, 11];
let mut iter = xs.iter();
assert_eq!(iter.as_ref(), &[1, 2, 5, 10, 11]);
iter.next();
assert_eq!(iter.as_ref(), &[2, 5, 10, 11]);
} | rust_cleaned_test_functions.jsonl/12886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
11898,
7793,
368,
341,
262,
1077,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
20,
11,
220,
16,
15,
11,
220,
16,
16,
935,
262,
1077,
5206,
5367,
284,
11943,
19471,
543,
262,
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_string_function_parameter() {
let mut arguments = match statement_expression("len(\"a\")") {
Expression::Call { arguments, .. } => arguments,
_ => panic!("not a call"),
};
assert_eq!(1, arguments.len());
verify_string_literal("a", &arguments.remove(0));
} | rust_cleaned_test_functions.jsonl/64088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
9174,
24899,
368,
341,
286,
1077,
5206,
5977,
284,
2432,
5114,
28068,
445,
2892,
36014,
64,
62705,
899,
341,
310,
16378,
486,
7220,
314,
5977,
11,
5241,
335,
589,
5977,
345,
310,
716,
589,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cached_executors_eviction() {
let key1 = solana_sdk::pubkey::new_rand();
let key2 = solana_sdk::pubkey::new_rand();
let key3 = solana_sdk::pubkey::new_rand();
let key4 = solana_sdk::pubkey::new_rand();
let executor: Arc<dyn Executor> = Arc::new(TestExecutor {});
let mut cache = CachedExecutors::new(3, 0);
assert!(cache.current_epoch == 0);
cache.put(&key1, executor.clone());
cache.put(&key2, executor.clone());
cache.put(&key3, executor.clone());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key1).is_some());
cache = cache.clone_with_epoch(1);
assert!(cache.current_epoch == 1);
assert!(cache.get(&key2).is_some());
assert!(cache.get(&key2).is_some());
assert!(cache.get(&key3).is_some());
cache.put(&key4, executor.clone());
assert!(cache.get(&key4).is_some());
assert!(cache.get(&key3).is_none());
cache = cache.clone_with_epoch(2);
assert!(cache.current_epoch == 2);
cache.put(&key3, executor.clone());
assert!(cache.get(&key3).is_some());
} | rust_cleaned_test_functions.jsonl/2651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
18430,
9475,
43713,
2479,
368,
341,
286,
1077,
1376,
16,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
1376,
17,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mat_transpose_transpose_equals_mat() {
test_cases().iter().for_each(|test| {
let a_mat_tr_tr = test.a_mat.transpose().transpose();
let b_mat_tr_tr = test.b_mat.transpose().transpose();
assert_eq!(a_mat_tr_tr, test.a_mat);
assert_eq!(b_mat_tr_tr, test.b_mat);
})
} | rust_cleaned_test_functions.jsonl/128960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16610,
7965,
2900,
7965,
2900,
61664,
16610,
368,
341,
286,
1273,
41427,
1005,
2015,
1005,
1958,
32046,
22428,
1944,
91,
341,
310,
1077,
264,
16610,
3547,
3547,
284,
1273,
5849,
16610,
35305,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_modification_config_from_file_yaml_parse_error() {
let mut file = NamedTempFile::new().unwrap();
writeln!(file, "garble").unwrap();
assert_eq!(
get_modification_config_from_file(file.path().to_str().unwrap()).unwrap_err(),
CliError {
error: "invalid type: string \"garble\", expected struct Modification at line 1 column 1".to_string(),
message: None,
details: None
}
)
} | rust_cleaned_test_functions.jsonl/76502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7480,
2404,
5332,
5673,
2458,
64380,
21039,
4096,
368,
341,
286,
1077,
5206,
1034,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
543,
286,
80947,
10297,
1192,
11,
330,
12164,
891,
1827,
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_num_tracked_samples_not_tracking_samples() {
let treeseq = treeseq_from_small_table_collection();
assert_eq!(treeseq.inner.num_samples, 2);
let mut tree_iter = treeseq.tree_iterator(TreeFlags::NO_SAMPLE_COUNTS).unwrap();
if let Some(tree) = tree_iter.next() {
assert_eq!(tree.num_tracked_samples(2.into()).unwrap(), 0);
assert_eq!(tree.num_tracked_samples(1.into()).unwrap(), 0);
assert_eq!(tree.num_tracked_samples(0.into()).unwrap(), 0);
}
} | rust_cleaned_test_functions.jsonl/23028 | {
"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,
4273,
3547,
11191,
18297,
7913,
66105,
18297,
368,
341,
286,
1077,
4258,
2367,
80,
284,
4258,
2367,
80,
5673,
31966,
5237,
25019,
543,
286,
2060,
10714,
10297,
10157,
2367,
80,
9398,
10522,
18297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_events() {
let runc_id = format!("{}", Uuid::new_v4());
let runc_path = env::temp_dir().join(&runc_id).join("runc.amd64");
let runc_root =
PathBuf::from(env::var_os("XDG_RUNTIME_DIR").expect("expected temporary path"))
.join("rust-runc")
.join(&runc_id);
fs::create_dir_all(&runc_root).expect("unable to create runc root");
extract_tarball(
&PathBuf::from("test_fixture/runc_v1.0.0-rc10.tar.gz"),
&env::temp_dir().join(&runc_id),
)
.expect("unable to extract runc");
let mut config: RuncConfiguration = Default::default();
config.command = Some(runc_path.clone());
config.root = Some(runc_root.clone());
let runc = Runc::new(config).expect("Unable to create runc instance");
let task = async move {
let container = ManagedContainer::new(
&runc_path,
&runc_root,
&PathBuf::from("test_fixture/busybox.tar.gz"),
)
.await?;
let events = runc.events(&container.id, &Duration::from_secs(1)).await?;
Ok::<_, Error>(
events
.take(3)
.map(|event| event.unwrap())
.collect::<Vec<Event>>()
.await,
)
};
let mut runtime = Runtime::new().expect("unable to create runtime");
let events = runtime.block_on(task).expect("test failed");
assert_eq!(events.len(), 3);
// Validate all the events contain valid payloads
for event in events.iter() {
if let Some(stats) = event.stats.clone() {
if let Some(memory) = stats.memory.clone() {
if let Some(usage) = memory.usage {
if let Some(usage) = usage.usage {
if usage > 0 {
continue;
}
}
}
}
}
panic!("event is missing memory usage statistics");
}
} | rust_cleaned_test_functions.jsonl/24465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19691,
368,
341,
286,
1077,
435,
1347,
842,
284,
3561,
79878,
547,
2423,
486,
931,
2273,
19,
1423,
286,
1077,
435,
1347,
2638,
284,
6105,
486,
3888,
4334,
1005,
5987,
2099,
81,
1347,
842,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_parses_json_scalar() {
assert_eq!(Variable::Null, Variable::from_json("null").unwrap());
assert_eq!(Variable::Bool(true), Variable::from_json("true").unwrap());
assert_eq!(Variable::Bool(false), Variable::from_json("false").unwrap());
assert_eq!(
Variable::Number(Number::from(1)),
Variable::from_json("1").unwrap()
);
assert_eq!(
Variable::Number(Number::from_f64(-1.0).unwrap()),
Variable::from_json("-1").unwrap()
);
assert_eq!(
Variable::Number(Number::from_f64(1.5).unwrap()),
Variable::from_json("1.5").unwrap()
);
assert_eq!(
Variable::String("abc".to_string()),
Variable::from_json("\"abc\"").unwrap()
);
} | rust_cleaned_test_functions.jsonl/108390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77113,
288,
9455,
41652,
368,
341,
286,
2060,
10714,
10297,
7827,
486,
3280,
11,
12407,
486,
1499,
9455,
445,
2921,
1827,
15454,
1423,
286,
2060,
10714,
10297,
7827,
486,
11233,
3715,
701,
12407,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_compare() {
let a = "9";
let b = "9";
let c = get_rand_string();
assert_eq!(Ordering::Equal, random_shuffle(a, b, &c));
} | rust_cleaned_test_functions.jsonl/31604 | {
"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,
22644,
32235,
368,
341,
286,
1077,
264,
284,
330,
24,
876,
286,
1077,
293,
284,
330,
24,
876,
286,
1077,
272,
284,
633,
33864,
3904,
1428,
286,
2060,
10714,
10297,
4431,
287,
486,
2993,
11,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_find_roots_linear() {
let line = BoundedQuadratic::new(0., 2., 0., 1., -1.);
let (x1, x2) = line.find_roots();
assert!(!x2.is_finite());
assert_eq!(x1, 1.);
} | rust_cleaned_test_functions.jsonl/19864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
26608,
2412,
40674,
368,
341,
286,
1077,
1555,
284,
425,
13082,
2183,
88678,
486,
931,
7,
15,
2572,
220,
17,
2572,
220,
15,
2572,
220,
16,
2572,
481,
16,
58957,
286,
1077,
320,
87,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_keep_alives() {
// Take the lock so changing the environment doesn't cause races.
let _env_lock = ENV_LOCK.lock().unwrap();
env::remove_var(CONFIG_ENV);
assert!(FullConfig::parse(r#"
[dev]
keep_alive = true
"#.to_string(), TEST_CONFIG_FILENAME).is_err());
assert!(FullConfig::parse(r#"
[dev]
keep_alive = -10
"#.to_string(), TEST_CONFIG_FILENAME).is_err());
assert!(FullConfig::parse(r#"
[dev]
keep_alive = "Some(10)"
"#.to_string(), TEST_CONFIG_FILENAME).is_err());
assert!(FullConfig::parse(r#"
[dev]
keep_alive = 4294967296
"#.to_string(), TEST_CONFIG_FILENAME).is_err());
} | rust_cleaned_test_functions.jsonl/54711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
50293,
8418,
1886,
368,
341,
286,
442,
11778,
279,
5296,
773,
10018,
279,
4573,
3171,
944,
5240,
20588,
624,
286,
1077,
716,
3160,
9818,
284,
32791,
27661,
21003,
1005,
15454,
543,
286,
610... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiply() {
let mut vm = ShrekVM::new(Vec::new());
vm.push(8);
vm.push(3);
multiply(&mut vm).unwrap();
assert_eq!(24, vm.peek().unwrap());
// Two values added above should be popped.
assert_eq!(1, vm.count());
} | rust_cleaned_test_functions.jsonl/71698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93054,
368,
341,
286,
1077,
5206,
10995,
284,
1417,
41861,
11187,
486,
931,
49923,
486,
931,
5231,
286,
10995,
2552,
7,
23,
317,
286,
10995,
2552,
7,
18,
626,
286,
30270,
2099,
6984,
10995,
568,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_labels_count() {
mock_mgp_once!(mgp_vertex_labels_count_context, |_, labels_count| unsafe {
(*labels_count) = 2;
mgp_error::MGP_ERROR_NO_ERROR
});
with_dummy!(Vertex, |vertex: &Vertex| {
assert_eq!(vertex.labels_count().unwrap(), 2);
});
} | rust_cleaned_test_functions.jsonl/28517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14547,
3180,
368,
341,
262,
7860,
717,
21888,
7630,
10297,
12311,
79,
26611,
14547,
3180,
8467,
11,
760,
6878,
9201,
3180,
91,
19860,
341,
286,
4609,
16873,
3180,
8,
284,
220,
17,
280,
286,
1374... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_to_try_valid_range() {
let modulus = Fq::modulus();
let mut last_multiple = arith::U256([5, 0]);
let mut overflow_multiple = arith::U256([6, 0]);
let max_value = arith::U256([
0xffffffffffffffffffffffffffffffff,
0xffffffffffffffffffffffffffffffff,
]);
last_multiple.mul(&modulus, &max_value, 1);
assert_eq!(last_multiple, LAST_MULTIPLE_OF_FQ_MODULUS_LOWER_THAN_2_256);
overflow_multiple.mul(&modulus, &max_value, 1);
assert!(overflow_multiple < modulus)
} | rust_cleaned_test_functions.jsonl/65093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
2346,
53283,
8337,
9698,
368,
341,
286,
1077,
74024,
284,
434,
80,
486,
2593,
19425,
543,
286,
1077,
5206,
1537,
45233,
284,
796,
410,
486,
52,
17,
20,
21,
2561,
20,
11,
220,
15,
2558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_program_bpf_test_use_latest_executor2() {
use solana_sdk::{loader_instruction, system_instruction};
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, id, entrypoint);
let bank_client = BankClient::new(bank);
let invoke_and_error = load_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
"solana_bpf_rust_invoke_and_error",
);
let invoke_and_ok = load_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
"solana_bpf_rust_invoke_and_ok",
);
let program_keypair = Keypair::new();
// Write the panic program into the program account
let elf = read_bpf_program("solana_bpf_rust_panic");
let message = Message::new(
&[system_instruction::create_account(
&mint_keypair.pubkey(),
&program_keypair.pubkey(),
1,
elf.len() as u64 * 2,
&bpf_loader::id(),
)],
Some(&mint_keypair.pubkey()),
);
assert!(bank_client
.send_and_confirm_message(&[&mint_keypair, &program_keypair], message)
.is_ok());
write_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
&program_keypair,
&elf,
);
let mut instruction =
loader_instruction::finalize(&program_keypair.pubkey(), &bpf_loader::id());
instruction.accounts.insert(
0,
AccountMeta {
is_signer: false,
is_writable: false,
pubkey: instruction.program_id,
},
);
instruction.program_id = invoke_and_ok;
instruction.accounts.insert(
0,
AccountMeta {
is_signer: false,
is_writable: false,
pubkey: invoke_and_error,
},
);
let message = Message::new(&[instruction], Some(&mint_keypair.pubkey()));
assert!(bank_client
.send_and_confirm_message(&[&mint_keypair, &program_keypair], message)
.is_ok());
let message = Message::new(
&[Instruction::new_with_bytes(
program_keypair.pubkey(),
&[0],
vec![],
)],
Some(&mint_keypair.pubkey()),
);
assert_eq!(
bank_client
.send_and_confirm_message(&[&mint_keypair], message)
.unwrap_err()
.unwrap(),
TransactionError::InvalidProgramForExecution
);
// Write the noop program into the same program account
let elf = read_bpf_program("solana_bpf_rust_noop");
write_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
&program_keypair,
&elf,
);
// Finalize the noop program
let message = Message::new(
&[loader_instruction::finalize(
&program_keypair.pubkey(),
&bpf_loader::id(),
)],
Some(&mint_keypair.pubkey()),
);
assert!(bank_client
.send_and_confirm_message(&[&mint_keypair, &program_keypair], message)
.is_ok());
let message = Message::new(
&[Instruction::new_with_bytes(
program_keypair.pubkey(),
&[0],
vec![],
)],
Some(&mint_keypair.pubkey()),
);
assert!(bank_client
.send_and_confirm_message(&[&mint_keypair], message)
.is_ok());
} | rust_cleaned_test_functions.jsonl/11455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1778
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
880,
15897,
4452,
15951,
64880,
81207,
17,
368,
341,
262,
990,
2048,
3362,
61783,
22964,
8355,
54923,
11,
1849,
54923,
2315,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
40788,
2648,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nested_witness() {
let mut rb: RbTree<Vec<u8>, RbTree<Vec<u8>, Vec<u8>>> = RbTree::new();
let mut nested = RbTree::new();
nested.insert(b"bottom".to_vec(), b"data".to_vec());
rb.insert(b"top".to_vec(), nested);
let ht = rb.nested_witness(&b"top"[..], |v| v.witness(&b"bottom"[..]));
assert_eq!(ht.reconstruct(), rb.root_hash());
match ht {
HashTree::Labeled(lt, tt) => {
assert_eq!(lt, b"top");
match &(*tt) {
HashTree::Labeled(lb, _) => {
assert_eq!(lb, b"bottom");
}
other => panic!("unexpected nested tree: {:?}", other),
}
}
other => panic!("expected a labeled tree, got {:?}", other),
}
rb.modify(b"top", |m| m.delete(b"bottom"));
let ht = rb.nested_witness(&b"top"[..], |v| v.witness(&b"bottom"[..]));
assert_eq!(ht.reconstruct(), rb.root_hash());
} | rust_cleaned_test_functions.jsonl/57904 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
1670,
8091,
368,
341,
262,
1077,
5206,
18717,
25,
431,
65,
6533,
50439,
34837,
23,
8066,
431,
65,
6533,
50439,
34837,
23,
8066,
11312,
34837,
23,
20154,
284,
431,
65,
6533,
486,
931,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_print_dir_name() {
let tmp_dir = tempdir().expect("failed to create temp dir");
let icons = Icons::new(icon::Theme::Fancy);
// Chreate the directory
let dir_path = tmp_dir.path().join("directory");
fs::create_dir(&dir_path).expect("failed to create the dir");
let meta = Meta::from_path(&dir_path).unwrap();
let colors = Colors::new(color::Theme::NoLscolors);
assert_eq!(
Colour::Fixed(33).paint(" directory"),
meta.name.render(&colors, &icons)
);
} | rust_cleaned_test_functions.jsonl/959 | {
"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,
10064,
4334,
1269,
368,
341,
286,
1077,
4174,
4334,
284,
2730,
3741,
1005,
17119,
445,
16091,
311,
1855,
2730,
5419,
797,
286,
1077,
23765,
284,
31187,
486,
931,
44342,
486,
12594,
486,
37,
6572,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gossip_separate_account_notifications() {
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(100);
let bank = Bank::new_for_tests(&genesis_config);
let blockhash = bank.last_blockhash();
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let bank0 = bank_forks.read().unwrap().get(0).unwrap().clone();
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.write().unwrap().insert(bank1);
let bank2 = Bank::new_from_parent(&bank0, &Pubkey::default(), 2);
bank_forks.write().unwrap().insert(bank2);
let alice = Keypair::new();
let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);
let mut pending_optimistically_confirmed_banks = HashSet::new();
let exit = Arc::new(AtomicBool::new(false));
let max_complete_transaction_status_slot = Arc::new(AtomicU64::default());
let subscriptions = Arc::new(RpcSubscriptions::new_for_tests(
&exit,
max_complete_transaction_status_slot,
bank_forks.clone(),
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_slots(
1, 1,
))),
optimistically_confirmed_bank.clone(),
));
let (rpc0, mut receiver0) = rpc_pubsub_service::test_connection(&subscriptions);
let (rpc1, mut receiver1) = rpc_pubsub_service::test_connection(&subscriptions);
let sub_id0 = rpc0
.account_subscribe(
alice.pubkey().to_string(),
Some(RpcAccountInfoConfig {
commitment: Some(CommitmentConfig::confirmed()),
encoding: None,
data_slice: None,
}),
)
.unwrap();
assert!(subscriptions.control.account_subscribed(&alice.pubkey()));
let tx = system_transaction::create_account(
&mint_keypair,
&alice,
blockhash,
1,
16,
&stake::program::id(),
);
// Add the transaction to the 1st bank and then freeze the bank
let bank1 = bank_forks.write().unwrap().get(1).cloned().unwrap();
bank1.process_transaction(&tx).unwrap();
bank1.freeze();
// Add the same transaction to the unfrozen 2nd bank
bank_forks
.write()
.unwrap()
.get(2)
.unwrap()
.process_transaction(&tx)
.unwrap();
let mut highest_confirmed_slot: Slot = 0;
let mut last_notified_confirmed_slot: Slot = 0;
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::OptimisticallyConfirmed(2),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
highest_confirmed_slot = 0;
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::OptimisticallyConfirmed(1),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
let response = receiver0.recv();
let expected = json!({
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"context": { "slot": 1 },
"value": {
"data": "1111111111111111",
"executable": false,
"lamports": 1,
"owner": "Stake11111111111111111111111111111111111111",
"rentEpoch": 0,
},
},
"subscription": 0,
}
});
assert_eq!(
expected,
serde_json::from_str::<serde_json::Value>(&response).unwrap(),
);
rpc0.account_unsubscribe(sub_id0).unwrap();
let sub_id1 = rpc1
.account_subscribe(
alice.pubkey().to_string(),
Some(RpcAccountInfoConfig {
commitment: Some(CommitmentConfig::confirmed()),
encoding: None,
data_slice: None,
}),
)
.unwrap();
let bank2 = bank_forks.read().unwrap().get(2).unwrap().clone();
bank2.freeze();
highest_confirmed_slot = 0;
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::Frozen(bank2),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
let response = receiver1.recv();
let expected = json!({
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"context": { "slot": 2 },
"value": {
"data": "1111111111111111",
"executable": false,
"lamports": 1,
"owner": "Stake11111111111111111111111111111111111111",
"rentEpoch": 0,
},
},
"subscription": 1,
}
});
assert_eq!(
expected,
serde_json::from_str::<serde_json::Value>(&response).unwrap(),
);
rpc1.account_unsubscribe(sub_id1).unwrap();
assert!(!subscriptions.control.account_subscribed(&alice.pubkey()));
} | rust_cleaned_test_functions.jsonl/82541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
41473,
3453,
67598,
13500,
67546,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
7,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_heterogenous_list2() {
let data = [
0x1e, 0x3d, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x0b, 0x00, 0x01, 0x00,
0x14, 0x00, 0x03, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x01, 0x00, 0x14, 0x00, 0x69, 0x12,
0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
];
assert_eq!(
parse(&data[..]).unwrap().token_tape,
vec![
BinaryToken::Token(0x3d1e),
BinaryToken::Array(11),
BinaryToken::Array(10),
BinaryToken::Object(8),
BinaryToken::Token(0x0b),
BinaryToken::U32(3),
BinaryToken::Token(0xe1),
BinaryToken::U32(4713),
BinaryToken::End(3),
BinaryToken::I32(7),
BinaryToken::End(2),
BinaryToken::End(1),
]
);
} | rust_cleaned_test_functions.jsonl/109427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
1404,
52495,
2019,
17,
368,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
87,
16,
68,
11,
220,
15,
87,
18,
67,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_with_unnamed_struct_and_union_members() {
// See also:
// of a struct whose type is a struct without name is known as anonymous
// struct."
let ir = ir_from_cc(
r#"
struct StructWithUnnamedMembers {
struct {
int anonymous_struct_field_1;
int anonymous_struct_field_2;
};
union {
int anonymous_union_field_1;
int anonymous_union_field_2;
};
}; "#,
)
.unwrap();
// / we should support nested structs eventually.
assert_ir_matches!(
ir,
quote! {
Record {
rs_name: "StructWithUnnamedMembers" ...
cc_name: "StructWithUnnamedMembers" ...
fields: [
Field {
identifier: None, ...
type_ : Err(...), ...
offset: 0, ...
} ...
Field {
identifier: None, ...
type_ : Err(...), ...
offset: 64, ...
} ...
], ...
size: 12, ...
alignment: 4, ...
}
}
);
} | rust_cleaned_test_functions.jsonl/37161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 774
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
6615,
4907,
30245,
15126,
8378,
51621,
30397,
368,
341,
1066,
262,
442,
3496,
1083,
510,
1066,
262,
442,
256,
315,
264,
2036,
6693,
943,
374,
264,
2036,
2041,
829,
374,
3881,
438,
22151,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_autoscaling_describe_auto_scaling_groups() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"autoscaling-describe-auto-scaling-groups.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
AutoscalingClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = AutoScalingGroupNamesType::default();
let result = client.describe_auto_scaling_groups(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/8937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
32808,
436,
81552,
15768,
3114,
27740,
79216,
21148,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_output_code() {
let mut cmd = process::Command::new("sh");
cmd.arg("-c").arg("exit 200");
match output(cmd) {
Err(OutputError::Code(200)) => {}
result => panic!("expected code 200 output error but got: {:?}", result),
}
} | rust_cleaned_test_functions.jsonl/74397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
4136,
368,
341,
220,
1077,
5206,
5439,
284,
1882,
486,
4062,
486,
931,
445,
927,
797,
220,
5439,
21186,
13645,
66,
1827,
858,
445,
13652,
220,
17,
15,
15,
797,
220,
2432,
2550,
14160,
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... | 2 |
#[test]
fn test_trusted_len() {
let heap = BinaryHeap::from(vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1]);
check_trusted_len(heap.len(), heap.clone().into_iter_sorted());
check_trusted_len(heap.len(), heap.clone().drain_sorted());
} | rust_cleaned_test_functions.jsonl/62356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
27145,
6043,
368,
341,
262,
1077,
17364,
284,
17718,
27909,
486,
1499,
25592,
20703,
17,
11,
220,
19,
11,
220,
21,
11,
220,
17,
11,
220,
16,
11,
220,
23,
11,
220,
16,
15,
11,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request() {
let _ = env_logger::try_init();
let request = Request {
method: "GET".to_string(),
path: mockito::server_url(),
header: HashMap::new(),
body: vec![],
query_string: String::new(),
};
let _m = mock("GET", "/")
.with_header("content-type", "text/plain")
.with_body("ohai")
.create();
let hp = HttpClientProvider::new();
hp.configure(CapabilityConfiguration {
module: "test".to_string(),
values: HashMap::new(),
})
.unwrap();
let result = hp.request("test", request).unwrap();
let response: Response = deserialize(result.as_slice()).unwrap();
assert_eq!(response.status_code, 200);
} | rust_cleaned_test_functions.jsonl/322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
286,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
543,
286,
1077,
1681,
284,
6145,
341,
310,
1714,
25,
330,
3806,
3263,
983,
3904,
3148,
310,
1815,
25,
7860,
6357,
486,
4030,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_or_with_one_in_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let json = format!(r#"{{"$or":[{{"~{}":{{"$in":["{}"]}}}}]}}"#, name1, value1);
let query = parse_from_json(&json).unwrap();
let expected = Operator::Or(
vec![
Operator::In(
TagName::PlainTagName(name1.to_vec()),
vec![TargetValue::Unencrypted(value1.clone())]
)
]
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
11667,
1243,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
2951,
284,
3561,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect_vote_lockouts_sums() {
//two accounts voting for slot 0 with 1 token staked
let mut accounts = gen_stakes(&[(1, &[0]), (1, &[0])]);
accounts.sort_by_key(|(pk, _)| *pk);
let account_latest_votes: Vec<(Pubkey, SlotHashKey)> = accounts
.iter()
.map(|(pubkey, _)| (*pubkey, (0, Hash::default())))
.collect();
let ancestors = vec![(1, vec![0].into_iter().collect()), (0, HashSet::new())]
.into_iter()
.collect();
let mut latest_validator_votes_for_frozen_banks =
LatestValidatorVotesForFrozenBanks::default();
let ComputedBankState {
voted_stakes,
total_stake,
bank_weight,
..
} = Tower::collect_vote_lockouts(
&Pubkey::default(),
1,
accounts.into_iter(),
&ancestors,
|_| Some(Hash::default()),
&mut latest_validator_votes_for_frozen_banks,
);
assert_eq!(voted_stakes[&0], 2);
assert_eq!(total_stake, 2);
let mut new_votes = latest_validator_votes_for_frozen_banks.take_votes_dirty_set(0);
new_votes.sort();
assert_eq!(new_votes, account_latest_votes);
assert_eq!(bank_weight, 12)
} | rust_cleaned_test_functions.jsonl/61123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 696
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
54360,
9818,
11672,
643,
6237,
368,
341,
286,
442,
19789,
9618,
15668,
369,
9446,
220,
15,
448,
220,
16,
3950,
357,
7741,
198,
286,
1077,
5206,
9618,
284,
4081,
1261,
2050,
2099,
9697,
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_drop_with() {
let drops = RefCell::new(Vec::new());
{
// New/drop_with
let mut a = WithDrop::new(23, |x| drops.borrow_mut().push(x));
let b = with_drop(32, |x| drops.borrow_mut().push(x));
// Clone trait
let c = a.clone();
// Comparison trait
assert!(a != b);
assert!(a == c);
assert!(a < b);
assert!(b > a);
// Deref
*a += 42;
assert!(*a == 65);
// Pre-drop
assert!(drops.borrow().is_empty());
};
assert!(*drops.borrow() == [23, 32, 65]);
} | rust_cleaned_test_functions.jsonl/36339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
6615,
368,
341,
262,
1077,
21025,
284,
8550,
3599,
486,
931,
49923,
486,
931,
5231,
262,
341,
286,
442,
1532,
3446,
887,
6615,
198,
286,
1077,
5206,
264,
284,
3085,
19871,
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_default_struct() {
assert_de_tokens(
&DefaultStruct {
a1: 1,
a2: 2,
a3: 3,
a4: 0,
a5: 123,
},
&[
Token::Struct { name: "DefaultStruct", len: 3 },
Token::Str("a1"),
Token::I32(1),
Token::Str("a2"),
Token::I32(2),
Token::Str("a3"),
Token::I32(3),
Token::Str("a4"),
Token::I32(4),
Token::Str("a5"),
Token::I32(5),
Token::StructEnd,
],
);
assert_de_tokens(
&DefaultStruct {
a1: 1,
a2: 0,
a3: 123,
a4: 0,
a5: 123,
},
&[
Token::Struct { name: "DefaultStruct", len: 1 },
Token::Str("a1"),
Token::I32(1),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/58605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
15126,
368,
341,
262,
2060,
2259,
28838,
1006,
286,
609,
3675,
9422,
341,
1797,
264,
16,
25,
220,
16,
345,
1797,
264,
17,
25,
220,
17,
345,
1797,
264,
18,
25,
220,
18,
345,
1797,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_properties() -> Result<(), AmqpCodecError> {
let mut msg = Message::default();
msg.set_properties(|props| props.message_id = Some(1.into()));
let mut buf = BytesMut::with_capacity(msg.encoded_size());
msg.encode(&mut buf);
let msg2 = Message::decode(&buf)?.1;
let props = msg2.properties.as_ref().unwrap();
assert_eq!(props.message_id, Some(1.into()));
Ok(())
} | rust_cleaned_test_functions.jsonl/47637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25158,
368,
1464,
5714,
68843,
3303,
32763,
36913,
1454,
29,
341,
286,
1077,
5206,
3750,
284,
4856,
486,
2258,
543,
286,
3750,
980,
25158,
22428,
4761,
91,
6914,
6698,
842,
284,
4329,
7,
16,
398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fi_fo() {
let a = u32::MAX / 2;
let b = 2;
let c = a.wrapping_add(b);
assert_eq!(ocall::add(a, b).unwrap(), c);
assert_eq!(ocall::add_fi(a, b).unwrap(), c);
assert_eq!(ocall::add_fo(a, b).unwrap(), c);
assert_eq!(ocall::add_fi_fo(a, b).unwrap(), c);
assert_eq!(ocall::sub_fi(4, 1).unwrap(), 3);
assert_eq!(ocall::sub_fi(1, 4).unwrap(), -3);
} | rust_cleaned_test_functions.jsonl/31498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
72,
761,
78,
368,
341,
262,
1077,
264,
284,
575,
18,
17,
486,
10586,
608,
220,
17,
280,
262,
1077,
293,
284,
220,
17,
280,
262,
1077,
272,
284,
264,
81293,
3629,
2891,
1883,
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_circle_merging_with_attribute() {
let mut c1 = CircleOfPoints::new(
Circle::from_coordinate(&Coordinate2D::new(1.0, 1.0), 1.0),
1,
TimeInterval::default(),
[(
"foo".to_string(),
AttributeAggregate::MeanNumber(MeanAggregator::from_value(42.)),
)]
.iter()
.cloned()
.collect(),
)
.unwrap();
let c2 = CircleOfPoints::new(
Circle::from_coordinate(&Coordinate2D::new(2.0, 1.0), 1.0),
1,
TimeInterval::default(),
[(
"foo".to_string(),
AttributeAggregate::MeanNumber(MeanAggregator::from_value(44.)),
)]
.iter()
.cloned()
.collect(),
)
.unwrap();
let radius_model = LogScaledRadius::new(1.0, 0.).unwrap();
c1.merge(&c2, &radius_model);
assert_eq!(c1.number_of_points(), 2);
assert_eq!(c1.circle.x(), 1.5);
assert_eq!(c1.circle.y(), 1.0);
assert_eq!(c1.circle.radius(), 1.0 + 2.0_f64.ln());
assert_eq!(
c1.attribute_aggregates
.get("foo")
.unwrap()
.mean_number()
.unwrap()
.mean,
43.
);
} | rust_cleaned_test_functions.jsonl/127522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 828
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42222,
717,
95296,
6615,
16791,
368,
341,
286,
1077,
5206,
272,
16,
284,
21224,
2124,
11411,
486,
931,
1006,
310,
21224,
486,
1499,
68649,
2099,
28589,
17,
35,
486,
931,
7,
16,
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_raw_write_sst_ttl() {
test_raw_write_sst_ttl_impl(ApiVersion::V1ttl);
test_raw_write_sst_ttl_impl(ApiVersion::V2);
} | rust_cleaned_test_functions.jsonl/33215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
9165,
643,
267,
87157,
368,
341,
286,
1273,
16067,
9165,
643,
267,
87157,
21007,
65830,
5637,
486,
53,
16,
62858,
317,
286,
1273,
16067,
9165,
643,
267,
87157,
21007,
65830,
5637,
486,
53,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_endpoint_bad_string() {
let ret = do_endpoint(
quote! {
method = GET,
path = /a/b/c
},
quote! {
const POTATO = "potato";
},
);
let msg = format!("{}", ret.err().unwrap());
assert_eq!("expected a string, but found `/`", msg);
} | rust_cleaned_test_functions.jsonl/39857 | {
"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,
36699,
34199,
3904,
368,
341,
286,
1077,
2112,
284,
653,
36699,
1006,
310,
12641,
0,
341,
394,
1714,
284,
7890,
345,
394,
1815,
284,
608,
64,
3470,
2899,
198,
310,
1153,
310,
12641,
0,
341,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.