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_207() {
assert_eq!(Solution::can_finish(2, vec![vec![1, 0]]), true);
assert_eq!(Solution::can_finish(2, vec![vec![1, 0], vec![0, 1]]), false);
} | rust_cleaned_test_functions.jsonl/79214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
15,
22,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
4814,
42980,
7,
17,
11,
7486,
20703,
4083,
20703,
16,
11,
220,
15,
5053,
701,
830,
626,
286,
2060,
10714,
10297,
36842,
486,
4814... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_async_fetch() {
let count = 3;
let mut cluster = new_node_cluster(0, count);
cluster.cfg.raft_store.raft_log_gc_count_limit = Some(100000);
cluster.cfg.raft_store.raft_log_gc_threshold = 50;
cluster.cfg.raft_store.raft_log_gc_size_limit = Some(ReadableSize::mb(20));
cluster.cfg.raft_store.raft_log_gc_tick_interval = ReadableDuration::millis(100);
cluster.cfg.raft_store.raft_log_reserve_max_ticks = 2;
cluster.cfg.raft_store.raft_entry_cache_life_time = ReadableDuration::millis(100);
cluster.run();
cluster.must_put(b"k1", b"v1");
let mut before_states = HashMap::default();
for (&id, engines) in &cluster.engines {
must_get_equal(engines.kv.as_inner(), b"k1", b"v1");
let mut state: RaftApplyState = engines
.kv
.get_msg_cf(CF_RAFT, &keys::apply_state_key(1))
.unwrap()
.unwrap_or_default();
let state = state.take_truncated_state();
// compact should not start
assert_eq!(RAFT_INIT_LOG_INDEX, state.get_index());
assert_eq!(RAFT_INIT_LOG_TERM, state.get_term());
before_states.insert(id, state);
}
cluster.stop_node(1);
for i in 1..60u32 {
let k = i.to_string().into_bytes();
let v = k.clone();
cluster.must_put(&k, &v);
}
// wait log gc.
sleep_ms(500);
let (sender, receiver) = mpsc::channel();
let sync_sender = Mutex::new(sender);
fail::cfg_callback("on_async_fetch_return", move || {
let sender = sync_sender.lock().unwrap();
sender.send(true).unwrap();
})
.unwrap();
cluster.run_node(1).unwrap();
for (&id, engines) in &cluster.engines {
let mut state: RaftApplyState = engines
.kv
.get_msg_cf(CF_RAFT, &keys::apply_state_key(1))
.unwrap()
.unwrap_or_default();
let after_state = state.take_truncated_state();
let before_state = &before_states[&id];
let idx = after_state.get_index();
assert_eq!(idx, before_state.get_index());
}
assert_eq!(
receiver.recv_timeout(Duration::from_millis(500)).unwrap(),
true
);
// logs should be replicated to node 1 successfully.
for i in 1..60u32 {
let k = i.to_string().into_bytes();
let v = k.clone();
must_get_equal(cluster.engines[&1].kv.as_inner(), &k, &v);
}
for i in 60..500u32 {
let k = i.to_string().into_bytes();
let v = k.clone();
cluster.must_put(&k, &v);
let v2 = cluster.get(&k);
assert_eq!(v2, Some(v));
if i > 100
&& check_compacted(
&cluster.engines,
&before_states,
1,
false, /*must_compacted*/
)
{
return;
}
}
check_compacted(
&cluster.engines,
&before_states,
1,
true, /*must_compacted*/
);
} | rust_cleaned_test_functions.jsonl/117672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
28346,
11803,
368,
341,
262,
1077,
1760,
284,
220,
18,
280,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
1760,
626,
262,
10652,
30481,
13,
2944,
14809,
13,
2944,
5224,
49423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_txn_store_gc() {
let key = "k";
let store = AssertionStorage::default();
let (_cluster, violetabft_store) = AssertionStorage::new_violetabft_causet_storage_with_store_count(3, key);
store.test_txn_store_gc(key);
violetabft_store.test_txn_store_gc(key);
} | rust_cleaned_test_functions.jsonl/120731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
49423,
368,
341,
262,
1077,
1376,
284,
330,
74,
876,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
1077,
5453,
18855,
11,
79736,
370,
723,
14809,
8,
284,
46730,
5793,
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_strict_mode_func_decl_in_block() {
// Checks that a function declaration in a block is an error in
let scenario = r#"
'use strict';
let a = 4;
let b = 5;
if (a < b) { function f() {} }
"#;
check_output(&[TestAction::TestStartsWith(
scenario,
"Uncaught \"SyntaxError\": ",
)]);
} | rust_cleaned_test_functions.jsonl/42875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
849,
7302,
9596,
35814,
1243,
7113,
368,
341,
262,
442,
24843,
429,
264,
729,
18004,
304,
264,
2504,
374,
458,
1465,
304,
87079,
262,
1077,
15048,
284,
435,
2,
698,
262,
364,
810,
7304,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trim_all_handles_spaces_correctly() {
// Can't compare a byte array to a Cow so we convert both to slices before comparing
let expected = &b"Some example text"[..];
let actual = &trim_all(b" Some example text ")[..];
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/83746 | {
"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,
70025,
5705,
68017,
67883,
31550,
398,
368,
341,
286,
442,
2980,
944,
9429,
264,
4922,
1334,
311,
264,
21851,
773,
582,
5508,
2176,
311,
34254,
1573,
26297,
198,
286,
1077,
3601,
284,
609,
65,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_glyf() {
let buffer = read_fixture("tests/fonts/opentype/test-font.ttf");
let file = ReadScope::new(&buffer).read::<OpenTypeFont>().unwrap();
let glyph = Glyph {
number_of_contours: 1,
bounding_box: BoundingBox {
x_min: 1761,
y_min: 565,
x_max: 2007,
y_max: 1032,
},
data: GlyphData::Simple(SimpleGlyph {
end_pts_of_contours: vec![2],
instructions: &[],
flags: vec![
SimpleGlyphFlag::from_bits_truncate(1),
SimpleGlyphFlag::from_bits_truncate(51),
SimpleGlyphFlag::from_bits_truncate(3),
],
coordinates: vec![Point(1761, 565), Point(2007, 565), Point(1884, 1032)],
}),
};
let expected = GlyfTable {
records: vec![
GlyfRecord::Empty,
GlyfRecord::Empty,
GlyfRecord::Parsed(glyph),
],
};
match file.data {
OpenTypeData::Single(ttf) => {
let head = ttf
.read_table(&file.scope, tag::HEAD)
.expect("unable to read head table")
.expect("head table not found")
.read::<HeadTable>()
.expect("error parsing head table");
let maxp = ttf
.read_table(&file.scope, tag::MAXP)
.expect("unable to read maxp table")
.expect("maxp table not found")
.read::<MaxpTable>()
.expect("error parsing maxp table");
let loca = ttf
.read_table(&file.scope, tag::LOCA)
.expect("unable to read loca table")
.expect("loca table not found")
.read_dep::<LocaTable>((usize::from(maxp.num_glyphs), head.index_to_loc_format))
.expect("error parsing loca table");
let mut glyf = ttf
.read_table(&file.scope, tag::GLYF)
.expect("unable to read glyf table")
.expect("glyf table not found")
.read_dep::<GlyfTable>(&loca)
.expect("error parsing glyf table");
glyf.records.iter_mut().for_each(|rec| rec.parse().unwrap());
assert_eq!(glyf, expected);
}
OpenTypeData::Collection(_) => unreachable!(),
}
} | rust_cleaned_test_functions.jsonl/31763 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
1889,
398,
69,
368,
341,
262,
1077,
4147,
284,
1349,
74409,
445,
23841,
60667,
52000,
306,
499,
12697,
30671,
45192,
797,
262,
1077,
1034,
284,
4457,
10803,
486,
931,
2099,
7573,
568,
878,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_old_value() {
struct Case {
expected: OldValue,
// all data to write to the engine
// current write_cursor will be on the last record in `written`
// which also means prev_write is `Write` in the record
written: Vec<(Write, TimeStamp)>,
}
let cases = vec![
// prev_write is None
Case {
expected: OldValue::None,
written: vec![],
},
Case {
expected: OldValue::ValueTimeStamp {
start_ts: TimeStamp::new(4),
},
written: vec![
(
Write::new(WriteType::Put, TimeStamp::new(4), None),
TimeStamp::new(6),
),
(
Write::new(WriteType::Rollback, TimeStamp::new(5), None),
TimeStamp::new(7),
),
],
},
Case {
expected: OldValue::Value {
value: b"v".to_vec(),
},
written: vec![
(
Write::new(WriteType::Put, TimeStamp::new(4), Some(b"v".to_vec())),
TimeStamp::new(6),
),
(
Write::new(WriteType::Rollback, TimeStamp::new(5), None),
TimeStamp::new(7),
),
],
},
Case {
expected: OldValue::None,
written: vec![(
Write::new(WriteType::Rollback, TimeStamp::new(5), None),
TimeStamp::new(6),
)],
},
Case {
expected: OldValue::ValueTimeStamp {
start_ts: TimeStamp::new(3),
},
written: vec![
(
Write::new(WriteType::Put, TimeStamp::new(3), None),
TimeStamp::new(6),
),
(
Write::new(WriteType::Lock, TimeStamp::new(5), None),
TimeStamp::new(7),
),
],
},
Case {
expected: OldValue::None,
written: vec![(
Write::new(WriteType::Lock, TimeStamp::new(5), None),
TimeStamp::new(6),
)],
},
Case {
expected: OldValue::ValueTimeStamp {
start_ts: TimeStamp::new(7),
},
written: vec![(
Write::new(WriteType::Put, TimeStamp::new(7), None)
.set_overlapped_rollback(true, Some(27.into())),
TimeStamp::new(5),
)],
},
Case {
expected: OldValue::None,
written: vec![(
Write::new(WriteType::Put, TimeStamp::new(4), None)
.set_overlapped_rollback(true, Some(3.into())),
TimeStamp::new(5),
)],
},
Case {
expected: OldValue::None,
written: vec![
(
Write::new(WriteType::Put, TimeStamp::new(3), None),
TimeStamp::new(6),
),
(
Write::new(WriteType::Delete, TimeStamp::new(7), None),
TimeStamp::new(8),
),
],
},
Case {
expected: OldValue::None,
written: vec![
(
Write::new(WriteType::Put, TimeStamp::new(3), None),
TimeStamp::new(6),
),
(
Write::new(WriteType::Delete, TimeStamp::new(7), None)
.set_overlapped_rollback(true, Some(6.into())),
TimeStamp::new(8),
),
],
},
];
for (i, case) in cases.into_iter().enumerate() {
let engine = TestEngineBuilder::new().build().unwrap();
let cm = ConcurrencyManager::new(42.into());
let mut txn = MvccTxn::new(TimeStamp::new(10), cm.clone());
for (write_record, put_ts) in case.written.iter() {
txn.put_write(
Key::from_raw(b"a"),
*put_ts,
write_record.as_ref().to_bytes(),
);
}
write(&engine, &Context::default(), txn.into_modifies());
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut reader = MvccReader::new(snapshot, None, true);
if !case.written.is_empty() {
let prev_write = reader
.seek_write(&Key::from_raw(b"a"), case.written.last().unwrap().1)
.unwrap()
.unwrap()
.1;
let result = reader
.get_old_value(&Key::from_raw(b"a"), TimeStamp::new(25), prev_write)
.unwrap();
assert_eq!(result, case.expected, "case #{}", i);
}
}
} | rust_cleaned_test_functions.jsonl/125635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3660
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
21108,
3142,
368,
341,
286,
2036,
11538,
341,
310,
3601,
25,
10621,
1130,
3554,
3374,
310,
442,
678,
821,
311,
3270,
311,
279,
4712,
198,
310,
442,
1482,
3270,
28601,
686,
387,
389,
279,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_date_pred() {
let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d);
assert_eq!(ymd(2016, 3, 1).pred_opt(), Some(ymd(2016, 2, 29)));
assert_eq!(ymd(2015, 1, 1).pred_opt(), Some(ymd(2014, 12, 31)));
assert_eq!(ymd(2014, 6, 1).pred_opt(), Some(ymd(2014, 5, 31)));
assert_eq!(ymd(2014, 5, 7).pred_opt(), Some(ymd(2014, 5, 6)));
assert_eq!(ymd(MIN_DATE.year(), 1, 1).pred_opt(), None);
} | rust_cleaned_test_functions.jsonl/4767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
12830,
368,
341,
286,
1077,
379,
2277,
284,
760,
88,
13086,
11991,
91,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7021,
11,
296,
11,
294,
317,
286,
2060,
10714,
10297,
1600,
67,
7,
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_num_flotante() {
assert_eq!(num_flotante("1.1"), Ok(("", ("1.1", "flotante"))));
assert_eq!(num_flotante("11.23"), Ok(("", ("11.23", "flotante"))));
assert_eq!(num_flotante("112.3131"), Ok(("", ("112.3131", "flotante"))));
assert_eq!(num_flotante("0.3131"), Ok(("", ("0.3131", "flotante"))));
assert_eq!(num_flotante(".3131"), Ok(("", (".3131", "flotante"))));
} | rust_cleaned_test_functions.jsonl/46885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
5081,
354,
4942,
368,
341,
262,
2060,
10714,
10297,
2413,
5081,
354,
4942,
445,
16,
13,
16,
3975,
981,
7622,
7,
19814,
3489,
16,
13,
16,
497,
330,
1489,
354,
4942,
2761,
1106,
262,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deregister_conn_then_delegate() {
let (mut ep, raft_router, _task_rx) = mock_endpoint(&CdcConfig::default());
let _raft_rx = raft_router.add_region(1 /* region id */, 100 /* cap */);
let quota = crate::channel::MemoryQuota::new(usize::MAX);
// Open conn a
let (tx1, _rx1) = channel::channel(1, quota.clone());
let conn_a = Conn::new(tx1, String::new());
let conn_id_a = conn_a.get_id();
ep.run(Task::OpenConn { conn: conn_a });
// Open conn b
let (tx2, mut rx2) = channel::channel(1, quota);
let mut rx2 = rx2.drain();
let conn_b = Conn::new(tx2, String::new());
let conn_id_b = conn_b.get_id();
ep.run(Task::OpenConn { conn: conn_b });
let mut req_header = Header::default();
req_header.set_cluster_id(0);
let mut req = ChangeDataRequest::default();
req.set_region_id(1);
req.mut_region_epoch().set_version(2);
let region_epoch_2 = req.get_region_epoch().clone();
let downstream =
Downstream::new("".to_string(), region_epoch_2.clone(), 0, conn_id_a, true);
ep.run(Task::Register {
request: req.clone(),
downstream,
conn_id: conn_id_a,
version: semver::Version::new(0, 0, 0),
});
assert_eq!(ep.capture_regions.len(), 1);
let observe_id = ep.capture_regions[&1].handle.id;
let mut req_header = Header::default();
req_header.set_cluster_id(0);
let mut req = ChangeDataRequest::default();
req.set_region_id(1);
req.mut_region_epoch().set_version(1);
let region_epoch_1 = req.get_region_epoch().clone();
let downstream = Downstream::new("".to_string(), region_epoch_1, 0, conn_id_b, true);
ep.run(Task::Register {
request: req.clone(),
downstream,
conn_id: conn_id_b,
version: semver::Version::new(0, 0, 0),
});
assert_eq!(ep.capture_regions.len(), 1);
// Deregister conn a.
ep.run(Task::Deregister(Deregister::Conn(conn_id_a)));
assert_eq!(ep.capture_regions.len(), 1);
let mut region = Region::default();
region.id = 1;
region.set_region_epoch(region_epoch_2);
ep.run(Task::ResolverReady {
observe_id,
region: region.clone(),
resolver: Resolver::new(1),
});
// Deregister deletgate due to epoch not match for conn b.
let mut epoch_not_match = ErrorHeader::default();
epoch_not_match
.mut_epoch_not_match()
.mut_current_regions()
.push(region);
ep.run(Task::Deregister(Deregister::Delegate {
region_id: 1,
observe_id,
err: Error::request(epoch_not_match),
}));
assert_eq!(ep.capture_regions.len(), 0);
let event = recv_timeout(&mut rx2, Duration::from_millis(100))
.unwrap()
.unwrap()
.0;
assert!(
event.event().get_error().has_epoch_not_match(),
"{:?}",
event
);
} | rust_cleaned_test_functions.jsonl/111884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1629
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
52633,
1571,
17241,
68367,
55312,
368,
341,
286,
1077,
320,
6984,
4155,
11,
52455,
55587,
11,
716,
8202,
24330,
8,
284,
7860,
36699,
2099,
34,
7628,
2648,
486,
2258,
1423,
286,
1077,
716,
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_read_extensions() {
let sample = vec![0, 1, 0, 1, 9, 9, 12];
let mut reader = sample.as_slice();
assert_eq!(reader.read_u32().unwrap(), 65537);
assert_eq!(reader.read_n(2).unwrap(), vec![9, 9]);
assert_eq!(reader.read_u8().unwrap(), 12);
} | rust_cleaned_test_functions.jsonl/133018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
60498,
368,
341,
286,
1077,
6077,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
15,
11,
220,
16,
11,
220,
24,
11,
220,
24,
11,
220,
16,
17,
935,
286,
1077,
5206,
6604,
284,
6077,
5357,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_chain() {
let leaves = create_leaves(50..52);
let mock_store = Arc::new(MockAccumulatorStore::new());
let accumulator = MerkleAccumulator::new(
*ACCUMULATOR_PLACEHOLDER_HASH,
vec![],
0,
0,
mock_store.clone(),
);
let root_hash = accumulator.append(&leaves).unwrap();
accumulator.flush().unwrap();
proof_verify(&accumulator, root_hash, &leaves, 0);
let frozen_node = accumulator.get_frozen_subtree_roots();
for node in frozen_node.clone() {
let acc = mock_store
.get_node(node)
.expect("get accumulator node by hash should success")
.unwrap();
if let AccumulatorNode::Internal(internal) = acc {
let left = mock_store.get_node(internal.left()).unwrap().unwrap();
assert!(left.is_frozen());
let right = mock_store.get_node(internal.right()).unwrap().unwrap();
assert!(right.is_frozen());
}
}
let accumulator2 = MerkleAccumulator::new(root_hash, frozen_node, 2, 3, mock_store);
assert_eq!(accumulator.root_hash(), accumulator2.root_hash());
let leaves2 = create_leaves(54..58);
let leaves3 = create_leaves(60..64);
let _root_hash2 = accumulator.append(&leaves2).unwrap();
accumulator.flush().unwrap();
let _root_hash3 = accumulator2.append(&leaves3).unwrap();
accumulator2.flush().unwrap();
assert_eq!(
accumulator.get_node_by_position(1).unwrap().unwrap(),
accumulator2.get_node_by_position(1).unwrap().unwrap()
);
for i in 3..accumulator2.num_nodes() {
assert_ne!(
accumulator.get_node_by_position(i).unwrap().unwrap(),
accumulator2.get_node_by_position(i).unwrap().unwrap()
);
}
} | rust_cleaned_test_functions.jsonl/51489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 807
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
30583,
368,
341,
262,
1077,
10901,
284,
1855,
11751,
4693,
7,
20,
15,
496,
20,
17,
317,
262,
1077,
7860,
14809,
284,
19689,
486,
931,
66436,
14603,
372,
10511,
6093,
486,
931,
1423,
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... | 4 |
#[test]
fn test_client_async() {
println!("Async Client test: Starting runtime");
let mut rt = ::tokio::runtime::Runtime::new().unwrap();
println!("Creating client");
let client = test_client();
println!("Getting summary");
let summary = rt.block_on(client.summary()).unwrap();
assert!(summary.most_downloaded.len() > 0);
println!("Getting three most downloaded crates");
for item in &summary.most_downloaded[0..3] {
println!("Geting crate: {}", &item.name);
let _ = rt.block_on(client.full_crate(&item.name, false)).unwrap();
}
println!("Getting three crates from `all_crates`");
let crates = rt.block_on(client.all_crates(None).take(3).collect::<Vec<_>>());
for c in crates {
let c = c.unwrap();
println!("Crate: {:#?}", c);
}
} | rust_cleaned_test_functions.jsonl/101822 | {
"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,
8179,
28346,
368,
341,
286,
13751,
17223,
6525,
8423,
1273,
25,
27657,
15592,
797,
286,
1077,
5206,
16677,
284,
3504,
29594,
815,
486,
22255,
486,
15123,
486,
931,
1005,
15454,
1428,
286,
13751,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_download_sst_then_ingest() {
for cf in &[CF_DEFAULT, CF_WRITE] {
// creates a sample SST file.
let (_ext_sst_dir, backend, mut meta) = create_sample_external_sst_file().unwrap();
meta.set_cf_name((*cf).to_string());
// performs the download.
let importer_dir = tempfile::tempdir().unwrap();
let importer = SSTImporter::new(&importer_dir, None).unwrap();
let sst_writer = create_sst_writer_with_db(&importer, &meta).unwrap();
let range = importer
.download::<TestEngine>(
&meta,
&backend,
"sample.sst",
&new_rewrite_rule(b"t123", b"t9102", 0),
Limiter::new(INFINITY),
sst_writer,
)
.unwrap()
.unwrap();
assert_eq!(range.get_start(), b"t9102_r01");
assert_eq!(range.get_end(), b"t9102_r13");
// performs the ingest
let ingest_dir = tempfile::tempdir().unwrap();
let db = new_test_engine(ingest_dir.path().to_str().unwrap(), DATA_CFS);
meta.set_length(0); // disable validation.
meta.set_crc32(0);
importer.ingest(&meta, &db).unwrap();
// verifies the DB content is correct.
let mut iter = db.iterator_cf(cf).unwrap();
iter.seek(SeekKey::Start).unwrap();
assert_eq!(
collect(iter),
vec![
(b"zt9102_r01".to_vec(), b"abc".to_vec()),
(b"zt9102_r04".to_vec(), b"xyz".to_vec()),
(b"zt9102_r07".to_vec(), b"pqrst".to_vec()),
(b"zt9102_r13".to_vec(), b"www".to_vec()),
]
);
// check properties
let start = keys::data_key(b"");
let end = keys::data_end_key(b"");
let collection = db.get_range_properties_cf(cf, &start, &end).unwrap();
assert!(!collection.is_empty());
for (_, v) in collection.iter() {
assert!(!v.user_collected_properties().is_empty());
assert_eq!(
v.user_collected_properties()
.get(PROP_TEST_MARKER_CF_NAME)
.unwrap(),
cf.as_bytes()
);
}
}
} | rust_cleaned_test_functions.jsonl/4966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35939,
643,
267,
68367,
59112,
477,
368,
341,
286,
369,
24111,
304,
44590,
9650,
13811,
11,
20795,
17475,
60,
341,
310,
442,
11450,
264,
6077,
91416,
1034,
624,
310,
1077,
5453,
427,
643,
267,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_real_transaction() {
let ctx = TestContext::new();
let mut con = ctx.connection();
let key = "the_key";
let _: () = redis::cmd("SET").arg(key).arg(42).query(&mut con).unwrap();
loop {
let _: () = redis::cmd("WATCH").arg(key).query(&mut con).unwrap();
let val: isize = redis::cmd("GET").arg(key).query(&mut con).unwrap();
let response: Option<(isize,)> = redis::pipe()
.atomic()
.cmd("SET")
.arg(key)
.arg(val + 1)
.ignore()
.cmd("GET")
.arg(key)
.query(&mut con)
.unwrap();
match response {
None => {
continue;
}
Some(response) => {
assert_eq!(response, (43,));
break;
}
}
}
} | rust_cleaned_test_functions.jsonl/108956 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
28884,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
1077,
1376,
284,
330,
1782,
3097,
876,
262,
1077,
58536,
1719,
284,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_dereference_document() {
let document = generate_document();
// Dereference methods
match dereference_document(document.clone(), "auth-key").unwrap().unwrap() {
SecondaryResource::VerificationKey(actual) => assert_eq!(actual, document.methods().find(|method| method.id().fragment().unwrap() == "auth-key").unwrap().clone()),
actual => panic!("Expected #auth-key got {:?}", actual),
}
match dereference_document(document.clone(), "key-1").unwrap().unwrap() {
SecondaryResource::VerificationKey(actual) => assert_eq!(actual, document.verification_method().query("#key-1").unwrap().clone()),
actual => panic!("Expected #key-1 got {:?}", actual),
}
match dereference_document(document.clone(), "key-2").unwrap().unwrap() {
SecondaryResource::VerificationKey(actual) => assert_eq!(actual, document.verification_method().query("#key-2").unwrap().clone()),
actual => panic!("Expected #key-2 got {:?}", actual),
}
// Dereference services
match dereference_document(document.clone(), "service-1").unwrap().unwrap() {
SecondaryResource::Service(actual) => assert_eq!(actual, document.service().query("#service-1").unwrap().clone()),
actual => panic!("Expected #service-1 got {:?}", actual),
}
match dereference_document(document.clone(), "service-2").unwrap().unwrap() {
SecondaryResource::Service(actual) => assert_eq!(actual, document.service().query("#service-2").unwrap().clone()),
actual => panic!("Expected #service-2 got {:?}", actual),
}
} | rust_cleaned_test_functions.jsonl/92049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
485,
2202,
26231,
368,
341,
262,
1077,
2197,
284,
6923,
26231,
1428,
262,
442,
89678,
2202,
5413,
198,
262,
2432,
25277,
2202,
26231,
15290,
15997,
1507,
330,
3242,
16173,
1827,
15454,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_switch_module_priv() {
let mut buf = Vec::new();
switch_module_priv::<(), _>(&[], &mut buf);
assert_eq!(
buf.as_slice(),
&b"switch expects a path to module argument\n"[..]
);
buf.clear();
switch_module_priv::<(), _>(&["foo"], &mut buf);
assert_eq!(buf.as_slice(), &b""[..]);
buf.clear();
switch_module_priv::<(), _>(&[""], &mut buf);
println!("{:?}", std::str::from_utf8(&buf));
assert_eq!(
buf.as_slice(),
&b"failed to parse into a valid module path\n"[..]
);
} | rust_cleaned_test_functions.jsonl/99214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
10750,
24726,
368,
341,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
543,
286,
3398,
10750,
24726,
27638,
1507,
716,
44784,
12995,
609,
6984,
6607,
317,
286,
2060,
10714,
33673,
310,
6607,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiplication() {
let s = Secp256k1::new();
let (mut sk1, mut pk1) = s.generate_keypair(&mut thread_rng()).unwrap();
let (mut sk2, mut pk2) = s.generate_keypair(&mut thread_rng()).unwrap();
assert_eq!(PublicKey::from_secret_key(&s, &sk1).unwrap(), pk1);
assert!(sk1.mul_assign(&sk2).is_ok());
assert!(pk1.mul_assign(&s, &sk2).is_ok());
assert_eq!(PublicKey::from_secret_key(&s, &sk1).unwrap(), pk1);
assert_eq!(PublicKey::from_secret_key(&s, &sk2).unwrap(), pk2);
assert!(sk2.mul_assign(&sk1).is_ok());
assert!(pk2.mul_assign(&s, &sk1).is_ok());
assert_eq!(PublicKey::from_secret_key(&s, &sk2).unwrap(), pk2);
} | rust_cleaned_test_functions.jsonl/41405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91802,
1693,
368,
341,
286,
1077,
274,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
1428,
286,
1077,
320,
6984,
1901,
16,
11,
5206,
22458,
16,
8,
284,
274,
22019,
3097,
12670,
2099,
6984,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lock_combinations() {
let l = RwLock::<usize>::default();
{
let _g = l.write(2);
}
{
let _g = l.write(2);
}
{
let _f = l.read(0);
let _s = l.read(1);
}
{
let _g = l.write(2);
}
} | rust_cleaned_test_functions.jsonl/77527 | {
"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,
9818,
34454,
12634,
368,
341,
286,
1077,
326,
284,
55294,
11989,
27638,
51878,
6831,
2258,
1428,
286,
341,
310,
1077,
716,
70,
284,
326,
3836,
7,
17,
317,
286,
555,
286,
341,
310,
1077,
716,
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_choose_more_words() {
let more_words: Vec<Vec<String>> =
vec![vecstrings("purple yellow"), vecstrings("sausages")];
let expected2 = vecstrings("purple-sausages yellow-sausages");
let expected3: Vec<String> = vec![
"purple-sausages-purple",
"yellow-sausages-purple",
"purple-sausages-yellow",
"yellow-sausages-yellow",
]
.iter()
.map(|s| s.to_string())
.collect();
let w = Wordlist::new(2, more_words.clone());
for _ in 0..20 {
assert!(expected2.contains(&w.choose_words()));
}
let w = Wordlist::new(3, more_words);
for _ in 0..20 {
assert!(expected3.contains(&w.choose_words()));
}
} | rust_cleaned_test_functions.jsonl/132786 | {
"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,
77433,
36664,
18981,
368,
341,
286,
1077,
803,
18981,
25,
11312,
50439,
3464,
2452,
4035,
310,
7486,
20703,
4083,
18594,
445,
56507,
13753,
3975,
7486,
18594,
445,
9081,
355,
1134,
899,
4821,
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... | 3 |
#[test]
fn test_seek_for_prev_by_existing_key() {
let db = TestDB::new();
let mut iter = db.iter();
iter.seek_for_prev(&TestKey(1, 1, 0)).unwrap();
assert_eq!(collect_values(iter), [110, 112, 114, 200, 202]);
} | rust_cleaned_test_functions.jsonl/3513 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
5478,
25566,
3710,
62630,
3097,
368,
341,
262,
1077,
2927,
284,
3393,
3506,
486,
931,
543,
262,
1077,
5206,
5367,
284,
2927,
19471,
543,
262,
5367,
38179,
5478,
25566,
2099,
2271,
1592,
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_polygon() {
let p = polygon!(
exterior: [(x: 0., y: 0.), (x: 0., y: 10.), (x: 10., y: 10.), (x: 10., y: 0.)],
interiors: [
[(x: 1., y: 1.), (x: 1., y: 2.), (x: 2., y: 2.), (x: 2., y: 1.)],
[(x: 3., y: 3.), (x: 5., y: 3.), (x: 5., y: 5.), (x: 3., y: 5.)],
],
);
let want = vec![
// exterior ring
Line::new(coord! { x: 0., y: 0. }, coord! { x: 0., y: 10. }),
Line::new(coord! { x: 0., y: 10. }, coord! { x: 10., y: 10. }),
Line::new(coord! { x: 10., y: 10. }, coord! { x: 10., y: 0. }),
Line::new(coord! { x: 10., y: 0. }, coord! { x: 0., y: 0. }),
// first interior ring
Line::new(coord! { x: 1., y: 1. }, coord! { x: 1., y: 2. }),
Line::new(coord! { x: 1., y: 2. }, coord! { x: 2., y: 2. }),
Line::new(coord! { x: 2., y: 2. }, coord! { x: 2., y: 1. }),
Line::new(coord! { x: 2., y: 1. }, coord! { x: 1., y: 1. }),
// second interior ring
Line::new(coord! { x: 3., y: 3. }, coord! { x: 5., y: 3. }),
Line::new(coord! { x: 5., y: 3. }, coord! { x: 5., y: 5. }),
Line::new(coord! { x: 5., y: 5. }, coord! { x: 3., y: 5. }),
Line::new(coord! { x: 3., y: 5. }, coord! { x: 3., y: 3. }),
];
assert_eq!(want, p.lines_iter().collect::<Vec<_>>());
} | rust_cleaned_test_functions.jsonl/83536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 825
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73542,
368,
341,
286,
1077,
281,
284,
29372,
33673,
310,
27263,
25,
17826,
87,
25,
220,
15,
2572,
379,
25,
220,
15,
24389,
320,
87,
25,
220,
15,
2572,
379,
25,
220,
16,
15,
24389,
320,
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_timeout_invoked() {
let mut executor =
fasync::TestExecutor::new_with_fake_time().expect("creating executor failed");
let start_time = executor.now();
let mut stalled_future =
futures::future::pending().on_timeout_named(&DEADLINE_ID, ONE_HOUR, || "timeout");
assert!(executor.run_until_stalled(&mut stalled_future).is_pending());
executor.set_fake_time(start_time + ONE_HOUR);
assert_eq!(executor.wake_next_timer(), Some(start_time + ONE_HOUR));
assert_eq!(executor.run_until_stalled(&mut stalled_future), Poll::Ready("timeout"));
} | rust_cleaned_test_functions.jsonl/132103 | {
"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,
20537,
19996,
10823,
368,
341,
286,
1077,
5206,
31558,
4035,
310,
282,
7692,
486,
2271,
25255,
486,
931,
6615,
56881,
3009,
1005,
17119,
445,
44902,
31558,
4641,
3071,
286,
1077,
1191,
3009,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_remove_proposal() {
let store = setup_admin_service_store();
let event_store = store.clone_boxed();
let (mesh, cm, pm, peer_connector) = setup_peer_connector(None);
let orchestrator = setup_orchestrator();
let context = Secp256k1Context::new();
let private_key = context.new_random_private_key();
let pub_key = context
.get_public_key(&private_key)
.expect("Unable to get corresponding public key");
let signer = context.new_signer(private_key);
let signature_verifier = context.new_verifier();
let table = RoutingTable::default();
let writer: Box<dyn RoutingTableWriter> = Box::new(table.clone());
let mut admin_shared = AdminServiceShared::new(
"node_a".into(),
Arc::new(Mutex::new(orchestrator)),
HashMap::new(),
peer_connector,
store,
signature_verifier,
Box::new(MockAdminKeyVerifier::default()),
Box::new(AllowAllKeyPermissionManager),
writer,
event_store,
vec![],
);
let store_proposal = StoreProposal::from_proto(setup_test_proposal(&setup_test_circuit()))
.expect("Unable to build CircuitProposal");
// Add the circuit proposal to be removed
admin_shared
.admin_store
.add_proposal(store_proposal)
.expect("Unable to add circuit proposal to store");
// Make `ProposalRemoveRequest` and corresponding payload
let mut remove_proposal = admin::ProposalRemoveRequest::new();
remove_proposal.set_circuit_id("01234-ABCDE".to_string());
let mut header = admin::CircuitManagementPayload_Header::new();
header.set_action(admin::CircuitManagementPayload_Action::PROPOSAL_REMOVE_REQUEST);
header.set_requester(pub_key.into_bytes());
header.set_requester_node_id("node_a".to_string());
let mut payload = admin::CircuitManagementPayload::new();
payload.set_header(protobuf::Message::write_to_bytes(&header).unwrap());
payload.set_signature(signer.sign(&payload.header).unwrap().take_bytes());
payload.set_proposal_remove_request(remove_proposal);
// Submit `ProposalRemoveRequest` payload
if let Err(err) = admin_shared.submit(payload) {
panic!("Should have been valid: {}", err);
}
let proposal_option = admin_shared
.admin_store
.get_proposal(&"01234-ABCDE".to_string())
.expect("Unable to get circuit proposal");
assert!(proposal_option.is_none());
shutdown(mesh, cm, pm);
} | rust_cleaned_test_functions.jsonl/47911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
21663,
32556,
368,
341,
286,
1077,
3553,
284,
6505,
12207,
12267,
14809,
543,
286,
1077,
1538,
14809,
284,
3553,
15997,
10194,
291,
543,
286,
1077,
320,
23506,
11,
9961,
11,
8836,
11,
14397... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transfer_with_seed() {
let mut transaction_context = TransactionContext::new(Vec::new(), 1);
let invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
let base = Pubkey::new_unique();
let base_account = RefCell::new(AccountSharedData::new(100, 0, &Pubkey::new(&[2; 32]))); // account owner should not matter
let from_base_keyed_account = KeyedAccount::new(&base, true, &base_account);
let from_seed = "42";
let from_owner = system_program::id();
let from = Pubkey::create_with_seed(&base, from_seed, &from_owner).unwrap();
let from_account = RefCell::new(AccountSharedData::new(100, 0, &Pubkey::new(&[2; 32]))); // account owner should not matter
let to = Pubkey::new(&[3; 32]);
let to_account = RefCell::new(AccountSharedData::new(1, 0, &to)); // account owner should not matter
let from_keyed_account = KeyedAccount::new(&from, true, &from_account);
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
transfer_with_seed(
&from_keyed_account,
&from_base_keyed_account,
from_seed,
&from_owner,
&to_keyed_account,
50,
&invoke_context,
)
.unwrap();
let from_lamports = from_keyed_account.account.borrow().lamports();
let to_lamports = to_keyed_account.account.borrow().lamports();
assert_eq!(from_lamports, 50);
assert_eq!(to_lamports, 51);
// Attempt to move more lamports than remaining in from_account
let from_keyed_account = KeyedAccount::new(&from, true, &from_account);
let result = transfer_with_seed(
&from_keyed_account,
&from_base_keyed_account,
from_seed,
&from_owner,
&to_keyed_account,
100,
&invoke_context,
);
assert_eq!(result, Err(SystemError::ResultWithNegativeLamports.into()));
assert_eq!(from_keyed_account.account.borrow().lamports(), 50);
assert_eq!(to_keyed_account.account.borrow().lamports(), 51);
// test unsigned transfer of zero
let from_keyed_account = KeyedAccount::new(&from, false, &from_account);
assert!(transfer_with_seed(
&from_keyed_account,
&from_base_keyed_account,
from_seed,
&from_owner,
&to_keyed_account,
0,
&invoke_context,
)
.is_ok());
assert_eq!(from_keyed_account.account.borrow().lamports(), 50);
assert_eq!(to_keyed_account.account.borrow().lamports(), 51);
} | rust_cleaned_test_functions.jsonl/106204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
6615,
33809,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
17869,
1972,
486,
931,
49923,
486,
931,
1507,
220,
16,
317,
286,
1077,
19873,
8467,
284,
39667,
1972,
486,
931,
34134,
2099,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_iterator() {
let cfg = get_test_cfg();
let store = get_test_store(cfg.clone()).clone();
let mut itrs = Vec::new();
let partition_name = String::from("temppartition");
create_segment(1, partition_name.clone(), cfg.clone(), 1, store.clone());
create_segment(2, partition_name.clone(), cfg.clone(), 4, store.clone());
let partition_iterator = PartitionIterator::new(
partition_name,
1,
9,
String::from(""),
store.clone(),
cfg.clone(),
)
.unwrap()
.unwrap();
itrs.push(Rc::new(RefCell::new(partition_iterator)));
let partition_name = String::from("temppartition1");
create_segment(1, partition_name.clone(), cfg.clone(), 10, store.clone());
create_segment(2, partition_name.clone(), cfg.clone(), 14, store.clone());
let partition_iterator =
PartitionIterator::new(partition_name, 10, 19, String::from(""), store, cfg)
.unwrap()
.unwrap();
itrs.push(Rc::new(RefCell::new(partition_iterator)));
let mut merge_itr = MergeIteartor::new(itrs).unwrap();
let mut count = 0;
loop {
let ent = merge_itr.entry();
if ent.is_none() {
break;
}
count = count + 1;
if count == 10 {
break;
}
merge_itr.next();
}
assert!(count == 8);
} | rust_cleaned_test_functions.jsonl/61455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
13491,
368,
341,
286,
1077,
13286,
284,
633,
4452,
18343,
543,
286,
1077,
3553,
284,
633,
4452,
14809,
28272,
15997,
6011,
19982,
543,
286,
1077,
5206,
432,
5428,
284,
11312,
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_into_iter_collect() {
let data = vec![5, 9, 3];
let iterout = vec![9, 5, 3];
let pq = BinaryHeap::from(data);
let v: Vec<_> = pq.into_iter().collect();
assert_eq!(v, iterout);
} | rust_cleaned_test_functions.jsonl/62350 | {
"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,
45514,
11723,
68140,
368,
341,
262,
1077,
821,
284,
7486,
20703,
20,
11,
220,
24,
11,
220,
18,
935,
262,
1077,
5367,
411,
284,
7486,
20703,
24,
11,
220,
20,
11,
220,
18,
935,
262,
1077,
3963... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_classes() {
test_roundtrip("class C {}");
test_roundtrip("class C extends D {}");
test_roundtrip(
"class C extends D {
prop1;
#prop2;
constructor() {}
a() {}
#b() {}
c(x, y) {}
static d() {}
}",
);
test_roundtrip(
"var cls = (class C extends D {
prop1;
#prop2;
constructor() {}
a() {}
#b() {}
c(x, y) {}
static d() {}
get e() {}
set e(v) {}
;
})",
);
} | rust_cleaned_test_functions.jsonl/102603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16833,
368,
341,
262,
1273,
29896,
32981,
445,
1040,
356,
4687,
797,
262,
1273,
29896,
32981,
445,
1040,
356,
2239,
422,
4687,
797,
262,
1273,
29896,
32981,
1006,
286,
330,
1040,
356,
2239,
422,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_segment_postings() {
let mut postings = SegmentPostings::empty();
assert!(!postings.advance());
assert!(!postings.advance());
assert_eq!(postings.len(), 0);
} | rust_cleaned_test_functions.jsonl/275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
28061,
6333,
819,
368,
341,
286,
1077,
5206,
74481,
284,
37103,
4133,
819,
486,
3194,
543,
286,
2060,
0,
3471,
2203,
819,
80889,
1423,
286,
2060,
0,
3471,
2203,
819,
80889,
1423,
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 |
#[test]
fn test_octopus_flash_simulator_iter_10() {
let input: Vec<String> = TEST_LARGE_DATA.iter().map(|s| s.to_string()).collect();
let simulator = OctopusFlashSimulator::new(&input);
let expected = 204;
let result: u32 = simulator.take(10).sum();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/85577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70135,
45870,
30225,
18314,
10511,
11723,
62,
16,
15,
368,
972,
286,
1077,
1946,
25,
11312,
3464,
29,
284,
13602,
83861,
7896,
19471,
1005,
2186,
22428,
82,
91,
274,
2389,
3904,
6011,
17384,
7317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_igmp_integration_fallback_from_idle() {
let mut ctx = setup_simple_test_environment();
ctx.igmp_join_group(DummyLinkDeviceId, GROUP_ADDR);
assert_eq!(ctx.frames().len(), 1);
assert!(ctx.trigger_next_timer());
assert_eq!(ctx.frames().len(), 2);
receive_igmp_query(&mut ctx, Duration::from_secs(10));
// state.
let IgmpGroupState(group_state) =
ctx.get_state_with(DummyLinkDeviceId).get(&GROUP_ADDR).unwrap();
match group_state.get_inner() {
MemberState::Delaying(_) => {}
_ => panic!("Wrong State!"),
}
assert!(ctx.trigger_next_timer());
assert_eq!(ctx.frames().len(), 3);
ensure_ttl_ihl_rtr(&ctx);
} | rust_cleaned_test_functions.jsonl/128909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
343,
1307,
90250,
761,
3420,
5673,
47810,
368,
341,
286,
1077,
5206,
5635,
284,
6505,
30015,
4452,
51774,
543,
286,
5635,
13,
343,
1307,
31017,
6288,
5432,
8574,
3939,
6985,
764,
11,
26870,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_make_gaussian_mechanism_analytic() -> Fallible<()> {
let d_in = 1.;
let d_out = (1., 1e-5);
let scale = 3.730632;
let measurement = make_base_analytic_gaussian::<AllDomain<_>>(scale)?;
let arg = 0.0;
let _ret = measurement.invoke(&arg)?;
assert!(measurement.check(&d_in, &d_out)?);
// to check the more complicated algorithm for finding the analytic gaussian scale
assert!(catastrophic_analytic_check(scale, d_in, d_out));
assert!(!catastrophic_analytic_check(scale - 1e-6, d_in, d_out));
Ok(())
} | rust_cleaned_test_functions.jsonl/55700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
1889,
46972,
717,
4737,
67813,
12008,
5774,
28050,
368,
1464,
14785,
1238,
71698,
341,
286,
1077,
294,
1243,
284,
220,
16,
37403,
286,
1077,
294,
6068,
284,
320,
16,
2572,
220,
16,
68,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_unify_externals() {
let mut test = OsoTest::new();
#[derive(PartialEq, Clone, Debug)]
struct Foo {
x: i64,
}
impl PolarClass for Foo {}
impl Foo {
fn new(x: i64) -> Self {
Self { x }
}
}
let foo_class = ClassBuilder::with_constructor(Foo::new)
.name("Foo")
.add_attribute_getter("x", |this: &Foo| this.x)
.with_equality_check()
.build();
test.oso.register_class(foo_class).unwrap();
test.load_str("foos_equal(a, b) if a = b;");
// Test with instantiated in polar.
test.qeval("foos_equal(new Foo(1), new Foo(1))");
test.qnull("foos_equal(new Foo(1), new Foo(2))");
let a = Foo::new(1);
let b = Foo::new(1);
assert_eq!(a, b);
let mut results = test.oso.query_rule("foos_equal", (a, b)).unwrap();
results.next().expect("At least one result").unwrap();
// Ensure that equality on a type that doesn't support it fails.
struct Bar {
x: i64,
}
impl PolarClass for Bar {}
impl Bar {
fn new(x: i64) -> Self {
Self { x }
}
}
let bar_class = ClassBuilder::with_constructor(Bar::new)
.name("Bar")
.add_attribute_getter("x", |this: &Bar| this.x)
.build();
test.oso.register_class(bar_class).unwrap();
#[derive(PartialEq, Clone, Debug)]
struct Baz {
x: i64,
}
impl PolarClass for Baz {}
impl Baz {
fn new(x: i64) -> Self {
Self { x }
}
}
let baz_class = ClassBuilder::with_constructor(Baz::new)
.name("Baz")
.add_attribute_getter("x", |this: &Baz| this.x)
.with_equality_check()
.build();
test.oso.register_class(baz_class).unwrap();
} | rust_cleaned_test_functions.jsonl/30395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
1437,
62,
4301,
1127,
368,
341,
262,
1077,
5206,
1273,
284,
506,
704,
2271,
486,
931,
1428,
262,
11506,
27098,
5304,
20894,
27312,
11,
27913,
11,
11091,
5563,
262,
2036,
33428,
341,
286,
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_inverse_projection() {
let stereo70 = Proj::new(
"+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000
+ellps=krass +towgs84=33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84 +units=m +no_defs",
)
.unwrap();
let t = stereo70
.project(MyPoint::new(500119.70352012233, 500027.77896348457), true)
.unwrap();
assert_relative_eq!(t.x(), 0.43633200013698786);
assert_relative_eq!(t.y(), 0.8028510000110507);
} | rust_cleaned_test_functions.jsonl/133383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63333,
72738,
368,
341,
286,
1077,
37952,
22,
15,
284,
42952,
486,
931,
1006,
310,
6630,
30386,
28,
267,
67109,
488,
5524,
62,
15,
28,
19,
21,
488,
12212,
62,
15,
28,
17,
20,
488,
74,
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_key_register_rotate() {
let mut key_register = KeyRegister { a: 0b1100, b: 0 };
key_register.rotate();
let a: u64 = 1 << 63;
let b: u64 = 1 << 48;
assert_eq!(a, key_register.a);
assert_eq!(b, key_register.b);
} | rust_cleaned_test_functions.jsonl/23065 | {
"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,
3097,
14000,
60834,
368,
341,
286,
1077,
5206,
1376,
14000,
284,
5309,
8690,
314,
264,
25,
220,
15,
65,
16,
16,
15,
15,
11,
293,
25,
220,
15,
2605,
286,
1376,
14000,
35944,
1428,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prim_list () {
use test_capnp::test_prim_list;
// Make the first segment small to force allocation of a second segment.
let mut message = message::Builder::new(message::HeapAllocator::new().first_segment_words(50));
let mut test_prim_list = message.init_root::<test_prim_list::Builder>();
assert_eq!(test_prim_list.has_bool_list(), false);
assert_eq!(test_prim_list.has_void_list(), false);
{
{
let mut uint8_list = test_prim_list.reborrow().init_uint8_list(100);
for i in 0..uint8_list.len() {
uint8_list.set(i, i as u8);
}
}
{
let mut uint64_list = test_prim_list.reborrow().init_uint64_list(20);
for i in 0..uint64_list.len() {
uint64_list.set(i, i as u64);
}
}
{
let mut bool_list = test_prim_list.reborrow().init_bool_list(65);
bool_list.set(0, true);
bool_list.set(1, true);
bool_list.set(2, true);
bool_list.set(3, true);
bool_list.set(5, true);
bool_list.set(8, true);
bool_list.set(13, true);
bool_list.set(64, true);
assert!(bool_list.get(0));
assert!(!bool_list.get(4));
assert!(!bool_list.get(63));
assert!(bool_list.get(64));
}
let mut void_list = test_prim_list.reborrow().init_void_list(1025);
void_list.set(257, ());
}
assert_eq!(test_prim_list.has_bool_list(), true);
assert_eq!(test_prim_list.has_void_list(), true);
let test_prim_list_reader = test_prim_list.into_reader();
let uint8_list = test_prim_list_reader.get_uint8_list().unwrap();
for i in 0..uint8_list.len() {
assert_eq!(uint8_list.get(i), i as u8);
}
let uint64_list = test_prim_list_reader.get_uint64_list().unwrap();
for i in 0..uint64_list.len() {
assert_eq!(uint64_list.get(i), i as u64);
}
assert_eq!(test_prim_list_reader.has_bool_list(), true);
let bool_list = test_prim_list_reader.get_bool_list().unwrap();
assert!(bool_list.get(0));
assert!(bool_list.get(1));
assert!(bool_list.get(2));
assert!(bool_list.get(3));
assert!(!bool_list.get(4));
assert!(bool_list.get(5));
assert!(!bool_list.get(6));
assert!(!bool_list.get(7));
assert!(bool_list.get(8));
assert!(!bool_list.get(9));
assert!(!bool_list.get(10));
assert!(!bool_list.get(11));
assert!(!bool_list.get(12));
assert!(bool_list.get(13));
assert!(!bool_list.get(63));
assert!(bool_list.get(64));
assert_eq!(test_prim_list_reader.get_void_list().unwrap().len(), 1025);
} | rust_cleaned_test_functions.jsonl/55845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1618
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87419,
2019,
1719,
1476,
286,
990,
1273,
16388,
6199,
486,
1944,
87419,
2019,
401,
286,
442,
7405,
279,
1156,
10238,
2613,
311,
5344,
23757,
315,
264,
2086,
10238,
624,
286,
1077,
5206,
1943,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_try_from_proto_sig_tx_for_json_full_tx() {
let (_keypair, sig_ptx) = new_dummy_signed_ptx();
let json_tx = FullTransaction::try_from_proto(sig_ptx.clone()).unwrap();
let hash = sig_ptx.get_tx_hash();
let content = sig_ptx.get_transaction_with_sig().try_into().unwrap();
assert_eq!(json_tx.hash, H256::from_slice(hash));
assert_eq!(json_tx.content, Data::new(content));
} | rust_cleaned_test_functions.jsonl/122969 | {
"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,
53283,
5673,
37689,
29252,
17805,
5478,
9455,
16372,
17805,
368,
341,
286,
1077,
5453,
792,
12670,
11,
8366,
20124,
87,
8,
284,
501,
60321,
55617,
20124,
87,
543,
286,
1077,
2951,
17805,
284,
8627... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hover_struct_doc_comment() {
check(
r#"
/// bar docs
struct Bar;
fn foo() { let bar = Ba<|>r; }
"#,
expect![[r#"
*Bar*
```rust
test
```
```rust
struct Bar
```
---
bar docs
"#]],
);
} | rust_cleaned_test_functions.jsonl/66135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
15126,
18869,
17638,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
2575,
3619,
26340,
198,
1235,
4716,
401,
8822,
15229,
368,
314,
1077,
3619,
284,
14322,
27,
91,
29,
81,
26,
456,
57676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_metadata() {
let cycles_limit = 1024 * 1024 * 1024;
let caller = Address::from_hex("0x755cdba6ae4f479f7164792b318b2a06c759833b").unwrap();
let context = mock_context(cycles_limit, caller);
let init_metadata = mock_metadata_1();
let mut service = new_metadata_service(init_metadata.clone());
let metadata = service.get_metadata(context.clone());
let expect_metadata = ServiceResponse::from_succeed(init_metadata);
assert_eq!(metadata, expect_metadata);
let update_metadata = mock_metadata_2();
service.update_metadata(context.clone(), UpdateMetadataPayload {
verifier_list: update_metadata.verifier_list.clone(),
interval: update_metadata.interval,
propose_ratio: update_metadata.propose_ratio,
prevote_ratio: update_metadata.prevote_ratio,
precommit_ratio: update_metadata.precommit_ratio,
brake_ratio: update_metadata.brake_ratio,
});
let metadata = service.get_metadata(context);
let expect_metadata = ServiceResponse::from_succeed(update_metadata);
assert_eq!(metadata, expect_metadata);
} | rust_cleaned_test_functions.jsonl/117934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
22220,
368,
341,
262,
1077,
24484,
14763,
284,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
26,
715,
262,
1077,
19865,
284,
9177,
486,
1499,
32655,
445,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_member_role() {
let route = Route::AddMemberRole {
guild_id: GUILD_ID,
role_id: ROLE_ID,
user_id: USER_ID,
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/members/{user_id}/roles/{role_id}",
guild_id = GUILD_ID,
role_id = ROLE_ID,
user_id = USER_ID
)
);
} | rust_cleaned_test_functions.jsonl/119837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
19388,
19792,
368,
341,
286,
1077,
6021,
284,
9572,
486,
2212,
9366,
9030,
341,
310,
26411,
842,
25,
479,
18023,
3450,
345,
310,
3476,
842,
25,
69676,
3450,
345,
310,
1196,
842,
25,
13872,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_utf8_latin1_success() {
let len = if cfg!(miri) { 64 } else { 256 }; // Miri is too slow
let mut src: Vec<u16> = Vec::with_capacity(len);
src.resize(len, 0);
for i in 0..src.len() {
src[i] = i as u16;
}
for i in 0..src.len() {
let s = String::from_utf16(&src[i..]).unwrap();
assert!(is_utf8_latin1(s.as_bytes()));
assert_eq!(
check_utf8_for_latin1_and_bidi(s.as_bytes()),
Latin1Bidi::Latin1
);
}
} | rust_cleaned_test_functions.jsonl/27304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
39453,
23,
907,
14768,
16,
18632,
368,
341,
286,
1077,
2422,
284,
421,
13286,
10297,
19936,
72,
8,
314,
220,
21,
19,
335,
770,
314,
220,
17,
20,
21,
20066,
442,
14268,
72,
374,
2238,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_types_repeated() {
let mut message = TestTypesRepeated::new();
message.set_double_field([19f64, 20f64].to_vec());
message.set_float_field([20f32].to_vec());
message.set_int32_field([21i32, -22, 23].to_vec());
message.set_int64_field([22i64].to_vec());
message.set_uint32_field([23u32, 24].to_vec());
message.set_uint64_field([24u64].to_vec());
message.set_sint32_field([25i32].to_vec());
message.set_sint64_field([26i64, -27].to_vec());
message.set_fixed32_field([27u32].to_vec());
message.set_fixed64_field([28u64].to_vec());
message.set_sfixed32_field([29i32, -30].to_vec());
message.set_sfixed64_field([30i64].to_vec());
message.set_bool_field([true, true].to_vec());
message.set_string_field(vec!["thirty two".to_string(), "thirty three".to_string()]);
message.set_bytes_field(vec![[33u8, 34].to_vec(), [35u8].to_vec()]);
message.set_enum_field(
[
TestEnumDescriptor::BLUE.into(),
TestEnumDescriptor::GREEN.into(),
]
.to_vec(),
);
test_serialize_deserialize_no_hex_with_dynamic(&message);
} | rust_cleaned_test_functions.jsonl/2712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9763,
1288,
41954,
368,
341,
262,
1077,
5206,
1943,
284,
3393,
4173,
90989,
486,
931,
543,
262,
1943,
980,
24598,
5013,
2561,
16,
24,
69,
21,
19,
11,
220,
17,
15,
69,
21,
19,
936,
983,
13251... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_equiv() {
let s0 = Atom::from_slice("div");
assert!(s0.equiv(&atom::Div));
let s1 = Atom::from_slice("Div");
assert!(!s1.equiv(&atom::Div));
} | rust_cleaned_test_functions.jsonl/15252 | {
"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,
71849,
368,
341,
286,
1077,
274,
15,
284,
39516,
486,
1499,
26488,
445,
611,
797,
286,
2060,
10297,
82,
15,
1734,
15418,
2099,
21855,
486,
12509,
3237,
286,
1077,
274,
16,
284,
39516,
486,
1499,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_list_with_cross_deps_and_namespaces() {
init();
let schema_a_str = r#"{
"name": "A",
"type": "record",
"namespace": "namespace",
"fields": [
{"name": "field_one", "type": "float"}
]
}"#;
let schema_b_str = r#"{
"name": "B",
"type": "record",
"fields": [
{"name": "field_one", "type": "namespace.A"}
]
}"#;
let schemas_first = Schema::parse_list(&[schema_a_str, schema_b_str]).expect("Test failed");
let schemas_second = Schema::parse_list(&[schema_b_str, schema_a_str]).expect("Test failed");
assert_eq!(schemas_first[0], schemas_second[1]);
assert_eq!(schemas_first[1], schemas_second[0]);
} | rust_cleaned_test_functions.jsonl/69028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
2019,
6615,
35284,
76489,
8378,
9187,
27338,
368,
341,
262,
2930,
543,
262,
1077,
10802,
4306,
2895,
284,
435,
55543,
515,
286,
330,
606,
788,
330,
32,
756,
286,
330,
1313,
788,
330,
8548... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_param() -> Result<()> {
let db = checked_memory_handle()?;
let result: Result<bool> = db.query_row("SELECT 1 WHERE ? BETWEEN datetime('now', '-1 minute') AND datetime('now', '+1 minute')", [OffsetDateTime::now_utc()], |r| r.get(0));
assert!(result.is_ok());
Ok(())
} | rust_cleaned_test_functions.jsonl/94396 | {
"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,
4090,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
94136,
286,
1077,
1102,
25,
5714,
17028,
29,
284,
2927,
4786,
8530,
445,
4858,
220,
16,
5288,
937,
56639,
8874,
492,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_relu_activation() {
fn f(x: f32, alpha: Option<f32>, max_value: Option<f32>, threshold: Option<f32>) -> f32 {
let t = match threshold {
None => 0.0,
Some(v) => v,
};
let a = match alpha {
None => 0.0,
Some(v) => v,
};
let result = if x > t { x } else { a * (x - t) };
match max_value {
None => result,
Some(m) => {
if x > m {
m
} else {
result
}
}
}
}
let mut alpha = Some(0.0);
let mut max_value = None;
let mut threshold = Some(0.0);
let mut activation = Activation::ReLu {
alpha,
max_value,
threshold,
};
assert_eq!(
activation.calculate_value(&array![[0.0]]).unwrap(),
&array![[f(0.0, alpha, max_value, threshold)]]
);
assert_eq!(
activation.calculate_value(&array![[0.0, 1.0]]).unwrap(),
&array![[
f(0.0, alpha, max_value, threshold),
f(1.0, alpha, max_value, threshold)
]]
);
assert_eq!(
activation.calculate_value(&array![[0.0], [1.0]]).unwrap(),
&array![
[f(0.0, alpha, max_value, threshold)],
[f(1.0, alpha, max_value, threshold)]
]
);
assert_eq!(
activation
.calculate_value(&array![[0.0, 1.0], [2.0, 3.0]])
.unwrap(),
&array![
[
f(0.0, alpha, max_value, threshold),
f(1.0, alpha, max_value, threshold)
],
[
f(2.0, alpha, max_value, threshold),
f(3.0, alpha, max_value, threshold)
]
]
);
alpha = Some(0.001);
max_value = Some(1.0);
threshold = Some(0.0);
activation = Activation::ReLu {
alpha,
max_value,
threshold,
};
assert_eq!(
activation.calculate_value(&array![[0.0]]).unwrap(),
&array![[f(0.0, alpha, max_value, threshold)]]
);
assert_eq!(
activation.calculate_value(&array![[0.0, 1.0]]).unwrap(),
&array![[
f(0.0, alpha, max_value, threshold),
f(1.0, alpha, max_value, threshold)
]]
);
assert_eq!(
activation.calculate_value(&array![[0.0], [1.0]]).unwrap(),
&array![
[f(0.0, alpha, max_value, threshold)],
[f(1.0, alpha, max_value, threshold)]
]
);
assert_eq!(
activation
.calculate_value(&array![[0.0, 1.0], [2.0, 3.0]])
.unwrap(),
&array![
[
f(0.0, alpha, max_value, threshold),
f(1.0, alpha, max_value, threshold)
],
[
f(2.0, alpha, max_value, threshold),
f(3.0, alpha, max_value, threshold)
]
]
);
} | rust_cleaned_test_functions.jsonl/65371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76282,
52404,
368,
341,
286,
5168,
282,
2075,
25,
282,
18,
17,
11,
8287,
25,
6959,
63895,
18,
17,
8066,
1932,
3142,
25,
6959,
63895,
18,
17,
8066,
12171,
25,
6959,
63895,
18,
17,
9231,
1464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_get_index_0() {
let h = Histogram::configure()
.max_value(32)
.precision(3)
.build()
.unwrap();
// all values should index directly to value
// no estimated buckets are needed given the precision and max
for i in 0..32 {
assert_eq!(h.get_index(i), Some(i as usize));
assert_eq!(h.index_value(i as usize), i);
}
} | rust_cleaned_test_functions.jsonl/82151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3560,
62,
15,
368,
341,
286,
1077,
305,
284,
82138,
486,
21002,
741,
310,
659,
2810,
3142,
7,
18,
17,
340,
310,
659,
27182,
7,
18,
340,
310,
659,
5834,
741,
310,
659,
15454,
1428,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_update_timestamp() {
let mut crds = Crds::default();
let val = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::default(),
0,
)));
assert_eq!(crds.insert(val.clone(), 0), Ok(()));
assert_eq!(crds.table[&val.label()].ordinal, 0);
let val2 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::default()));
let value_hash = hash(&serialize(&val2).unwrap());
assert_eq!(val2.label().pubkey(), val.label().pubkey());
assert_eq!(crds.insert(val2.clone(), 0), Ok(()));
crds.update_record_timestamp(&val.label().pubkey(), 2);
assert_eq!(crds.table[&val.label()].local_timestamp, 2);
assert_eq!(crds.table[&val.label()].ordinal, 1);
assert_eq!(crds.table[&val2.label()].local_timestamp, 2);
assert_eq!(crds.table[&val2.label()].ordinal, 1);
crds.update_record_timestamp(&val.label().pubkey(), 1);
assert_eq!(crds.table[&val.label()].local_timestamp, 2);
assert_eq!(crds.table[&val.label()].ordinal, 1);
let mut ci = ContactInfo::default();
ci.wallclock += 1;
let val3 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ci));
assert_eq!(crds.insert(val3, 3), Ok(()));
assert_eq!(*crds.purged.back().unwrap(), (value_hash, 3));
assert_eq!(crds.table[&val2.label()].local_timestamp, 3);
assert_eq!(crds.table[&val2.label()].ordinal, 2);
} | rust_cleaned_test_functions.jsonl/10450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 724
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
23073,
368,
341,
286,
1077,
5206,
1560,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
1044,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
1731,
99102,
1731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_field_length_json() {
let field_length_src = HashMap::<_, _>::from_iter(IntoIter::new([
(1, HashMap::<_, _>::from_iter(IntoIter::new([(1, 4)]))),
(
3,
HashMap::<_, _>::from_iter(IntoIter::new([(1, 5), (2, 6)])),
),
]));
let json = field_length_json(field_length_src);
assert_tokens(
&json,
&[
Token::Map { len: Some(2) },
Token::Str("1"),
Token::Map { len: Some(1) },
Token::Str("1"),
Token::U64(4),
Token::MapEnd,
Token::Str("3"),
Token::Map { len: Some(2) },
Token::Str("1"),
Token::U64(5),
Token::Str("2"),
Token::U64(6),
Token::MapEnd,
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/112249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
5118,
9455,
368,
341,
286,
1077,
2070,
5118,
16274,
284,
10528,
27638,
6878,
716,
6831,
1499,
11723,
24123,
78,
8537,
486,
931,
8956,
310,
320,
16,
11,
10528,
27638,
6878,
716,
6831,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_static_balance_many() {
let rng = &Rc::new(RefCell::new(StdRng::seed_from_u64(56789)));
let mut presets = Vec::new();
for _ in 0..200 {
if rng.borrow_mut().gen_bool(0.2) {
presets.push(rand(rng.borrow_mut().gen_range(1, 10), 1..20, rng));
} else {
let mut rng = rng.borrow_mut();
presets.push(exact(rng.gen_range(1, 20), rng.gen_range(10, 20)));
}
}
perform_test(&presets, 500000);
} | rust_cleaned_test_functions.jsonl/111069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25360,
29396,
22101,
368,
341,
262,
1077,
28422,
284,
609,
49,
66,
486,
931,
7,
3945,
3599,
486,
931,
7,
22748,
49,
968,
486,
22602,
5673,
7300,
21,
19,
7,
20,
21,
22,
23,
24,
22525,
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... | 3 |
#[test]
fn test_two_pairs_beats_one_pair() {
test(
&vec!["2S 8H 6S 8D JH", "4S 5H 4C 8C 5C"],
&vec!["4S 5H 4C 8C 5C"],
)
} | rust_cleaned_test_functions.jsonl/121264 | {
"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,
23241,
36430,
21263,
1862,
11667,
14445,
368,
341,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
17,
50,
220,
23,
39,
220,
21,
50,
220,
23,
35,
619,
39,
497,
330,
19,
50,
220,
20,
39,
220,
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_from_static_std() {
let a = HeaderName {
inner: Repr::Standard(Vary),
};
let b = HeaderName::from_static("vary");
assert_eq!(a, b);
let b = HeaderName::from_static("vaary");
assert_ne!(a, b);
} | rust_cleaned_test_functions.jsonl/3407 | {
"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,
5673,
25360,
15656,
368,
341,
286,
1077,
264,
284,
12104,
675,
341,
310,
9179,
25,
1032,
649,
486,
19781,
12410,
658,
1326,
286,
3634,
286,
1077,
293,
284,
12104,
675,
486,
1499,
25360,
445,
829... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unchanged_ranges_non_unique_added() {
assert_eq!(
unchanged_ranges(
b"a b a c",
b"a a a a",
&[0..1, 2..3, 4..5, 6..7],
&[0..1, 2..3, 4..5, 6..7],
),
vec![(0..1, 0..1), (4..5, 2..3)]
);
} | rust_cleaned_test_functions.jsonl/89251 | {
"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,
62,
3185,
3726,
58748,
21637,
21218,
37653,
368,
341,
286,
2060,
10714,
33673,
310,
34857,
58748,
1006,
394,
293,
56693,
293,
264,
272,
756,
394,
293,
56693,
264,
264,
264,
756,
394,
44590,
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_list_tests() -> Result<()> {
set_rustflags();
let test_filter = TestFilterBuilder::any(RunIgnored::Default);
let test_list = FIXTURE_TARGETS.make_test_list(&test_filter, &TargetRunner::empty());
let mut summary = test_list.to_summary();
for (name, expected) in &*EXPECTED_TESTS {
let test_binary = FIXTURE_TARGETS
.test_artifacts
.get(*name)
.unwrap_or_else(|| panic!("unexpected test name {}", name));
let info = summary
.rust_suites
.remove(&test_binary.binary_id)
.unwrap_or_else(|| panic!("test list not found for {}", test_binary.binary_path));
let tests: Vec<_> = info
.testcases
.iter()
.map(|(name, info)| (name.as_str(), info.filter_match))
.collect();
assert_eq!(expected, &tests, "test list matches");
}
// Are there any remaining tests?
if !summary.rust_suites.is_empty() {
let mut err_msg = "actual output has test suites missing in expected output:\n".to_owned();
for missing_suite in summary.rust_suites.keys() {
err_msg.push_str(" - ");
err_msg.push_str(missing_suite);
err_msg.push('\n');
}
panic!("{}", err_msg);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/118813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 618
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
32509,
368,
1464,
5714,
71698,
341,
262,
738,
1710,
590,
11161,
1428,
262,
1077,
1273,
8727,
284,
3393,
5632,
3297,
486,
3767,
2785,
359,
43337,
3018,
486,
3675,
317,
262,
1077,
1273,
2019,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_all_sequentially() {
if std::env::var("CI").is_ok() {
} else {
test_feel_grammar();
test_lalr_c_tables();
test_lalr_rust_tables();
}
} | rust_cleaned_test_functions.jsonl/31377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
3453,
15838,
398,
368,
341,
262,
421,
1460,
486,
3160,
486,
947,
445,
11237,
1827,
285,
19817,
368,
341,
6926,
262,
335,
770,
341,
414,
1273,
7642,
301,
62,
41094,
543,
414,
1273,
907,
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
] | 2 |
#[test]
fn test_parser_get() {
test_parser(
b"GET /path?p1=v1&p2=v2#fragment HTTP/1.1\r\nHost: localhost\r\n\r\n",
&make_request(
"GET",
"/path",
"p1=v1&p2=v2",
"fragment",
&[("host", "localhost")],
None,
),
)
} | rust_cleaned_test_functions.jsonl/100923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
3062,
368,
341,
286,
1273,
18517,
1006,
310,
293,
1,
3806,
608,
2343,
90142,
16,
39254,
16,
96774,
17,
39254,
17,
2,
42202,
10130,
14,
16,
13,
16,
12016,
1699,
9296,
25,
47422,
12016,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_access() {
let obj = json!({
"_": "underscore",
"-": "hyphen",
"*": "asterisk",
"'": "single_quote",
"\"": "double_quote",
"✈": "plane"
});
// Bracket notation
let expr = jsonpath::parse("$['-']").unwrap();
assert_eq!(expr.eval(obj.clone()), vec![json!("hyphen")]);
let expr = jsonpath::parse("$['_']").unwrap();
assert_eq!(expr.eval(obj.clone()), vec![json!("underscore")]);
let expr = jsonpath::parse("$['*']").unwrap();
assert_eq!(expr.eval(obj.clone()), vec![json!("asterisk")]);
let expr = jsonpath::parse("$['\\'']").unwrap();
assert_eq!(expr.eval(obj.clone()), vec![json!("single_quote")]);
let expr = jsonpath::parse("$['\"']").unwrap();
assert_eq!(expr.eval(obj.clone()), vec![json!("double_quote")]);
let expr = jsonpath::parse("$['✈']").unwrap();
assert_eq!(expr.eval(obj.clone()), vec![json!("plane")]);
// Dot notation
let expr = jsonpath::parse("$._").unwrap();
assert_eq!(expr.eval(obj.clone()), vec![json!("underscore")]);
// Asterisk
// return all elements
// There is no ordering in JSON keys
// You must compare with their string values sorted
let values = vec![
"asterisk",
"double_quote",
"hyphen",
"plane",
"single_quote",
"underscore",
];
let expr = jsonpath::parse("$.*").unwrap();
let results = expr.eval(obj.clone());
let mut results = results
.iter()
.map(|e| e.as_str().unwrap())
.collect::<Vec<&str>>();
results.sort_unstable();
assert_eq!(results, values);
let expr = jsonpath::parse("$[*]").unwrap();
let results = expr.eval(obj);
let mut results = results
.iter()
.map(|e| e.as_str().unwrap())
.collect::<Vec<&str>>();
results.sort_unstable();
assert_eq!(results, values);
} | rust_cleaned_test_functions.jsonl/54615 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 843
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
12759,
368,
341,
262,
1077,
2839,
284,
2951,
0,
2262,
286,
9000,
788,
330,
53933,
756,
286,
6523,
788,
330,
8503,
14769,
756,
286,
15630,
788,
330,
2300,
3187,
756,
286,
7178,
788,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pow_mod() {
let q = Scalar::new_modulus(11);
let c = Scalar::new(4);
let a = Scalar::pow_mod(&c, &c, &q);
assert_eq!(a.rep, 3);
} | rust_cleaned_test_functions.jsonl/1931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
7480,
368,
341,
286,
1077,
2804,
284,
35176,
486,
931,
7480,
19425,
7,
16,
16,
317,
286,
1077,
272,
284,
35176,
486,
931,
7,
19,
317,
286,
1077,
264,
284,
35176,
486,
21743,
7480,
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 |
#[test]
fn test_raw_string_hello() {
let mut reader = Reader::init("```Hello World!```");
assert_eq!(
raw_string(&mut reader).unwrap(),
RawString {
newline: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 4, 1, 4),
},
value: Template {
quotes: false,
elements: vec![TemplateElement::String {
value: "Hello World!".to_string(),
encoded: "Hello World!".to_string(),
}],
source_info: SourceInfo::init(1, 4, 1, 16),
},
}
);
let mut reader = Reader::init("```Hello\nWorld!\n```");
assert_eq!(
raw_string(&mut reader).unwrap(),
RawString {
newline: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 4, 1, 4),
},
value: Template {
quotes: false,
elements: vec![TemplateElement::String {
value: "Hello\nWorld!\n".to_string(),
encoded: "Hello\nWorld!\n".to_string(),
}],
source_info: SourceInfo::init(1, 4, 3, 1),
},
}
);
} | rust_cleaned_test_functions.jsonl/119582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 874
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
3904,
96724,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
73594,
9707,
4337,
0,
73594,
797,
286,
2060,
10714,
33673,
310,
7112,
3904,
2099,
6984,
6604,
568,
15454,
3148,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_precedence() {
use Expr::*;
let syntax = Syntax::default();
assert_eq!(
super::parse("{{ a + b == c }}", &syntax).unwrap(),
vec![Node::Expr(
Ws(false, false),
BinOp(
"==",
BinOp("+", Var("a").into(), Var("b").into()).into(),
Var("c").into(),
)
)],
);
assert_eq!(
super::parse("{{ a + b * c - d / e }}", &syntax).unwrap(),
vec![Node::Expr(
Ws(false, false),
BinOp(
"-",
BinOp(
"+",
Var("a").into(),
BinOp("*", Var("b").into(), Var("c").into()).into(),
)
.into(),
BinOp("/", Var("d").into(), Var("e").into()).into(),
)
)],
);
assert_eq!(
super::parse("{{ a * (b + c) / -d }}", &syntax).unwrap(),
vec![Node::Expr(
Ws(false, false),
BinOp(
"/",
BinOp(
"*",
Var("a").into(),
Group(BinOp("+", Var("b").into(), Var("c").into()).into()).into()
)
.into(),
Unary("-", Var("d").into()).into()
)
)],
);
assert_eq!(
super::parse("{{ a || b && c || d && e }}", &syntax).unwrap(),
vec![Node::Expr(
Ws(false, false),
BinOp(
"||",
BinOp(
"||",
Var("a").into(),
BinOp("&&", Var("b").into(), Var("c").into()).into(),
)
.into(),
BinOp("&&", Var("d").into(), Var("e").into()).into(),
)
)],
);
} | rust_cleaned_test_functions.jsonl/50228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
1998,
763,
368,
341,
286,
990,
28819,
56162,
286,
1077,
19482,
284,
32117,
486,
2258,
543,
286,
2060,
10714,
33673,
310,
2256,
486,
6400,
445,
2979,
264,
488,
293,
621,
272,
3869,
497,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_domain_element() {
let rng = &mut XorShiftRng::from_seed(TEST_SEED);
for _ in 0..100 {
let random_el: DefaultTreeDomain = Fr::random(rng).into();
let mut randomness = [0u8; 32];
randomness.copy_from_slice(AsRef::<[u8]>::as_ref(&random_el));
let back: DefaultTreeDomain =
as_safe_commitment(&randomness, "test").expect("failed to get domain from randomness");
assert_eq!(back, random_el);
}
} | rust_cleaned_test_functions.jsonl/58646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
20111,
7894,
368,
341,
262,
1077,
28422,
284,
609,
6984,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
50320,
3620,
1479,
626,
262,
369,
716,
304,
220,
15,
496,
16,
15,
15,
341,
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... | 2 |
#[test]
fn test_new_clears_program_and_variables() {
Tester::default()
.set_program(Some("previous.bas"), "some stuff")
.run("a = 3: NEW")
.expect_clear()
.check();
} | rust_cleaned_test_functions.jsonl/112750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
21811,
82,
25096,
8378,
28182,
368,
341,
286,
76816,
486,
2258,
741,
310,
659,
746,
25096,
65405,
445,
19702,
948,
300,
3975,
330,
14689,
6259,
1138,
310,
659,
6108,
445,
64,
284,
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 |
#[test]
fn test_categorize() {
let config = create_test_config();
let categorizer = FileCategorizer::from_config(&config);
assert_eq!(
categorizer
.categorize(&PathBuf::from("src/js/a.js"))
.unwrap(),
FileGroup::Source {
source_set: SourceSet::SourceSetName("public".intern()),
},
);
assert_eq!(
categorizer
.categorize(&PathBuf::from("src/js/nested/b.js"))
.unwrap(),
FileGroup::Source {
source_set: SourceSet::SourceSetName("public".intern()),
},
);
assert_eq!(
categorizer
.categorize(&PathBuf::from("src/js/internal/nested/c.js"))
.unwrap(),
FileGroup::Source {
source_set: SourceSet::SourceSetName("internal".intern()),
},
);
assert_eq!(
// even if it has same dirname in path as custom output folder.
// Path is only categorized as generated if it matches the absolute path
// of the provided custom output.
categorizer
.categorize(&PathBuf::from("src/custom/custom-generated/c.js"))
.unwrap(),
FileGroup::Source {
source_set: SourceSet::SourceSetName("with_custom_generated_dir".intern()),
},
);
assert_eq!(
categorizer
.categorize(&PathBuf::from("src/js/internal/nested/__generated__/c.js"))
.unwrap(),
FileGroup::Generated {
project_name: "internal".intern()
},
);
assert_eq!(
categorizer
.categorize(&PathBuf::from("graphql/custom-generated/c.js"))
.unwrap(),
FileGroup::Generated {
project_name: "with_custom_generated_dir".intern()
},
);
assert_eq!(
categorizer
.categorize(&PathBuf::from("graphql/public.graphql"))
.unwrap(),
FileGroup::Schema {
project_set: ProjectSet::ProjectName("public".intern())
},
);
assert_eq!(
categorizer
.categorize(&PathBuf::from("graphql/__generated__/internal.graphql"))
.unwrap(),
FileGroup::Schema {
project_set: ProjectSet::ProjectName("internal".intern())
},
);
assert_eq!(
categorizer
.categorize(&PathBuf::from("src/typescript/a.ts"))
.unwrap(),
FileGroup::Source {
source_set: SourceSet::SourceSetName("typescript".intern()),
},
);
} | rust_cleaned_test_functions.jsonl/118300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
7593,
551,
368,
341,
286,
1077,
2193,
284,
1855,
4452,
5332,
543,
286,
1077,
22049,
3135,
284,
2887,
34,
7593,
3135,
486,
1499,
5332,
2099,
1676,
626,
286,
2060,
10714,
33673,
310,
22049,
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_set_account_type() {
// account with buffer big enough for AccountType and Extension
let mut buffer = TEST_ACCOUNT_SLICE.to_vec();
let needed_len =
ExtensionType::get_account_len::<Account>(&[ExtensionType::ImmutableOwner])
- buffer.len();
buffer.append(&mut vec![0; needed_len]);
let err = StateWithExtensionsMut::<Account>::unpack(&mut buffer).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
set_account_type::<Account>(&mut buffer).unwrap();
// unpack is viable after manual set_account_type
let mut state = StateWithExtensionsMut::<Account>::unpack(&mut buffer).unwrap();
assert_eq!(state.base, TEST_ACCOUNT);
assert_eq!(state.account_type[0], AccountType::Account as u8);
state.init_extension::<ImmutableOwner>(true).unwrap(); // just confirming initialization works
// account with buffer big enough for AccountType only
let mut buffer = TEST_ACCOUNT_SLICE.to_vec();
buffer.append(&mut vec![0; 2]);
let err = StateWithExtensionsMut::<Account>::unpack(&mut buffer).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
set_account_type::<Account>(&mut buffer).unwrap();
// unpack is viable after manual set_account_type
let state = StateWithExtensionsMut::<Account>::unpack(&mut buffer).unwrap();
assert_eq!(state.base, TEST_ACCOUNT);
assert_eq!(state.account_type[0], AccountType::Account as u8);
// account with AccountType already set => noop
let mut buffer = TEST_ACCOUNT_SLICE.to_vec();
buffer.append(&mut vec![2, 0]);
let _ = StateWithExtensionsMut::<Account>::unpack(&mut buffer).unwrap();
set_account_type::<Account>(&mut buffer).unwrap();
let state = StateWithExtensionsMut::<Account>::unpack(&mut buffer).unwrap();
assert_eq!(state.base, TEST_ACCOUNT);
assert_eq!(state.account_type[0], AccountType::Account as u8);
// account with wrong AccountType fails
let mut buffer = TEST_ACCOUNT_SLICE.to_vec();
buffer.append(&mut vec![1, 0]);
let err = StateWithExtensionsMut::<Account>::unpack(&mut buffer).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
let err = set_account_type::<Account>(&mut buffer).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
// mint with buffer big enough for AccountType and Extension
let mut buffer = TEST_MINT_SLICE.to_vec();
let needed_len =
ExtensionType::get_account_len::<Mint>(&[ExtensionType::MintCloseAuthority])
- buffer.len();
buffer.append(&mut vec![0; needed_len]);
let err = StateWithExtensionsMut::<Mint>::unpack(&mut buffer).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
set_account_type::<Mint>(&mut buffer).unwrap();
// unpack is viable after manual set_account_type
let mut state = StateWithExtensionsMut::<Mint>::unpack(&mut buffer).unwrap();
assert_eq!(state.base, TEST_MINT);
assert_eq!(state.account_type[0], AccountType::Mint as u8);
state.init_extension::<MintCloseAuthority>(true).unwrap();
// mint with buffer big enough for AccountType only
let mut buffer = TEST_MINT_SLICE.to_vec();
buffer.append(&mut vec![0; Account::LEN - Mint::LEN]);
buffer.append(&mut vec![0; 2]);
let err = StateWithExtensionsMut::<Mint>::unpack(&mut buffer).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
set_account_type::<Mint>(&mut buffer).unwrap();
// unpack is viable after manual set_account_type
let state = StateWithExtensionsMut::<Mint>::unpack(&mut buffer).unwrap();
assert_eq!(state.base, TEST_MINT);
assert_eq!(state.account_type[0], AccountType::Mint as u8);
// mint with AccountType already set => noop
let mut buffer = TEST_MINT_SLICE.to_vec();
buffer.append(&mut vec![0; Account::LEN - Mint::LEN]);
buffer.append(&mut vec![1, 0]);
set_account_type::<Mint>(&mut buffer).unwrap();
let state = StateWithExtensionsMut::<Mint>::unpack(&mut buffer).unwrap();
assert_eq!(state.base, TEST_MINT);
assert_eq!(state.account_type[0], AccountType::Mint as u8);
// mint with wrong AccountType fails
let mut buffer = TEST_MINT_SLICE.to_vec();
buffer.append(&mut vec![0; Account::LEN - Mint::LEN]);
buffer.append(&mut vec![2, 0]);
let err = StateWithExtensionsMut::<Mint>::unpack(&mut buffer).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
let err = set_account_type::<Mint>(&mut buffer).unwrap_err();
assert_eq!(err, ProgramError::InvalidAccountData);
} | rust_cleaned_test_functions.jsonl/90547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1983
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
13500,
1819,
368,
341,
286,
442,
2692,
448,
4147,
2409,
3322,
369,
8615,
929,
323,
26473,
198,
286,
1077,
5206,
4147,
284,
13602,
38831,
25622,
5487,
2389,
13251,
543,
286,
1077,
4362,
6043,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generator_correctness() {
let mut output = [0; 100];
let expected = [ 82, 254, 233, 139, 254, 85, 6, 222, 222, 149,
120, 35, 173, 71, 89, 232, 51, 182, 252, 139,
153, 153, 111, 30, 16, 7, 124, 185, 159, 24,
50, 68, 236, 107, 133, 18, 217, 219, 46, 134,
169, 156, 211, 74, 163, 17, 100, 173, 26, 70,
246, 193, 57, 164, 167, 175, 233, 220, 160, 114,
2, 200, 215, 80, 207, 218, 85, 58, 235, 117,
177, 223, 87, 192, 50, 251, 61, 65, 141, 100,
59, 228, 23, 215, 58, 107, 248, 248, 103, 57,
127, 31, 241, 91, 230, 33, 0, 164, 77, 46];
let mut f: Fortuna = SeedableRng::from_seed(&[1, 2, 3, 4][..]);
f.fill_bytes(&mut output);
assert_eq!(&expected[..], &output[..]);
let mut scratch = [0; (1 << 20)];
f.generator.generate_random_data(&mut scratch);
let expected = [122, 164, 26, 67, 102, 65, 30, 217, 219, 113,
14, 86, 214, 146, 185, 17, 107, 135, 183, 7,
18, 162, 126, 206, 46, 38, 54, 172, 248, 194,
118, 84, 162, 146, 83, 156, 152, 96, 192, 15,
23, 224, 113, 76, 21, 8, 226, 41, 161, 171,
197, 180, 138, 236, 126, 137, 101, 25, 219, 225,
3, 189, 16, 242, 33, 91, 34, 27, 8, 171,
171, 115, 157, 109, 248, 198, 227, 18, 204, 211,
42, 184, 92, 42, 171, 222, 198, 117, 162, 134,
116, 109, 77, 195, 187, 139, 37, 78, 224, 63];
f.fill_bytes(&mut output);
assert_eq!(&expected[..], &output[..]);
f.reseed(&[5]);
let expected = [217, 168, 141, 167, 46, 9, 218, 188, 98, 124,
109, 128, 242, 22, 189, 120, 180, 124, 15, 192,
116, 149, 211, 136, 253, 132, 60, 3, 29, 250,
95, 66, 133, 195, 37, 78, 242, 255, 160, 209,
185, 106, 68, 105, 83, 145, 165, 72, 179, 167,
53, 254, 183, 251, 128, 69, 78, 156, 219, 26,
124, 202, 35, 9, 174, 167, 41, 128, 184, 25,
2, 1, 63, 142, 205, 162, 69, 68, 207, 251,
101, 10, 29, 33, 133, 87, 189, 36, 229, 56,
17, 100, 138, 49, 79, 239, 210, 189, 141, 46];
f.fill_bytes(&mut output);
assert_eq!(&expected[..], &output[..]);
} | rust_cleaned_test_functions.jsonl/19708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1673
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25813,
31550,
2090,
368,
341,
286,
1077,
5206,
2550,
284,
508,
15,
26,
220,
16,
15,
15,
935,
1789,
286,
1077,
3601,
284,
508,
220,
23,
17,
11,
220,
17,
20,
19,
11,
220,
17,
18,
18,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_code_cache() {
let (_temp_dir, deno_dir) = test_setup();
let filename = "hello.js";
let source_code = "1+2";
let output_code = "1+2 // output code";
let source_map = "{}";
let (cache_path, source_map_path) =
deno_dir.cache_path(filename, source_code);
assert!(
cache_path.ends_with("gen/e8e3ee6bee4aef2ec63f6ec3db7fc5fdfae910ae.js")
);
assert!(
source_map_path
.ends_with("gen/e8e3ee6bee4aef2ec63f6ec3db7fc5fdfae910ae.js.map")
);
let r = deno_dir.code_cache(filename, source_code, output_code, source_map);
r.expect("code_cache error");
assert!(cache_path.exists());
assert_eq!(output_code, fs::read_to_string(&cache_path).unwrap());
} | rust_cleaned_test_functions.jsonl/72740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4136,
11529,
368,
341,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
262,
1077,
3899,
284,
330,
14990,
2857,
876,
262,
1077,
2530,
4136,
284,
330,
16,
10,
17,
876... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_indentation_equality() {
let four_spaces = YamlLoader::load_from_str(
r#"
hash:
with:
indentations
"#,
)
.unwrap()
.into_iter()
.next()
.unwrap();
let two_spaces = YamlLoader::load_from_str(
r#"
hash:
with:
indentations
"#,
)
.unwrap()
.into_iter()
.next()
.unwrap();
let one_space = YamlLoader::load_from_str(
r#"
hash:
with:
indentations
"#,
)
.unwrap()
.into_iter()
.next()
.unwrap();
let mixed_spaces = YamlLoader::load_from_str(
r#"
hash:
with:
indentations
"#,
)
.unwrap()
.into_iter()
.next()
.unwrap();
assert_eq!(four_spaces, two_spaces);
assert_eq!(two_spaces, one_space);
assert_eq!(four_spaces, mixed_spaces);
} | rust_cleaned_test_functions.jsonl/1214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69045,
367,
2204,
10473,
368,
341,
286,
1077,
3040,
67883,
284,
809,
9467,
9181,
486,
1078,
5673,
2895,
1006,
310,
435,
2,
698,
8296,
510,
262,
448,
510,
286,
17504,
804,
198,
57676,
345,
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_add_client_multiple_times() {
let mut client_map: Map = Default::default();
assert!(add_client(&mut client_map, addr(1)).is_ok());
let result = add_client(&mut client_map, addr(1));
assert!(result.is_err());
assert_eq!(format!("{}", result.unwrap_err()), "client already exists in map");
} | rust_cleaned_test_functions.jsonl/90495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
8179,
45233,
22353,
368,
341,
286,
1077,
5206,
2943,
5376,
25,
5027,
284,
7899,
486,
2258,
543,
286,
2060,
10297,
718,
8179,
2099,
6984,
2943,
5376,
11,
10789,
7,
16,
4579,
285,
19817,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duplicate_tx() {
let (mut testkit, api) = init_testkit();
let tx = inc_count(&api, 5);
testkit.create_block();
let _: TransactionResponse = api.public(ApiKind::Service("counter"))
.query(&tx)
.post("count")
.unwrap();
let _: TransactionResponse = api.public(ApiKind::Service("counter"))
.query(&tx)
.post("count")
.unwrap();
testkit.create_block();
let counter: u64 = api.public(ApiKind::Service("counter"))
.get("count")
.unwrap();
assert_eq!(counter, 5);
} | rust_cleaned_test_functions.jsonl/86870 | {
"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,
70434,
17805,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
2930,
4452,
8226,
1428,
262,
1077,
9854,
284,
3625,
3180,
2099,
2068,
11,
220,
20,
317,
262,
1273,
8226,
2520,
7113,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_finalize_block_with_justification() {
use client::blockchain::{Backend as BlockChainBackend};
let backend = Backend::<Block>::new_test(10, 10);
let block0 = insert_header(&backend, 0, Default::default(), Default::default(), Default::default());
let _ = insert_header(&backend, 1, block0, Default::default(), Default::default());
let justification = Some(vec![1, 2, 3]);
backend.finalize_block(BlockId::Number(1), justification.clone()).unwrap();
assert_eq!(
backend.blockchain().justification(BlockId::Number(1)).unwrap(),
justification,
);
} | rust_cleaned_test_functions.jsonl/94587 | {
"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,
70616,
7113,
6615,
62,
4250,
2404,
368,
341,
197,
41819,
2943,
486,
4574,
8819,
22964,
29699,
438,
8362,
18837,
29699,
2315,
197,
10217,
19163,
284,
55260,
27638,
4713,
6831,
931,
4452,
7,
16,
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_create_duplicate_fails_no_fees() {
let _setup = SetupLibraryWalletPoolZeroFees::init();
let (did, schema_name, schema_version, data) = prepare_schema_data();
create_and_publish_schema("id", did.clone(), schema_name.clone(), schema_version.clone(), data.clone()).unwrap();
let err = create_and_publish_schema("id_2", did, schema_name, schema_version, data).unwrap_err();
assert_eq!(err.kind(), VcxErrorKind::DuplicationSchema)
} | rust_cleaned_test_functions.jsonl/33236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
70434,
761,
6209,
6536,
761,
5516,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16915,
38259,
10551,
17999,
37,
5516,
486,
2327,
1428,
286,
1077,
320,
22920,
11,
10802,
1269,
11,
10802,
9438... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_logger() {
let mut logger = Logger::new("%% %{User-Agent}i %{X-Test}o %{HOME}e %D test");
let mut headers = HeaderMap::new();
headers.insert(
header::USER_AGENT,
header::HeaderValue::from_static("ACTIX-WEB"),
);
let mut req = HttpRequest::new(
Method::GET,
Uri::from_str("/").unwrap(),
Version::HTTP_11,
headers,
None,
);
let resp = HttpResponse::build(StatusCode::OK)
.header("X-Test", "ttt")
.force_close()
.finish();
match logger.start(&mut req) {
Ok(Started::Done) => (),
_ => panic!(),
};
match logger.finish(&mut req, &resp) {
Finished::Done => (),
_ => panic!(),
}
let entry_time = time::now();
let render = |fmt: &mut Formatter| {
for unit in &logger.format.0 {
unit.render(fmt, &req, &resp, entry_time)?;
}
Ok(())
};
let s = format!("{}", FormatDisplay(&render));
assert!(s.contains("ACTIX-WEB ttt"));
} | rust_cleaned_test_functions.jsonl/109976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 645
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27413,
368,
341,
286,
1077,
5206,
5925,
284,
9514,
486,
931,
445,
2769,
63737,
1474,
45118,
92,
72,
63737,
55,
12,
2271,
92,
78,
63737,
27546,
92,
68,
1018,
35,
1273,
3071,
286,
1077,
5206,
71... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compute_commit() {
assert_eq!(compute_commit(None), None);
assert_eq!(compute_commit(Some("1234567890")), Some(0x1234_5678));
assert_eq!(compute_commit(Some("HEAD")), None);
assert_eq!(compute_commit(Some("garbagein")), None);
} | rust_cleaned_test_functions.jsonl/4096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
36346,
368,
341,
286,
2060,
10714,
10297,
27706,
36346,
26717,
701,
2240,
317,
286,
2060,
10714,
10297,
27706,
36346,
65405,
445,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
35674,
4329,
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_retain_roots_within_one_epoch_range() {
let mut roots = vec![0, 1, 2];
let slots_per_epoch = 2;
AccountsDb::retain_roots_within_one_epoch_range(&mut roots, slots_per_epoch);
assert_eq!(&vec![1, 2], &roots);
} | rust_cleaned_test_functions.jsonl/6934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
466,
26608,
2412,
72385,
11667,
20682,
9698,
368,
341,
286,
1077,
5206,
19703,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
935,
286,
1077,
15711,
5678,
20682,
284,
220,
17,
280,
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_write_ptty_pair() {
let (mut master, mut slave) = open_ptty_pair();
make_raw(slave.as_raw_fd());
let mut buf = [0u8; 5];
master.write_all(b"adios").unwrap();
slave.read_exact(&mut buf).unwrap();
assert_eq!(&buf, b"adios");
let mut master = &master;
master.write_all(b"adios").unwrap();
slave.read_exact(&mut buf).unwrap();
assert_eq!(&buf, b"adios");
} | rust_cleaned_test_functions.jsonl/72581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
20124,
1881,
14445,
368,
341,
262,
1077,
320,
6984,
7341,
11,
5206,
20362,
8,
284,
1787,
20124,
1881,
14445,
543,
262,
1281,
16067,
55691,
523,
5357,
16067,
17676,
5231,
262,
1077,
5206,
660... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bank_forks_ancestors() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new(&genesis_config);
let mut bank_forks = BankForks::new(bank);
let bank0 = bank_forks[0].clone();
let bank = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.insert(bank);
let bank = Bank::new_from_parent(&bank0, &Pubkey::default(), 2);
bank_forks.insert(bank);
let ancestors = bank_forks.ancestors();
assert!(ancestors[&0].is_empty());
let parents: Vec<u64> = ancestors[&1].iter().cloned().collect();
assert_eq!(parents, vec![0]);
let parents: Vec<u64> = ancestors[&2].iter().cloned().collect();
assert_eq!(parents, vec![0]);
} | rust_cleaned_test_functions.jsonl/30578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
761,
73302,
62,
681,
267,
1087,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_key_values_get_coerce() {
use super::Record;
let kvs: &[(&str, &str)] = &[("a", "1"), ("b", "2")];
let record = Record::builder().key_values(&kvs).build();
assert_eq!(
"2",
record
.key_values()
.get("b".into())
.expect("missing key")
.to_borrowed_str()
.expect("invalid value")
);
} | rust_cleaned_test_functions.jsonl/71743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
3097,
9146,
3062,
11393,
25641,
368,
341,
286,
990,
2256,
486,
6471,
401,
286,
1077,
595,
11562,
25,
44590,
2099,
495,
11,
609,
495,
7252,
284,
44590,
445,
64,
497,
330,
16,
3975,
3489,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_traverse_symlinks() {
use std::os::unix::prelude::MetadataExt;
let groups = nix::unistd::getgroups().unwrap();
if groups.len() < 2 {
return;
}
let (first_group, second_group) = (groups[0], groups[1]);
for (args, traverse_first, traverse_second) in [
(&[][..] as &[&str], false, false),
(&["-H"][..], true, false),
(&["-P"][..], false, false),
(&["-L"][..], true, true),
] {
let scenario = TestScenario::new("chgrp");
let (at, mut ucmd) = (scenario.fixtures.clone(), scenario.ucmd());
at.mkdir("dir");
at.mkdir("dir2");
at.touch("dir2/file");
at.mkdir("dir3");
at.touch("dir3/file");
at.symlink_dir("dir2", "dir/dir2_ln");
at.symlink_dir("dir3", "dir3_ln");
scenario
.ccmd("chgrp")
.arg(first_group.to_string())
.arg("dir2/file")
.arg("dir3/file")
.succeeds();
assert!(at.plus("dir2/file").metadata().unwrap().gid() == first_group.as_raw());
assert!(at.plus("dir3/file").metadata().unwrap().gid() == first_group.as_raw());
ucmd.arg("-R")
.args(args)
.arg(second_group.to_string())
.arg("dir")
.arg("dir3_ln")
.succeeds()
.no_stderr();
assert_eq!(
at.plus("dir2/file").metadata().unwrap().gid(),
if traverse_second {
second_group.as_raw()
} else {
first_group.as_raw()
}
);
assert_eq!(
at.plus("dir3/file").metadata().unwrap().gid(),
if traverse_first {
second_group.as_raw()
} else {
first_group.as_raw()
}
);
}
} | rust_cleaned_test_functions.jsonl/49281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1013
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
22439,
58530,
1014,
15504,
368,
341,
262,
990,
1460,
486,
436,
486,
56646,
486,
1726,
52538,
486,
14610,
6756,
280,
262,
1077,
5203,
284,
308,
941,
486,
27483,
486,
455,
16753,
1005,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_repo_branch_only() {
// chained
assert_eq!(git::Repo::new("foo").unwrap().branch_only(true).branch_only_val(), true);
// unchained
let mut repo = git::Repo::new("foo").unwrap();
assert_eq!(repo.branch_only_val(), false);
repo = repo.branch_only(true);
assert_eq!(repo.branch_only_val(), true);
} | rust_cleaned_test_functions.jsonl/114243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37784,
28031,
18410,
368,
341,
286,
442,
66969,
198,
286,
2060,
10714,
10297,
12882,
486,
25243,
486,
931,
445,
7975,
1827,
15454,
1005,
17940,
18410,
3715,
568,
17940,
18410,
6189,
1507,
830,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intersection_zero() {
let left = VecDocSet::from(vec![0]);
let right = VecDocSet::from(vec![0]);
let mut intersection = Intersection::new(vec![left, right]);
assert!(intersection.advance());
assert_eq!(intersection.doc(), 0);
} | rust_cleaned_test_functions.jsonl/57495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82558,
19359,
368,
341,
286,
1077,
2115,
284,
11312,
9550,
1649,
486,
1499,
25592,
20703,
15,
2558,
286,
1077,
1290,
284,
11312,
9550,
1649,
486,
1499,
25592,
20703,
15,
2558,
286,
1077,
5206,
192... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duration_seconds() {
use std::time::Duration;
let zero = Duration::new(0, 0);
let one_second = Duration::new(1, 0);
let half_second = Duration::new(0, 500_000_000);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructIntStrict {
#[serde_as(as = "DurationSeconds")]
value: Duration,
};
is_equal(StructIntStrict { value: zero }, r#"{"value":0}"#);
is_equal(StructIntStrict { value: one_second }, r#"{"value":1}"#);
check_serialization(StructIntStrict { value: half_second }, r#"{"value":1}"#);
check_error_deserialization::<StructIntStrict>(
r#"{"value":"1"}"#,
r#"invalid type: string "1", expected u64 at line 1 column 12"#,
);
check_error_deserialization::<StructIntStrict>(
r#"{"value":-1}"#,
r#"invalid value: integer `-1`, expected u64 at line 1 column 11"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructIntFlexible {
#[serde_as(as = "DurationSeconds<u64, Flexible>")]
value: Duration,
};
is_equal(StructIntFlexible { value: zero }, r#"{"value":0}"#);
is_equal(StructIntFlexible { value: one_second }, r#"{"value":1}"#);
check_serialization(StructIntFlexible { value: half_second }, r#"{"value":1}"#);
check_deserialization(
StructIntFlexible { value: half_second },
r#"{"value":"0.5"}"#,
);
check_deserialization(StructIntFlexible { value: one_second }, r#"{"value":"1"}"#);
check_deserialization(StructIntFlexible { value: zero }, r#"{"value":"0"}"#);
check_error_deserialization::<StructIntFlexible>(
r#"{"value":"a"}"#,
r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 12"#,
);
check_error_deserialization::<StructIntFlexible>(
r#"{"value":-1}"#,
r#"Negative values are not supported for Duration. Found -1 at line 1 column 11"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Structf64Strict {
#[serde_as(as = "DurationSeconds<f64>")]
value: Duration,
};
is_equal(Structf64Strict { value: zero }, r#"{"value":0.0}"#);
is_equal(Structf64Strict { value: one_second }, r#"{"value":1.0}"#);
check_serialization(Structf64Strict { value: half_second }, r#"{"value":1.0}"#);
check_deserialization(Structf64Strict { value: one_second }, r#"{"value":0.5}"#);
check_error_deserialization::<Structf64Strict>(
r#"{"value":"1"}"#,
r#"invalid type: string "1", expected f64 at line 1 column 12"#,
);
check_error_deserialization::<Structf64Strict>(
r#"{"value":-1.0}"#,
r#"underflow when converting float to duration at line 1 column 14"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Structf64Flexible {
#[serde_as(as = "DurationSeconds<f64, Flexible>")]
value: Duration,
};
is_equal(Structf64Flexible { value: zero }, r#"{"value":0.0}"#);
is_equal(Structf64Flexible { value: one_second }, r#"{"value":1.0}"#);
check_serialization(Structf64Flexible { value: half_second }, r#"{"value":1.0}"#);
check_deserialization(
Structf64Flexible { value: half_second },
r#"{"value":"0.5"}"#,
);
check_deserialization(Structf64Flexible { value: one_second }, r#"{"value":"1"}"#);
check_deserialization(Structf64Flexible { value: zero }, r#"{"value":"0"}"#);
check_error_deserialization::<Structf64Flexible>(
r#"{"value":"a"}"#,
r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 12"#,
);
check_error_deserialization::<Structf64Flexible>(
r#"{"value":-1}"#,
r#"Negative values are not supported for Duration. Found -1 at line 1 column 11"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructStringStrict {
#[serde_as(as = "DurationSeconds<String>")]
value: Duration,
};
is_equal(StructStringStrict { value: zero }, r#"{"value":"0"}"#);
is_equal(StructStringStrict { value: one_second }, r#"{"value":"1"}"#);
check_serialization(
StructStringStrict { value: half_second },
r#"{"value":"1"}"#,
);
check_error_deserialization::<StructStringStrict>(
r#"{"value":1}"#,
// TODO the error message should not talk about "json object"
r#"invalid type: integer `1`, expected valid json object at line 1 column 10"#,
);
check_error_deserialization::<StructStringStrict>(
r#"{"value":-1}"#,
r#"invalid type: integer `-1`, expected valid json object at line 1 column 11"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructStringFlexible {
#[serde_as(as = "DurationSeconds<String, Flexible>")]
value: Duration,
};
is_equal(StructStringFlexible { value: zero }, r#"{"value":"0"}"#);
is_equal(
StructStringFlexible { value: one_second },
r#"{"value":"1"}"#,
);
check_serialization(
StructStringFlexible { value: half_second },
r#"{"value":"1"}"#,
);
check_deserialization(
StructStringFlexible { value: half_second },
r#"{"value":"0.5"}"#,
);
check_deserialization(
StructStringFlexible { value: one_second },
r#"{"value":"1"}"#,
);
check_deserialization(StructStringFlexible { value: zero }, r#"{"value":"0"}"#);
check_error_deserialization::<StructStringFlexible>(
r#"{"value":"a"}"#,
r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 12"#,
);
check_error_deserialization::<StructStringFlexible>(
r#"{"value":-1}"#,
r#"Negative values are not supported for Duration. Found -1 at line 1 column 11"#,
);
} | rust_cleaned_test_functions.jsonl/23050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2569
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
34825,
368,
341,
262,
990,
1460,
486,
1678,
486,
12945,
280,
262,
1077,
7168,
284,
21045,
486,
931,
7,
15,
11,
220,
15,
317,
262,
1077,
825,
29644,
284,
21045,
486,
931,
7,
16,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_boundary() {
let mut body: &[u8] = b"--boundary\x00\x00";
let mut reader = BoundaryReader::from_reader(&mut body, "boundary");
reader.consume_boundary().unwrap_err();
} | rust_cleaned_test_functions.jsonl/80595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
54004,
368,
341,
286,
1077,
5206,
2487,
25,
44590,
84,
23,
60,
284,
293,
74757,
65180,
3462,
15,
15,
3462,
15,
15,
876,
286,
1077,
5206,
6604,
284,
76416,
5062,
486,
1499,
22306,
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 |
#[test]
fn test_scope_gen() {
// now we can even deduce the input para type
let mut g = Gn::new_scoped(|mut s| {
let i = s.yield_(0).unwrap();
i * 2
});
assert_eq!(g.raw_send(None), Some(0));
assert_eq!(g.raw_send(Some(3)), Some(6));
assert_eq!(g.raw_send(None), None);
} | rust_cleaned_test_functions.jsonl/91429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23199,
16322,
368,
341,
262,
442,
1431,
582,
646,
1496,
7681,
10521,
279,
1946,
3348,
943,
198,
262,
1077,
5206,
342,
284,
95151,
486,
931,
13171,
16367,
22428,
6984,
274,
91,
341,
286,
1077,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_param_invalid() {
let uuid_str = "c1aa1e3b-9614-4895-9ebd-705255fa5bc2p";
assert!(Uuid::from_param(uuid_str).is_err());
} | rust_cleaned_test_functions.jsonl/1536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
4090,
31433,
368,
341,
286,
1077,
16040,
2895,
284,
330,
66,
16,
5305,
16,
68,
18,
65,
12,
24,
21,
16,
19,
12,
19,
23,
24,
20,
12,
24,
3065,
67,
12,
22,
15,
20,
17,
20,
20,
3632,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unignored_files() {
let seed_names = vec!["simple_file.txt", "foo/.gitignore"];
let temp_dir = TempDir::default();
let files = seed_names.iter().map(|n| Path::new(n)).collect();
let index = test_repo(&temp_dir, &files);
for name in &[
"foo/ignored.txt",
".gitignore",
"bar/always.txt",
"foo/what/why/ignored.txt",
] {
let file = temp_dir.join(name);
fs::create_dir_all(file.parent().unwrap()).unwrap();
fs::write(&file, "ignore*\nalways*").unwrap();
}
let file = temp_dir.join("foo/.gitignore");
fs::write(&file, "!ignore*").unwrap();
let value = WorkTree::diff_against_index(&temp_dir, index).unwrap();
let entries = vec![
StatusEntry {
name: ".gitignore".to_string(),
state: Status::New,
},
StatusEntry {
name: "foo/.gitignore".to_string(),
state: Status::Modified(None),
},
StatusEntry {
name: "foo/ignored.txt".to_string(),
state: Status::New,
},
StatusEntry {
name: "foo/what/".to_string(),
state: Status::New,
},
];
assert_eq!(value.entries, entries);
} | rust_cleaned_test_functions.jsonl/36178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 751
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
58471,
10931,
368,
341,
286,
1077,
10320,
9187,
284,
7486,
0,
1183,
22944,
2458,
3909,
497,
330,
7975,
11930,
12882,
13130,
6332,
286,
1077,
2730,
4334,
284,
19944,
6184,
486,
2258,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_pbkdf2_verify() {
let password = Password::from_slice(&[0u8; 64]).unwrap();
let pbkdf2_dk = hash_password(&password, 100).unwrap();
assert_eq!(
hash_password_verify(&pbkdf2_dk, &password, 100).unwrap(),
true
);
} | rust_cleaned_test_functions.jsonl/101678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31409,
74,
2940,
17,
35638,
368,
341,
298,
10217,
3552,
284,
12362,
486,
1499,
26488,
2099,
58,
15,
84,
23,
26,
220,
21,
19,
10697,
15454,
1428,
298,
10217,
17310,
74,
2940,
17,
814,
74,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_correctness() {
let source_keypair = ElGamalKeypair::new_rand();
let dest_pk = ElGamalKeypair::new_rand().public;
let auditor_pk = ElGamalKeypair::new_rand().public;
// Case 1: transfer 0 amount
// create source account spendable ciphertext
let spendable_balance: u64 = 0;
let spendable_ciphertext = source_keypair.public.encrypt(spendable_balance);
// transfer amount
let transfer_amount: u64 = 0;
// create transfer data
let transfer_data = TransferData::new(
transfer_amount,
(spendable_balance, &spendable_ciphertext),
&source_keypair,
(&dest_pk, &auditor_pk),
)
.unwrap();
assert!(transfer_data.verify().is_ok());
// Case 2: transfer max amount
// create source account spendable ciphertext
let spendable_balance: u64 = u64::max_value();
let spendable_ciphertext = source_keypair.public.encrypt(spendable_balance);
// transfer amount
let transfer_amount: u64 =
(1u64 << (TRANSFER_AMOUNT_LO_BITS + TRANSFER_AMOUNT_HI_BITS)) - 1;
// create transfer data
let transfer_data = TransferData::new(
transfer_amount,
(spendable_balance, &spendable_ciphertext),
&source_keypair,
(&dest_pk, &auditor_pk),
)
.unwrap();
assert!(transfer_data.verify().is_ok());
// Case 3: general success case
// create source account spendable ciphertext
let spendable_balance: u64 = 77;
let spendable_ciphertext = source_keypair.public.encrypt(spendable_balance);
// transfer amount
let transfer_amount: u64 = 55;
// create transfer data
let transfer_data = TransferData::new(
transfer_amount,
(spendable_balance, &spendable_ciphertext),
&source_keypair,
(&dest_pk, &auditor_pk),
)
.unwrap();
assert!(transfer_data.verify().is_ok());
// Case 4: transfer amount too big
// create source account spendable ciphertext
let spendable_balance: u64 = u64::max_value();
let spendable_ciphertext = source_keypair.public.encrypt(spendable_balance);
// transfer amount
let transfer_amount: u64 = 1u64 << (TRANSFER_AMOUNT_LO_BITS + TRANSFER_AMOUNT_HI_BITS);
// create transfer data
let transfer_data = TransferData::new(
transfer_amount,
(spendable_balance, &spendable_ciphertext),
&source_keypair,
(&dest_pk, &auditor_pk),
);
assert!(transfer_data.is_err());
// Case 5: invalid destination or auditor pubkey
let spendable_balance: u64 = 0;
let spendable_ciphertext = source_keypair.public.encrypt(spendable_balance);
let transfer_amount: u64 = 0;
// destination pubkey invalid
let dest_pk = pod::ElGamalPubkey::zeroed().try_into().unwrap();
let auditor_pk = ElGamalKeypair::new_rand().public;
let transfer_data = TransferData::new(
transfer_amount,
(spendable_balance, &spendable_ciphertext),
&source_keypair,
(&dest_pk, &auditor_pk),
)
.unwrap();
assert!(transfer_data.verify().is_err());
// auditor pubkey invalid
let dest_pk = ElGamalKeypair::new_rand().public;
let auditor_pk = pod::ElGamalPubkey::zeroed().try_into().unwrap();
let transfer_data = TransferData::new(
transfer_amount,
(spendable_balance, &spendable_ciphertext),
&source_keypair,
(&dest_pk, &auditor_pk),
)
.unwrap();
assert!(transfer_data.verify().is_err());
} | rust_cleaned_test_functions.jsonl/52095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1783
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
31550,
2090,
368,
341,
1789,
286,
1077,
2530,
3097,
12670,
284,
3984,
78884,
278,
6608,
1082,
1310,
486,
931,
33864,
543,
286,
1077,
3201,
33321,
284,
3984,
78884,
278,
6608,
1082,
1310,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_if() {
let result = Command::new("cargo")
.args(&["run", "-q", "--release", "--", "tests/resources/if/if.lox"])
.output()
.expect("Error while running if/test_if()");
assert_eq!(
str::from_utf8(&result.stdout).unwrap(),
"good\nblock\ntrue\n"
);
assert!(result.status.success());
} | rust_cleaned_test_functions.jsonl/133810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
368,
341,
262,
1077,
1102,
284,
7348,
486,
931,
445,
66715,
1138,
286,
659,
2116,
2099,
1183,
6108,
497,
6523,
80,
497,
14482,
22998,
497,
14482,
497,
330,
23841,
38900,
91183,
91183,
43749... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_keys() {
let mut map: HashMap<Key, Value> = HashMap::new();
let key1 = Key {
key: "a".to_owned(),
key_version: 0,
};
let data = serialize(&"value".to_owned()).expect("serialize");
let value1 = Value {
type_id: "String".to_owned(),
data,
};
let key2 = Key {
key: "b".to_owned(),
key_version: 0,
};
let data = serialize(&1).expect("serialize");
let value2 = Value {
type_id: "i32".to_owned(),
data,
};
let result = map.insert(key1, value1);
assert!(result.is_none());
let result = map.insert(key2, value2);
assert!(result.is_none());
assert_eq!(map.len(), 2);
} | rust_cleaned_test_functions.jsonl/90780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 439
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
12631,
368,
341,
286,
1077,
5206,
2415,
25,
10528,
42003,
11,
5162,
29,
284,
10528,
486,
931,
543,
286,
1077,
1376,
16,
284,
5309,
341,
310,
1376,
25,
330,
64,
3263,
983,
51973,
3148,
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_process_ledger_options_entry_callback() {
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(100);
let (ledger_path, last_entry_hash) = create_new_tmp_ledger_auto_delete!(&genesis_config);
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let blockhash = genesis_config.hash();
let keypairs = [Keypair::new(), Keypair::new(), Keypair::new()];
let tx = system_transaction::transfer(&mint_keypair, &keypairs[0].pubkey(), 1, blockhash);
let entry_1 = next_entry(&last_entry_hash, 1, vec![tx]);
let tx = system_transaction::transfer(&mint_keypair, &keypairs[1].pubkey(), 1, blockhash);
let entry_2 = next_entry(&entry_1.hash, 1, vec![tx]);
let mut entries = vec![entry_1, entry_2];
entries.extend(create_ticks(
genesis_config.ticks_per_slot,
0,
last_entry_hash,
));
blockstore
.write_entries(
1,
0,
0,
genesis_config.ticks_per_slot,
None,
true,
&Arc::new(Keypair::new()),
entries,
0,
)
.unwrap();
let callback_counter: Arc<RwLock<usize>> = Arc::default();
let entry_callback = {
let counter = callback_counter.clone();
let pubkeys: Vec<Pubkey> = keypairs.iter().map(|k| k.pubkey()).collect();
Arc::new(move |bank: &Bank| {
let mut counter = counter.write().unwrap();
assert_eq!(bank.get_balance(&pubkeys[*counter]), 1);
assert_eq!(bank.get_balance(&pubkeys[*counter + 1]), 0);
*counter += 1;
})
};
let opts = ProcessOptions {
override_num_threads: Some(1),
entry_callback: Some(entry_callback),
accounts_db_test_hash_calculation: true,
..ProcessOptions::default()
};
test_process_blockstore(&genesis_config, &blockstore, opts);
assert_eq!(*callback_counter.write().unwrap(), 2);
} | rust_cleaned_test_functions.jsonl/46806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
38367,
1389,
8743,
9078,
12519,
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_range_inclusive_nth() {
assert_eq!((10..=15).nth(0), Some(10));
assert_eq!((10..=15).nth(1), Some(11));
assert_eq!((10..=15).nth(5), Some(15));
assert_eq!((10..=15).nth(6), None);
let mut r = 10_u8..=20;
assert_eq!(r.nth(2), Some(12));
assert_eq!(r, 13..=20);
assert_eq!(r.nth(2), Some(15));
assert_eq!(r, 16..=20);
assert_eq!(r.is_empty(), false);
assert_eq!(ExactSizeIterator::is_empty(&r), false);
assert_eq!(r.nth(10), None);
assert_eq!(r.is_empty(), true);
assert_eq!(ExactSizeIterator::is_empty(&r), true);
} | rust_cleaned_test_functions.jsonl/54155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
1243,
8336,
78342,
368,
341,
262,
2060,
10714,
0,
1188,
16,
15,
496,
28,
16,
20,
568,
51738,
7,
15,
701,
4329,
7,
16,
15,
1106,
262,
2060,
10714,
0,
1188,
16,
15,
496,
28,
16,
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_struct() {
let mut buf = vec![];
let mut ser = Serializer { write: &mut buf };
#[derive(Serialize, Debug, PartialEq)]
struct Test {
name: String,
num: u64,
}
Test {
name: String::from("hello"),
num: 42,
}
.serialize(&mut ser)
.unwrap();
assert_eq!(
buf,
[
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, b'h', b'e', b'l', b'l', b'o', 0x00,
0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
);
} | rust_cleaned_test_functions.jsonl/79247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
368,
341,
262,
1077,
5206,
6607,
284,
7486,
0,
15078,
262,
1077,
5206,
1420,
284,
58822,
314,
3270,
25,
609,
6984,
6607,
2605,
262,
11506,
27098,
3759,
9050,
11,
11091,
11,
55039,
5563,
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_function_name_from_verb_and_path() {
let operation = WebOperationGen(WebOperation {
path: "/horse".to_owned(),
verb: WebVerb::Get,
..Default::default()
});
assert_eq!(None, operation.rust_module_name());
assert_eq!("get_horse", operation.rust_function_name());
} | rust_cleaned_test_functions.jsonl/64734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
1269,
5673,
62,
22328,
8378,
2638,
368,
341,
286,
1077,
5666,
284,
4895,
8432,
9967,
67240,
8432,
341,
310,
1815,
25,
3521,
59675,
3263,
983,
51973,
3148,
310,
18607,
25,
4895,
66946,
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_parameter_to_self() {
test_rename(
r#"
struct Foo {
i: i32,
}
impl Foo {
fn f(foo<|>: &mut Foo) -> i32 {
foo.i
}
}
"#,
"self",
r#"
struct Foo {
i: i32,
}
impl Foo {
fn f(&mut self) -> i32 {
self.i
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/58101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24899,
2346,
25637,
368,
341,
286,
1273,
79399,
1006,
310,
435,
2,
698,
262,
2036,
33428,
341,
286,
600,
25,
600,
18,
17,
345,
262,
555,
262,
11605,
33428,
341,
286,
5168,
282,
71880,
27,
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_por_circuit_poseidon_top_8_8_2() {
// This is the shape we want for 64GiB secotrs.
test_por_circuit::<TestTree3<PoseidonHasher, U8, U8, U2>>(3, 1_907);
} | rust_cleaned_test_functions.jsonl/88200 | {
"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,
76628,
666,
37268,
33201,
90456,
10426,
62,
23,
62,
23,
62,
17,
368,
341,
286,
442,
1096,
374,
279,
6083,
582,
1366,
369,
220,
21,
19,
46841,
33,
5701,
354,
5428,
624,
286,
1273,
76628,
666,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_bytes() {
// no null
let v = [
224, 184, 168, 224, 185, 132, 224, 184, 151, 224, 184, 162, 228,
184, 173, 229, 141, 142, 86, 105, 225, 187, 135, 116, 32, 78, 97,
109
];
assert_eq!("".as_bytes(), &[]);
assert_eq!("abc".as_bytes(), b"abc");
assert_eq!("ศไทย中华Việt Nam".as_bytes(), v.as_slice());
} | rust_cleaned_test_functions.jsonl/56825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
12524,
368,
341,
286,
442,
902,
845,
198,
286,
1077,
348,
284,
2278,
310,
220,
17,
17,
19,
11,
220,
16,
23,
19,
11,
220,
16,
21,
23,
11,
220,
17,
17,
19,
11,
220,
16,
23,
20,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delta_bit_packed_not_initialized_get() {
let mut decoder = DeltaBitPackDecoder::<Int32Type>::new();
let mut buffer = vec![];
decoder.get(&mut buffer).unwrap();
} | rust_cleaned_test_functions.jsonl/38517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26710,
13996,
620,
11191,
7913,
62421,
3062,
368,
341,
1789,
286,
1077,
5206,
24551,
284,
24957,
8344,
30684,
20732,
27638,
1072,
18,
17,
929,
6831,
931,
543,
286,
1077,
5206,
4147,
284,
7486,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_line_doc_comment() {
with_default_session_globals(|| {
let stripped = beautify_doc_string(Symbol::intern(" test"));
assert_eq!(stripped, " test");
let stripped = beautify_doc_string(Symbol::intern("! test"));
assert_eq!(stripped, "! test");
let stripped = beautify_doc_string(Symbol::intern("test"));
assert_eq!(stripped, "test");
let stripped = beautify_doc_string(Symbol::intern("!test"));
assert_eq!(stripped, "!test");
})
} | rust_cleaned_test_functions.jsonl/120754 | {
"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,
6528,
18869,
17638,
368,
341,
262,
448,
9993,
12316,
58775,
79453,
341,
286,
1077,
36679,
284,
4912,
1437,
18869,
3904,
99095,
486,
55444,
445,
1273,
4010,
286,
2060,
10714,
10297,
29872,
6924,
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... | 2 |
#[test]
fn test_empty_output() {
let mut processor = processor_stub();
processor.json = r#"[{"hello":"world"},{"hello":2}]"#.to_owned();
processor.program = ".[0]".to_owned();
processor.pretty_output = true;
let context = Context::new().unwrap();
let output = processor.run(&context).unwrap().expect("Some");
assert_eq!(output, "{\n \"hello\": \"world\"\n}".to_owned())
} | rust_cleaned_test_functions.jsonl/90632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
7645,
368,
341,
310,
1077,
5206,
17654,
284,
17654,
62781,
543,
310,
17654,
4323,
284,
435,
2,
36864,
4913,
14990,
3252,
14615,
36509,
14990,
788,
17,
92,
19177,
87846,
983,
51973,
543,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_expand() {
let expanded = expand_builtin_macro(
r#"
#[rustc_builtin_macro]
macro_rules! file {() => {}}
file!()
"#,
);
assert_eq!(expanded, "\"\"");
} | rust_cleaned_test_functions.jsonl/124332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
67875,
368,
341,
286,
1077,
17183,
284,
9225,
73829,
58810,
1006,
310,
435,
2,
698,
310,
11506,
35788,
66,
73829,
58810,
921,
310,
18072,
21407,
0,
1034,
314,
368,
589,
4687,
532,
310,
103... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.