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_syn_sent_rst_no_ack() {
let mut s = socket_syn_sent();
send!(s, TcpRepr {
control: TcpControl::Rst,
seq_number: REMOTE_SEQ,
ack_number: None,
..SEND_TEMPL
}, Err(Error::Dropped));
assert_eq!(s.state, State::SynSent);
} | rust_cleaned_test_functions.jsonl/1717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
24115,
1710,
267,
6536,
48447,
368,
341,
286,
1077,
5206,
274,
284,
7575,
51393,
24115,
543,
286,
3624,
10297,
82,
11,
64876,
693,
649,
341,
310,
2524,
25,
64876,
3273,
486,
49,
267,
345,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_folding_consistency() {
use crate::iterable::Iterable;
let rng = &mut ark_std::test_rng();
// Easy folding:
let f = DensePolynomial::<F>::rand(15, rng);
let rev_f = Reverse(&f.coeffs);
let trivial_folded_stream = FoldedPolynomialStream::new(&rev_f, &[]);
let mut collected_stream = trivial_folded_stream.iter().collect::<Vec<_>>();
collected_stream.reverse();
assert_eq!(f.coeffs().to_vec(), collected_stream);
let mut r = vec![F::rand(rng)];
let folded_once_stream = FoldedPolynomialStream::new(&rev_f, &r);
let mut folded_space = folded_once_stream.iter().collect::<Vec<_>>();
folded_space.reverse();
let mut folded_time = fold_polynomial(f.coeffs(), r[0]);
assert_eq!(folded_time, folded_space);
r.push(F::rand(rng));
folded_time = fold_polynomial(&folded_time, r[1]);
let folded_once_stream = FoldedPolynomialStream::new(&rev_f, &r);
let mut folded_space = folded_once_stream.iter().collect::<Vec<_>>();
folded_space.reverse();
assert_eq!(folded_time, folded_space);
r.push(F::rand(rng));
folded_time = fold_polynomial(&folded_time, r[2]);
let folded_once_stream = FoldedPolynomialStream::new(&rev_f, &r);
let mut folded_space = folded_once_stream.iter().collect::<Vec<_>>();
folded_space.reverse();
assert_eq!(folded_time, folded_space);
// Difficult folding:
/ let f = DensePolynomial::<F>::rand(18, rng);
let rev_f = Reverse(&f.coeffs);
let trivial_folded_stream = FoldedPolynomialStream::new(&rev_f, &[]);
let mut collected_stream = trivial_folded_stream.iter().collect::<Vec<_>>();
collected_stream.reverse();
assert_eq!(f.coeffs().to_vec(), collected_stream);
let mut r = vec![F::rand(rng)];
let folded_once_stream = FoldedPolynomialStream::new(&rev_f, &r);
let mut folded_space = folded_once_stream.iter().collect::<Vec<_>>();
folded_space.reverse();
let mut folded_time = fold_polynomial(f.coeffs(), r[0]);
assert_eq!(folded_time, folded_space);
r.push(F::rand(rng));
folded_time = fold_polynomial(&folded_time, r[1]);
let folded_once_stream = FoldedPolynomialStream::new(&rev_f, &r);
let mut folded_space = folded_once_stream.iter().collect::<Vec<_>>();
folded_space.reverse();
assert_eq!(folded_time, folded_space);
} | rust_cleaned_test_functions.jsonl/118308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 956
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
14995,
31971,
47094,
368,
341,
262,
990,
17717,
486,
2015,
480,
486,
50635,
280,
262,
1077,
28422,
284,
609,
6984,
55217,
15656,
486,
1944,
66849,
1428,
262,
442,
18609,
44742,
510,
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_composition() {
let (mut a, my_env) = test_env();
// Function composition
let syntax = new_lambda("f", new_lambda("g", new_lambda("arg", new_apply(new_identifier("g"), new_apply(new_identifier("f"), new_identifier("arg"))))));
let t = analyse(&mut a, &syntax, &my_env, &hashset![]);
assert_eq!(a[t].as_string(&a, &mut Namer {
value: 'a',
set: hashmap![],
}), r#"((a -> b) -> ((b -> c) -> (a -> c)))"#);
} | rust_cleaned_test_functions.jsonl/127657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
3487,
368,
341,
262,
1077,
320,
6984,
264,
11,
847,
15879,
8,
284,
1273,
15879,
1428,
262,
442,
5712,
18037,
7213,
262,
1077,
19482,
284,
501,
51884,
445,
69,
497,
501,
51884,
445,
70,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pessimistic_prewrite_committed_transaction() {
let engine = TestEngineBuilder::new().build().unwrap();
let cm = ConcurrencyManager::new(1.into());
let mut statistics = Statistics::default();
let key = b"k";
must_acquire_pessimistic_lock(&engine, key, key, 5, 5);
must_pessimistic_prewrite_put_async_commit(
&engine,
key,
b"v1",
key,
&Some(vec![]),
5,
5,
true,
10,
);
must_commit(&engine, key, 5, 10);
must_acquire_pessimistic_lock(&engine, key, key, 15, 15);
let cmd = PrewritePessimistic::with_1pc(
vec![(Mutation::make_put(Key::from_raw(key), b"v2".to_vec()), true)],
key.to_vec(),
15.into(),
15.into(),
TimeStamp::default(),
);
let result = prewrite_command(&engine, cm.clone(), &mut statistics, cmd).unwrap();
let one_pc_commit_ts = result.one_pc_commit_ts;
// T3 is after T1 and T2
must_prewrite_put(&engine, key, b"v3", key, 20);
must_commit(&engine, key, 20, 25);
// Repeating the T1 prewrite request
let cmd = PrewritePessimistic::new(
vec![(Mutation::make_put(Key::from_raw(key), b"v1".to_vec()), true)],
key.to_vec(),
5.into(),
200,
5.into(),
1,
10.into(),
TimeStamp::default(),
Some(vec![]),
false,
AssertionLevel::Off,
Context::default(),
);
let context = WriteContext {
lock_mgr: &DummyLockManager {},
concurrency_manager: cm.clone(),
extra_op: ExtraOp::Noop,
statistics: &mut statistics,
async_apply_prewrite: false,
};
let snap = engine.snapshot(Default::default()).unwrap();
let result = cmd.cmd.process_write(snap, context).unwrap();
assert!(result.to_be_write.modifies.is_empty()); // should not make real modifies
assert!(result.lock_guards.is_empty());
match result.pr {
ProcessResult::PrewriteResult { result } => {
assert!(result.locks.is_empty());
assert_eq!(result.min_commit_ts, 10.into()); // equals to the real commit ts
assert_eq!(result.one_pc_commit_ts, 0.into()); // not using 1PC
}
res => panic!("unexpected result {:?}", res),
}
// Repeating the T2 prewrite request
let cmd = PrewritePessimistic::with_1pc(
vec![(Mutation::make_put(Key::from_raw(key), b"v2".to_vec()), true)],
key.to_vec(),
15.into(),
15.into(),
TimeStamp::default(),
);
let context = WriteContext {
lock_mgr: &DummyLockManager {},
concurrency_manager: cm,
extra_op: ExtraOp::Noop,
statistics: &mut statistics,
async_apply_prewrite: false,
};
let snap = engine.snapshot(Default::default()).unwrap();
let result = cmd.cmd.process_write(snap, context).unwrap();
assert!(result.to_be_write.modifies.is_empty()); // should not make real modifies
assert!(result.lock_guards.is_empty());
match result.pr {
ProcessResult::PrewriteResult { result } => {
assert!(result.locks.is_empty());
assert_eq!(result.min_commit_ts, 0.into()); // 1PC does not need this
assert_eq!(result.one_pc_commit_ts, one_pc_commit_ts); // equals to the previous 1PC commit_ts
}
res => panic!("unexpected result {:?}", res),
}
} | rust_cleaned_test_functions.jsonl/31431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1931
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
66733,
4532,
620,
52473,
2965,
5483,
28884,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
9961,
284,
1200,
15973,
2043,
486,
931,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_object() {
let mut h = HashMap::new();
h.insert("a", 1);
assert_eq!(object(Some(to_value(h).unwrap()), vec![]).unwrap(), true);
assert_eq!(object(Some(to_value(1).unwrap()), vec![]).unwrap(), false);
assert_eq!(object(Some(to_value("hello").unwrap()), vec![]).unwrap(), false);
} | rust_cleaned_test_functions.jsonl/132427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
368,
341,
286,
1077,
5206,
305,
284,
10528,
486,
931,
543,
286,
305,
7030,
445,
64,
497,
220,
16,
317,
286,
2060,
10714,
10297,
1700,
65405,
12186,
3142,
3203,
568,
15454,
11858,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_compaction_pri() {
let path = tempdir_with_prefix("_rust_rocksdb_compaction_pri");
let mut opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
opts.create_if_missing(true);
cf_opts.compaction_priority(CompactionPriority::MinOverlappingRatio);
DB::open_cf(
opts,
path.path().to_str().unwrap(),
vec![("default", cf_opts)],
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/34117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
18177,
1311,
85639,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
18177,
1311,
85639,
797,
262,
1077,
5206,
12185,
284,
5952,
3798,
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... | 1 |
#[test]
fn test_scalar_value_simple() {
assert_eq!(
<UserId as GraphQLType<DefaultScalarValue>>::name(&()),
Some("UserId")
);
let mut registry: Registry = Registry::new(FnvHashMap::default());
let meta = UserId::meta(&(), &mut registry);
assert_eq!(meta.name(), Some("UserId"));
assert_eq!(meta.description(), None);
let input: InputValue = serde_json::from_value(serde_json::json!("userId1")).unwrap();
let output: UserId = FromInputValue::from_input_value(&input).unwrap();
assert_eq!(output, UserId("userId1".into()),);
let id = UserId("111".into());
let output = ToInputValue::<DefaultScalarValue>::to_input_value(&id);
assert_eq!(output, InputValue::scalar("111"),);
} | rust_cleaned_test_functions.jsonl/27374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
3142,
30015,
368,
341,
262,
2060,
10714,
33673,
286,
366,
13504,
438,
35087,
929,
27,
3675,
20639,
1130,
77595,
606,
2099,
14702,
286,
4329,
445,
13504,
1138,
262,
3475,
262,
1077,
5206,
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_bundle_async() {
let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("tests/002_hello.ts");
use deno_core::ModuleSpecifier;
let module_name = ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap())
.unwrap()
.to_string();
let state = ThreadSafeGlobalState::mock(vec![
String::from("deno"),
p.to_string_lossy().into(),
String::from("$deno$/bundle.js"),
]);
let fut = async move {
let result = state
.ts_compiler
.bundle_async(
state.clone(),
module_name,
Some(String::from("$deno$/bundle.js")),
)
.await;
assert!(result.is_ok());
};
tokio_util::run(fut.boxed())
} | rust_cleaned_test_functions.jsonl/15442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60986,
28346,
368,
341,
262,
1077,
281,
284,
1460,
486,
2343,
486,
1820,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
5455,
414,
659,
3765,
741,
414,
659,
15454,
741,
414,
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... | 1 |
#[test]
fn test_bridge_conflict_ty() {
let hdr = indoc! {"
namespace a {
struct Key { int a; };
}
namespace b {
struct Key { int a; };
}
"};
let rs = quote! {};
run_test("", hdr, rs, &["a::Key", "b::Key"], &[]);
} | rust_cleaned_test_functions.jsonl/9898 | {
"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,
54944,
16059,
21242,
53171,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
4473,
264,
341,
310,
2036,
5309,
314,
526,
264,
26,
2605,
286,
456,
286,
4473,
293,
341,
310,
2036,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vsock_parsing() -> Result<()> {
// socket and cid is required
assert!(VsockConfig::parse("").is_err());
assert_eq!(
VsockConfig::parse("socket=/tmp/sock,cid=1")?,
VsockConfig {
cid: 1,
socket: PathBuf::from("/tmp/sock"),
iommu: false,
id: None,
}
);
assert_eq!(
VsockConfig::parse("socket=/tmp/sock,cid=1,iommu=on")?,
VsockConfig {
cid: 1,
socket: PathBuf::from("/tmp/sock"),
iommu: true,
id: None,
}
);
Ok(())
} | rust_cleaned_test_functions.jsonl/74049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
13199,
620,
28598,
368,
1464,
5714,
71698,
341,
286,
442,
7575,
323,
32141,
374,
2567,
198,
286,
2060,
10297,
53,
13199,
2648,
486,
6400,
80821,
285,
9266,
1423,
286,
2060,
10714,
33673,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_cache_path() {
let (temp_dir, deno_dir) = test_setup();
let filename = "hello.js";
let source_code = b"1+2";
let hash = source_code_hash(filename, source_code, version::DENO);
assert_eq!(
(
temp_dir.path().join(format!("gen/{}.js", hash)),
temp_dir.path().join(format!("gen/{}.js.map", hash))
),
deno_dir.cache_path(filename, source_code)
);
} | rust_cleaned_test_functions.jsonl/83863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11529,
2638,
368,
341,
262,
1077,
320,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
543,
262,
1077,
3899,
284,
330,
14990,
2857,
876,
262,
1077,
2530,
4136,
284,
293,
1,
16,
10,
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_getpeereid() {
use std::os::unix::net::UnixStream;
let (sock_a, sock_b) = UnixStream::pair().unwrap();
let (uid_a, gid_a) = getpeereid(sock_a.as_raw_fd()).unwrap();
let (uid_b, gid_b) = getpeereid(sock_b.as_raw_fd()).unwrap();
let uid = geteuid();
let gid = getegid();
assert_eq!(uid, uid_a);
assert_eq!(gid, gid_a);
assert_eq!(uid_a, uid_b);
assert_eq!(gid_a, gid_b);
} | rust_cleaned_test_functions.jsonl/104840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
375,
485,
307,
368,
341,
262,
990,
1460,
486,
436,
486,
56646,
486,
4711,
486,
55832,
3027,
280,
262,
1077,
320,
13199,
4306,
11,
11087,
880,
8,
284,
46995,
3027,
486,
12670,
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... | 1 |
#[test]
fn test_serialize_info_string() {
let attributes: Vec<UciInfoAttribute> = vec![
UciInfoAttribute::String(String::from("Invalid move: d6e1 - violates chess rules"))
];
let m = UciMessage::Info(attributes);
assert_eq!(m.serialize(), "info string Invalid move: d6e1 - violates chess rules");
} | rust_cleaned_test_functions.jsonl/19067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
3109,
3904,
368,
341,
286,
1077,
8201,
25,
11312,
36397,
5855,
1731,
3907,
29,
284,
7486,
90515,
310,
547,
5855,
1731,
3907,
486,
703,
2242,
486,
1499,
445,
7928,
3271,
25,
294,
21,
68,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stop_access_point_with_iface_fails() {
let mut exec = fasync::TestExecutor::new().expect("failed to create an executor");
let test_values = test_setup();
let serve_fut = test_values.ap.serve_provider_requests(test_values.requests);
pin_mut!(serve_fut);
assert_variant!(exec.run_until_stalled(&mut serve_fut), Poll::Pending);
// Request a new controller.
let (controller, _) = request_controller(&test_values.provider);
assert_variant!(exec.run_until_stalled(&mut serve_fut), Poll::Pending);
// Set the StopAp response.
{
let iface_manager_fut = test_values.iface_manager.lock();
pin_mut!(iface_manager_fut);
let mut iface_manager = assert_variant!(
exec.run_until_stalled(&mut iface_manager_fut),
Poll::Ready(iface_manager) => { iface_manager }
);
iface_manager.stop_succeeds = false;
}
// Issue StopAP request.
let network_id = fidl_policy::NetworkIdentifier {
ssid: b"test".to_vec(),
type_: fidl_policy::SecurityType::None,
};
let credential = fidl_policy::Credential::None(fidl_policy::Empty);
let network_config = fidl_policy::NetworkConfig {
id: Some(network_id),
credential: Some(credential),
..fidl_policy::NetworkConfig::EMPTY
};
let stop_fut = controller.stop_access_point(network_config);
pin_mut!(stop_fut);
// Process stop request and verify stop response.
assert_variant!(exec.run_until_stalled(&mut serve_fut), Poll::Pending);
assert_variant!(
exec.run_until_stalled(&mut stop_fut),
Poll::Ready(Ok(fidl_common::RequestStatus::RejectedIncompatibleMode))
);
} | rust_cleaned_test_functions.jsonl/59829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 870
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19039,
12759,
6085,
6615,
67666,
761,
6209,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
1273,
9146,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_name_variable() {
let doc = r#"query FetchSomeIDQuery($someId: String!) { human(id: $someId) { name } }"#;
let database = Database::new();
let schema = RootNode::new(&database, EmptyMutation::<Database>::new());
let vars = vec![("someId".to_owned(), InputValue::string("1000"))]
.into_iter()
.collect();
assert_eq!(
::execute(doc, None, &schema, &vars, &database),
Ok((
Value::object(
vec![(
"human",
Value::object(
vec![("name", Value::string("Luke Skywalker"))]
.into_iter()
.collect(),
),
)].into_iter()
.collect()
),
vec![]
))
);
} | rust_cleaned_test_functions.jsonl/35469 | {
"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,
5738,
1269,
14635,
368,
341,
262,
1077,
4629,
284,
435,
55543,
1631,
22104,
8373,
915,
2859,
699,
14689,
764,
25,
923,
16315,
314,
3738,
3724,
25,
400,
14689,
764,
8,
314,
829,
335,
335,
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_move_direction_steps() {
// back to original position
assert_eq!(
Point::default()
.move_direction_steps(&Direction::North, 2)
.move_direction_steps(&Direction::South, 2)
.move_direction_steps(&Direction::East, 2)
.move_direction_steps(&Direction::West, 2),
Point::default()
);
} | rust_cleaned_test_functions.jsonl/120794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
25438,
22731,
368,
341,
286,
442,
1182,
311,
4024,
2309,
198,
286,
2060,
10714,
33673,
310,
5126,
486,
2258,
741,
394,
659,
3397,
25438,
22731,
2099,
9268,
486,
25221,
11,
220,
17,
340,
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_puzzle_with_seven_letters() {
assert_alphametic_solution_eq(
"HE + SEES + THE == LIGHT",
&[
('E', 4),
('G', 2),
('H', 5),
('I', 0),
('L', 1),
('S', 9),
('T', 7),
],
);
} | rust_cleaned_test_functions.jsonl/60614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
14945,
6615,
3453,
1037,
67330,
368,
341,
262,
2060,
8418,
759,
309,
5298,
50274,
10714,
1006,
286,
330,
1799,
488,
5052,
1570,
488,
3168,
621,
52203,
756,
286,
609,
9640,
310,
4319,
36,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fullscreen_optional() {
let client = setup_cantata();
let result = client.root.fullscreen();
let is_fullscreen = result.unwrap();
assert_eq!(None, is_fullscreen);
let method_call_res = client.root.set_fullscreen(false);
match method_call_res {
Err(errors::Error(errors::ErrorKind::AccessedAbsentOptionalProperty(..), ..)) => {}
Err(e) => panic!("wrong kind of error: {:?}", e),
Ok(..) => panic!("error expected"),
}
} | rust_cleaned_test_functions.jsonl/86481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
8174,
74644,
368,
341,
262,
1077,
2943,
284,
6505,
666,
517,
459,
543,
262,
1077,
1102,
284,
2943,
12576,
21534,
8174,
543,
262,
1077,
374,
16372,
8174,
284,
1102,
55395,
543,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_binary_search() {
// use crate::monoid::Monoid;
let mut seg = Seg::new(10, || 0);
assert_eq!(seg.reduce(0, 10), 0);
seg.set(5, 10);
let is_ok = &|sum: &usize| *sum < 10;
assert_eq!(seg.max_right(is_ok, 0), 5);
assert_eq!(seg.max_right(is_ok, 10), 10);
assert_eq!(seg.max_right(is_ok, 5), 5);
assert_eq!(seg.max_right(is_ok, 6), 10);
assert_eq!(seg.min_left(is_ok, 10), 6);
assert_eq!(seg.min_left(is_ok, 5), 0);
assert_eq!(seg.min_left(is_ok, 6), 6);
} | rust_cleaned_test_functions.jsonl/38814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
10716,
368,
972,
310,
442,
990,
17717,
486,
1645,
588,
486,
11095,
588,
463,
310,
1077,
5206,
4810,
284,
17209,
486,
931,
7,
16,
15,
11,
1369,
220,
15,
736,
310,
2060,
10714,
10297,
146... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dep_graph_delta_serialize_empty() {
let x = DepGraphDelta::new();
let mut bytes = Vec::new();
x.write_to(&mut bytes).unwrap();
let mut y = DepGraphDelta::new();
let mut bytes_read: &[u8] = &bytes;
let num_loaded = y.read_from(&mut bytes_read, |_, _| true).unwrap();
assert_eq!(num_loaded, 0);
assert_eq!(x, y);
} | rust_cleaned_test_functions.jsonl/3502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49258,
14738,
26710,
88686,
15124,
368,
341,
286,
1077,
856,
284,
4148,
11212,
20277,
486,
931,
543,
286,
1077,
5206,
5820,
284,
11312,
486,
931,
543,
286,
856,
3836,
2346,
2099,
6984,
5820,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scan_keys() {
test_scan_keys_imp(vec![b"a", b"c", b"e", b"b", b"d", b"f"], vec![b"a", b"b"]);
let v1 = gen_value(b'x', SHORT_VALUE_MAX_LEN + 1);
let v4 = gen_value(b'v', SHORT_VALUE_MAX_LEN + 1);
test_scan_keys_imp(vec![b"a", b"c", b"e", b"b", b"d", b"f"], vec![&v1, &v4]);
} | rust_cleaned_test_functions.jsonl/23335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
12631,
368,
341,
286,
1273,
28857,
12631,
36788,
25592,
20703,
65,
56693,
497,
293,
96946,
497,
293,
1,
68,
497,
293,
1,
65,
497,
293,
44917,
497,
293,
96171,
7914,
7486,
20703,
65,
56693... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_diff() {
use crate::git::{Parser, Section};
// Setup
let diff = r#""#;
let expected_sections: Vec<Section> = vec![];
let parser = Parser::new(false);
// Run
let actual_sections = parser.sections(diff);
// Assert
assert_eq!(expected_sections, actual_sections);
} | rust_cleaned_test_functions.jsonl/81566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
15850,
368,
341,
286,
990,
17717,
486,
12882,
22964,
6570,
11,
11113,
2440,
286,
442,
18626,
198,
286,
1077,
3638,
284,
435,
2,
3014,
2,
280,
286,
1077,
3601,
59485,
25,
11312,
27,
9620,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_trunk_of_4() {
let mut tree = HashMap::new();
let b1 = Fork { id: 1, base: 0 };
let b2 = Fork { id: 2, base: 1 };
tree.insert(b1.id, b1.clone());
assert!(b1.is_trunk_of(&b2, &tree));
assert!(!b2.is_trunk_of(&b1, &tree));
} | rust_cleaned_test_functions.jsonl/80074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
3547,
3122,
3575,
62,
19,
368,
341,
262,
1077,
5206,
4916,
284,
10528,
486,
931,
543,
262,
1077,
293,
16,
284,
47850,
314,
877,
25,
220,
16,
11,
2331,
25,
220,
15,
2605,
262,
1077,
293... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arg_matches_classic_mode() {
let argv = vec!["lsd", "--color", "always", "--classic"];
let matches = app::build().get_matches_from_safe(argv).unwrap();
assert_eq!(
Some(ColorOption::Never),
ColorOption::from_arg_matches(&matches)
);
} | rust_cleaned_test_functions.jsonl/86429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
6057,
38344,
4790,
292,
7302,
368,
341,
286,
1077,
10213,
284,
7486,
0,
1183,
4730,
67,
497,
14482,
3423,
497,
330,
32122,
497,
14482,
79709,
6332,
286,
1077,
9071,
284,
906,
486,
5834,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_none() {
let tsm = TransactionSenderMessage::None;
let ptsm = proto::TransactionSenderMessage::from(tsm);
assert_eq!(ptsm.message, proto::TransactionSenderMessage::none().message);
} | rust_cleaned_test_functions.jsonl/30957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
31488,
368,
341,
286,
1077,
259,
3563,
284,
17869,
20381,
2052,
486,
4064,
280,
286,
1077,
29993,
76,
284,
18433,
486,
8070,
20381,
2052,
486,
1499,
1155,
3563,
317,
286,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dot_1() {
let s = "2*3+4*5".to_string();
let mut tokenizer = s.tokenize().peekable();
let node = expr(&mut tokenizer);
let mut dot = Dot::new();
let s = dot.write(&node);
assert_eq!(
s,
vec![
"digraph ast_tree {",
" 0 [ label = plus ];",
" 2 [ label = mul ];",
" 1 [ label = mul ];",
" 4 [ label = 4 ];",
" 3 [ label = 5 ];",
" 6 [ label = 2 ];",
" 5 [ label = 3 ];",
" 0 -> 1;",
" 0 -> 2;",
" 1 -> 3;",
" 1 -> 4;",
" 2 -> 5;",
" 2 -> 6;",
"}",
].join("\n")
)
} | rust_cleaned_test_functions.jsonl/113857 | {
"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,
30941,
62,
16,
368,
341,
286,
1077,
274,
284,
330,
17,
9,
18,
10,
19,
9,
20,
3263,
983,
3904,
543,
286,
1077,
5206,
45958,
284,
274,
96790,
1005,
29107,
480,
1428,
286,
1077,
2436,
284,
1516... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tok_ints() {
let mut vm = build_def_vm();
let mut reader_state = ReaderState::new();
let input = "2300 23_000 #xFF #xff #x0f #xF #b0000_0000 #b1111_1111 #b11111111 #b11111111_11111111 #o07 #o17";
let tokens = tokenize(&mut vm, &mut reader_state, input, None);
assert!(tokens.len() == 14);
assert!(tokens[0] == "#(");
assert!(tokens[1] == "Int:2300");
assert!(tokens[2] == "Int:23000");
assert!(tokens[3] == "Int:255");
assert!(tokens[4] == "Int:255");
assert!(tokens[5] == "Int:15");
assert!(tokens[6] == "Int:15");
assert!(tokens[7] == "Int:0");
assert!(tokens[8] == "Int:255");
assert!(tokens[9] == "Int:255");
assert!(tokens[10] == "Int:65535");
assert!(tokens[11] == "Int:7");
assert!(tokens[12] == "Int:15");
assert!(tokens[13] == ")");
let input = "#xFG";
tokenize_err(&mut vm, &mut reader_state, input, None);
let input = "#b1112";
tokenize_err(&mut vm, &mut reader_state, input, None);
let input = "#o80";
tokenize_err(&mut vm, &mut reader_state, input, None);
} | rust_cleaned_test_functions.jsonl/101098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 611
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76162,
4042,
82,
368,
341,
286,
1077,
5206,
10995,
284,
1936,
7844,
39008,
543,
286,
1077,
5206,
6604,
4387,
284,
25166,
1397,
486,
931,
543,
286,
1077,
1946,
284,
330,
17,
18,
15,
15,
220,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_established_queue_during_retransmission() {
let mut s = socket_established();
s.remote_mss = 6;
s.send_slice(b"abcdef123456ABCDEF").unwrap();
recv!(s, time 1000, Ok(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"abcdef"[..],
..RECV_TEMPL
})); // this one is dropped
recv!(s, time 1005, Ok(TcpRepr {
seq_number: LOCAL_SEQ + 1 + 6,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"123456"[..],
..RECV_TEMPL
})); // this one is received
recv!(s, time 1010, Ok(TcpRepr {
seq_number: LOCAL_SEQ + 1 + 6 + 6,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"ABCDEF"[..],
..RECV_TEMPL
})); // also dropped
recv!(s, time 2000, Ok(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"abcdef"[..],
..RECV_TEMPL
})); // retransmission
send!(s, time 2005, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1 + 6 + 6),
..SEND_TEMPL
}); // acknowledgement of both segments
recv!(s, time 2010, Ok(TcpRepr {
seq_number: LOCAL_SEQ + 1 + 6 + 6,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"ABCDEF"[..],
..RECV_TEMPL
})); // retransmission of only unacknowledged data
} | rust_cleaned_test_functions.jsonl/1767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 883
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18583,
5102,
291,
10841,
814,
1677,
1288,
1458,
2728,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
274,
34093,
717,
778,
284,
220,
21,
280,
286,
274,
5219,
26488,
1883,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str() {
let s = "\0 a 'b \" c";
let tokens = quote!(#s);
let expected = r#""\u{0} a 'b \" c""#;
assert_eq!(expected, tokens.to_string());
} | rust_cleaned_test_functions.jsonl/3599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
368,
341,
262,
1077,
274,
284,
2917,
15,
264,
364,
65,
7245,
272,
876,
262,
1077,
11211,
284,
12641,
10297,
2,
82,
317,
262,
1077,
3601,
284,
435,
2,
3014,
59,
84,
90,
15,
92,
264,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transfer_bond() {
TestNet::reset();
let xcm_transfer_amount = ksm(10f64);
ParaA::execute_with(|| {
assert_ok!(LiquidStaking::stake(Origin::signed(ALICE), ksm(2000f64),));
assert_ok!(LiquidStaking::bond(
Origin::signed(ALICE),
xcm_transfer_amount,
RewardDestination::Staked
));
});
Relay::execute_with(|| {
let ledger = RelayStaking::ledger(LiquidStaking::derivative_para_account_id()).unwrap();
assert_eq!(ledger.total, xcm_transfer_amount);
assert_eq!(
RelayBalances::free_balance(LiquidStaking::derivative_para_account_id()),
xcm_transfer_amount
);
assert_eq!(
RelayBalances::usable_balance(LiquidStaking::derivative_para_account_id()),
0
);
});
} | rust_cleaned_test_functions.jsonl/53666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
880,
2111,
368,
341,
262,
3393,
6954,
486,
9716,
543,
262,
1077,
856,
6226,
35403,
13471,
284,
595,
3563,
7,
16,
15,
69,
21,
19,
317,
262,
22989,
32,
486,
10257,
6615,
79453,
341,
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_vsib_props() {
for info in decoder_tests(false, false) {
let bytes = to_vec_u8(info.hex_bytes()).unwrap();
let mut decoder = Decoder::new(info.bitness(), &bytes, info.decoder_options());
let instruction = decoder.decode();
assert_eq!(instruction.code(), info.code());
let (is_vsib, is_vsib32, is_vsib64) =
if let Some((is_vsib32, is_vsib64)) = get_vsib(info.code().op_code()) { (true, is_vsib32, is_vsib64) } else { (false, false, false) };
assert_eq!(is_vsib, instruction.is_vsib());
assert_eq!(is_vsib32, instruction.is_vsib32());
assert_eq!(is_vsib64, instruction.is_vsib64());
}
} | rust_cleaned_test_functions.jsonl/82767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42434,
579,
44835,
368,
341,
2023,
3546,
304,
24551,
32509,
3576,
11,
895,
8,
341,
197,
10217,
5820,
284,
311,
13251,
7300,
23,
14208,
45639,
12524,
6011,
15454,
543,
197,
10217,
5206,
24551,
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... | 3 |
#[test]
fn test_varchar_params() {
test_type(
"VARCHAR",
&[
(Some("hello world".to_owned()), "'hello world'"),
(
Some("イロハニホヘト チリヌルヲ".to_owned()),
"'イロハニホヘト チリヌルヲ'",
),
(None, "NULL"),
],
);
} | rust_cleaned_test_functions.jsonl/120850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
1762,
6745,
368,
341,
262,
1273,
1819,
1006,
286,
330,
79651,
756,
286,
609,
9640,
310,
320,
8373,
445,
14990,
1879,
3263,
983,
51973,
11858,
7178,
14990,
1879,
6,
4461,
310,
2399,
394,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_fg_color() {
let colored = Colored::ForegroundColor(Color::Red);
assert_eq!(Into::<u16>::into(colored), FG_INTENSITY | FG_RED);
} | rust_cleaned_test_functions.jsonl/61030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
69473,
6714,
368,
341,
286,
1077,
27197,
284,
4254,
3018,
486,
84997,
15028,
486,
6033,
317,
286,
2060,
10714,
10297,
26591,
27638,
84,
16,
21,
6831,
18122,
19611,
3018,
701,
48297,
9161,
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 |
#[test]
fn test_parse_simple_2() {
let _: DID = dbg!(DID::parse("did:method:identifier").unwrap());
let _: DID = dbg!(DID::parse("did:method:identifier/path/to/this").unwrap());
let _: DID = dbg!(DID::parse("did:method:identifier/path/to/this?thing=that").unwrap());
let _: DID = dbg!(DID::parse("did:method:identifier/?thing=that").unwrap());
let _: DID = dbg!(DID::parse("did:method:identifier/path/to/this?thing=that.foo#fragment=hash.foo").unwrap());
let _: DID = dbg!(DID::parse("did:method:identifier#fragment=hash").unwrap());
let _: DID = dbg!(DID::parse("did:method:identifier?#fragment=hash").unwrap());
} | rust_cleaned_test_functions.jsonl/93400 | {
"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,
21039,
30015,
62,
17,
368,
341,
220,
1077,
58536,
59119,
284,
47904,
10297,
35,
915,
486,
6400,
445,
22920,
25,
4393,
25,
15909,
1827,
15454,
1423,
220,
1077,
58536,
59119,
284,
47904,
10297,
35,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lints_tracking_hash_different_construction_order() {
let mut v1 = Options::default();
let mut v2 = Options::default();
v1.lint_opts = vec![
(String::from("a"), Level::Allow),
(String::from("b"), Level::Warn),
(String::from("c"), Level::Deny),
(String::from("d"), Level::Forbid),
];
v2.lint_opts = vec![
(String::from("a"), Level::Allow),
(String::from("c"), Level::Deny),
(String::from("b"), Level::Warn),
(String::from("d"), Level::Forbid),
];
// The hash should be order-dependent
assert_non_crate_hash_different(&v1, &v2);
} | rust_cleaned_test_functions.jsonl/100718 | {
"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,
907,
21042,
66105,
8950,
82741,
3382,
3024,
7869,
368,
341,
262,
1077,
5206,
348,
16,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
348,
17,
284,
14566,
486,
2258,
1428,
262,
348,
16,
918,
396,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rule_index() {
let polar = Polar::new();
polar
.load_str(
r#"
f(1, 1, "x");
f(1, 1, "y");
f(1, x, "y") if x = 2;
f(1, 2, {b: "y"});
f(1, 3, {c: "z"});
"#,
)
.unwrap();
let kb = polar.kb.read().unwrap();
let generic_rule = kb.get_generic_rule(&sym!("f")).unwrap();
let index = &generic_rule.index;
assert!(index.rules.is_empty());
fn keys(index: &RuleIndex) -> HashSet<Option<Value>> {
index.index.keys().cloned().collect()
}
let mut args = HashSet::<Option<Value>>::new();
args.clear();
args.insert(Some(value!(1)));
assert_eq!(args, keys(index));
args.clear();
args.insert(None); // x
args.insert(Some(value!(1)));
args.insert(Some(value!(2)));
args.insert(Some(value!(3)));
let index1 = index.index.get(&Some(value!(1))).unwrap();
assert_eq!(args, keys(index1));
args.clear();
args.insert(Some(value!("x")));
args.insert(Some(value!("y")));
let index11 = index1.index.get(&Some(value!(1))).unwrap();
assert_eq!(args, keys(index11));
args.remove(&Some(value!("x")));
let index1_ = index1.index.get(&None).unwrap();
assert_eq!(args, keys(index1_));
args.clear();
args.insert(Some(value!(btreemap! {sym!("b") => term!("y")})));
let index12 = index1.index.get(&Some(value!(2))).unwrap();
assert_eq!(args, keys(index12));
args.clear();
args.insert(Some(value!(btreemap! {sym!("c") => term!("z")})));
let index13 = index1.index.get(&Some(value!(3))).unwrap();
assert_eq!(args, keys(index13));
} | rust_cleaned_test_functions.jsonl/7856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 963
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21124,
3560,
368,
341,
286,
1077,
24660,
284,
55896,
486,
931,
543,
286,
24660,
198,
310,
659,
1078,
2895,
1006,
394,
435,
2,
698,
310,
282,
7,
16,
11,
220,
16,
11,
330,
87,
797,
310,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pass_confirm_settle() {
ExtBuilder::build().execute_with(|| {
System::set_block_number(1);
let alice_pair = account_pair("Alice");
let bob_pair = account_pair("Bob");
let (channel_peers, peers_pair) = get_sorted_peer(alice_pair.clone(), bob_pair.clone());
let open_channel_request = get_open_channel_request(
true,
20000,
500000,
10,
true,
channel_peers.clone(),
1,
peers_pair.clone(),
);
let channel_id = LedgerOperation::<TestRuntime>::open_channel(
Origin::signed(channel_peers[0]),
open_channel_request,
0,
).unwrap();
assert_ok!(LedgerOperation::<TestRuntime>::deposit(
Origin::signed(channel_peers[0]),
channel_id,
channel_peers[0],
500,
0
));
assert_ok!(LedgerOperation::<TestRuntime>::deposit(
Origin::signed(channel_peers[1]),
channel_id,
channel_peers[1],
500,
0
));
// the meaning of the index: [peer index][pay hash list index][pay index]
let peers_pay_hash_lists_amts: Vec<Vec<Vec<Balance>>> =
vec![vec![vec![1, 2], vec![3, 4]], vec![vec![5, 6], vec![7, 8]]];
let global_result: (
SignedSimplexStateArray<H256, AccountId, BlockNumber, Balance, Signature>,
Vec<BlockNumber>,
Vec<Vec<Vec<ConditionalPay<Moment, BlockNumber, AccountId, H256, Balance>>>>,
Vec<Vec<H256>>,
Vec<Vec<PayIdList<H256>>>,
) = get_cosigned_intend_settle(
vec![channel_id, channel_id],
peers_pay_hash_lists_amts,
vec![1, 1], // seq_nums
vec![10, 20], // transfer amounts
vec![99999, 99999], // last_pay_resolve_deadlines
vec![channel_peers[0], channel_peers[1]],
channel_peers[0],
vec![peers_pair[0].clone(), peers_pair[1].clone()],
1,
);
let signed_simplex_state_array = global_result.0;
let cond_pays = global_result.2;
for peer_index in 0..2 {
for list_index in 0..cond_pays[peer_index as usize].len() {
for pay_index in 0..cond_pays[peer_index as usize][list_index as usize].len() {
let pay_request = ResolvePaymentConditionsRequest {
cond_pay: cond_pays[peer_index as usize][list_index as usize][pay_index as usize].clone(),
hash_preimages: vec![],
};
assert_ok!(PayResolver::<TestRuntime>::resolve_payment_by_conditions(channel_peers[0], pay_request));
}
}
}
// pass onchain resolve deadline of all onchain resolved pays
System::set_block_number(System::block_number() + 6);
// intend settle
let _ = LedgerOperation::<TestRuntime>::intend_settle(
Origin::signed(channel_peers[0]),
signed_simplex_state_array,
).unwrap();
let pay_id_list_array = global_result.4;
for peer_index in 0..2 {
assert_ok!(LedgerOperation::<TestRuntime>::clear_pays(
channel_id,
channel_peers[peer_index as usize],
pay_id_list_array[peer_index as usize][1].clone()
));
}
let settle_finalized_time = CelerPayModule::get_settle_finalized_time(channel_id);
System::set_block_number(settle_finalized_time);
assert_ok!(CelerPayModule::confirm_settle(
Origin::signed(channel_peers[0]),
channel_id
));
})
} | rust_cleaned_test_functions.jsonl/81770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
23800,
2602,
11239,
368,
341,
286,
9447,
3297,
486,
5834,
1005,
10257,
6615,
79453,
314,
5872,
310,
739,
486,
746,
7113,
5500,
7,
16,
317,
310,
1077,
70433,
14445,
284,
2692,
14445,
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... | 6 |
#[test]
fn test_carriage_return_is_not_word_boundary() {
new_ucmd!()
.args(&["-w6", "-s"])
.pipe_in("fizz\rbuzz\rfizzbuzz")
.succeeds()
.stdout_is("fizz\rbuzz\rfizzbu\nzz");
} | rust_cleaned_test_functions.jsonl/23297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26616,
8775,
12511,
6892,
7913,
13533,
54004,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
21,
497,
6523,
82,
14108,
286,
659,
13768,
1243,
445,
69,
8759,
59,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_search_interval() {
fn search(x: i64, xs: &[i64]) -> (usize, usize) {
let xs: Vec<_> = xs.iter().cloned().map(Time::from_micros).collect();
search_interval(Time::from_micros(x), &xs)
}
assert_eq!((0, 0), search(1, &[1, 2, 3]));
assert_eq!((2, 2), search(3, &[1, 2, 3]));
assert_eq!((1, 2), search(3, &[1, 2, 4]));
assert_eq!((1, 3), search(1, &[0, 1, 1, 1, 2]));
assert_eq!((1, 3), search(1, &[0, 1, 1, 1]));
assert_eq!((0, 2), search(1, &[1, 1, 1, 2]));
assert_eq!((0, 2), search(1, &[1, 1, 1]));
} | rust_cleaned_test_functions.jsonl/77387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
20541,
368,
341,
286,
5168,
2711,
2075,
25,
600,
21,
19,
11,
11943,
25,
44590,
72,
21,
19,
2467,
1464,
320,
51878,
11,
22301,
8,
341,
310,
1077,
11943,
25,
11312,
32399,
29,
284,
11943,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_return_result_with_vec() {
let gen_code = parse_code(
"test_return_result_with_vec",
r#"
foreigner_class!(class PosErr {
self_type PosErr;
constructor PosErr::new() -> PosErr;
});
foreigner_class!(class LocationService {
self_type LocationService;
constructor LocationService::new() -> LocationService;
method f1(&self) -> Result<Vec<u8>, PosErr>;
});
"#,
&[ForeignLang::Cpp],
);
let cpp_code_pair = code_for(&gen_code, ForeignLang::Cpp);
println!("c/c++: {}", cpp_code_pair.foreign_code);
assert!(
cpp_code_pair
.foreign_code
.contains(r#"std::variant<RustVecU8, PosErr> f1() const"#)
);
} | rust_cleaned_test_functions.jsonl/71624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12511,
5287,
6615,
13251,
368,
341,
262,
1077,
4081,
4136,
284,
4715,
4136,
1006,
286,
330,
1944,
12511,
5287,
6615,
13251,
756,
286,
435,
2,
698,
28443,
261,
4790,
10297,
1040,
18876,
7747,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_flag_unsatisfied_prereq() {
let store = TestStore::new();
let flag = store.flag("flagWithMissingPrereq").unwrap().clone();
assert!(flag.on);
let alice = User::with_key("alice").build();
let bob = User::with_key("bob").build();
for user in vec![&alice, &bob] {
let detail = evaluate(&store, &flag, user, None);
assert_that!(detail.value).contains_value(&Bool(false));
assert_that!(detail.reason).is_equal_to(&Reason::PrerequisiteFailed {
prerequisite_key: "badPrereq".to_string(),
});
}
} | rust_cleaned_test_functions.jsonl/133344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
10933,
4907,
82,
46265,
5294,
485,
80,
368,
341,
286,
1077,
3553,
284,
3393,
6093,
486,
931,
543,
286,
1077,
5181,
284,
3553,
41230,
445,
9903,
2354,
25080,
3533,
485,
80,
1827,
15454,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_stxh() {
disasm!("entrypoint:\n stxh [r1+0x2], r3\n");
disasm!("entrypoint:\n stxh [r1-0x2], r3\n");
} | rust_cleaned_test_functions.jsonl/68761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
87,
71,
368,
341,
262,
827,
10530,
17223,
4085,
2768,
7190,
77,
262,
357,
87,
71,
508,
81,
16,
10,
15,
87,
17,
1125,
435,
18,
1699,
797,
262,
827,
10530,
17223,
4085,
2768,
7190,
77,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_rsna_password_for_unprotected_network() {
let bss = fake_unprotected_bss_description(b"foo_bss".to_vec());
let credential = fidl_sme::Credential::Password("somepass".as_bytes().to_vec());
let rsna = get_rsna(&fake_device_info(CLIENT_ADDR), &credential, &bss);
assert!(rsna.is_err(), "expect error when password is supplied for unprotected network")
} | rust_cleaned_test_functions.jsonl/113759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
47115,
3376,
10122,
5478,
4907,
5764,
20966,
368,
341,
286,
1077,
293,
778,
284,
12418,
4907,
5764,
880,
778,
11448,
1883,
1,
7975,
880,
778,
3263,
983,
13251,
1423,
286,
1077,
40207,
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_building_rewrite_manager_populates_inspect() {
let inspector = fuchsia_inspect::Inspector::new();
let node = inspector.root().create_child("rewrite_manager");
let dynamic_rules = vec![
rule!("this.example.com" => "that.example.com", "/this_rolldice" => "/that_rolldice"),
];
let dynamic_config = make_rule_config(dynamic_rules.clone());
let static_rules =
vec![rule!("example.com" => "example.org", "/this_throwdice" => "/that_throwdice")];
let static_config = make_rule_config(static_rules.clone());
let _manager = RewriteManagerBuilder::new(Some(&dynamic_config))
.unwrap()
.static_rules_path(&static_config)
.unwrap()
.inspect_node(node)
.build();
assert_data_tree!(
inspector,
root: {
rewrite_manager: {
dynamic_rules: {
"0": {
host_match: "this.example.com",
host_replacement: "that.example.com",
path_prefix_match: "/this_rolldice",
path_prefix_replacement: "/that_rolldice",
},
},
dynamic_rules_path: format!("{:?}", Some(&*dynamic_config)),
static_rules: {
"0": {
host_match: "example.com",
host_replacement: "example.org",
path_prefix_match: "/this_throwdice",
path_prefix_replacement: "/that_throwdice",
},
},
generation: 0u64,
}
}
);
} | rust_cleaned_test_functions.jsonl/46504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1064
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82397,
74052,
12144,
17061,
23156,
34386,
987,
368,
341,
286,
1077,
44725,
284,
282,
73391,
34386,
987,
486,
46230,
486,
931,
543,
286,
1077,
2436,
284,
44725,
12576,
1005,
3182,
17268,
445,
52473,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_patterns() {
equal_tokens! {
<pipeline>
"cp ../formats/*" -> b::pipeline(vec![vec![b::bare("cp"), b::ws(" "), b::op("."), b::op("."), b::pattern("/formats/*")]])
}
equal_tokens! {
<pipeline>
"cp * /dev/null" -> b::pipeline(vec![vec![b::bare("cp"), b::ws(" "), b::pattern("*"), b::ws(" "), b::bare("/dev/null")]])
}
} | rust_cleaned_test_functions.jsonl/7263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64923,
368,
341,
286,
6144,
28838,
0,
341,
310,
366,
51258,
397,
310,
330,
4672,
22082,
63482,
1057,
1,
1464,
293,
486,
51258,
25592,
20703,
4083,
20703,
65,
486,
54102,
445,
4672,
3975,
293,
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_log_sum_exp() {
let a = Tensor::from_slice(
[10, 5],
&[
-0.5428, -0.0058, 0.7255, -0.5670, 0.2610, 1.2867, -1.3333, 0.4835, 1.6653, 1.6967,
0.8039, -0.6021, -0.6879, 1.1528, -2.4406, -1.7149, 0.1154, -0.6681, -0.8789,
1.0272, -0.3563, 0.3535, -1.8956, 1.7223, 0.2468, 1.4946, -0.2689, 1.6087, 0.5768,
0.1741, 0.3104, 0.2249, 0.5557, 0.2956, 0.2743, -1.1335, -2.1608, 0.8473, 0.9657,
0.9091, -0.4426, 0.1262, -0.4767, 0.0135, 1.9762, -1.6753, -0.2830, 1.6229,
-0.4841, 1.1718,
],
);
let b = Tensor::from_slice(
[10],
&[
1.7060, 2.7880, 1.8777, 1.6141, 2.2140, 2.5794, 1.9486, 2.0642, 2.3634, 2.2877,
],
);
assert!(a.log_sum_exp(-1, false).equals(&b, 0.001));
} | rust_cleaned_test_functions.jsonl/83679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 629
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
10160,
14214,
368,
341,
286,
1077,
264,
284,
26036,
486,
1499,
26488,
1006,
310,
508,
16,
15,
11,
220,
20,
1259,
310,
609,
9640,
394,
481,
15,
13,
20,
19,
17,
23,
11,
481,
15,
13,
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_get_device_label() {
if let Some(device) = test_get_default_device(Scope::Input) {
let name = get_device_label(device, DeviceType::INPUT).unwrap();
println!("input device label: {}", name.into_string());
} else {
println!("No input device.");
}
if let Some(device) = test_get_default_device(Scope::Output) {
let name = get_device_label(device, DeviceType::OUTPUT).unwrap();
println!("output device label: {}", name.into_string());
} else {
println!("No output device.");
}
} | rust_cleaned_test_functions.jsonl/113814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9204,
6106,
368,
341,
262,
421,
1077,
4329,
17848,
8,
284,
1273,
3062,
9993,
9204,
3759,
2417,
486,
2505,
8,
341,
286,
1077,
829,
284,
633,
9204,
6106,
17848,
11,
13903,
929,
486,
29421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new() {
assert_eq!(
ReferenceSequence::new("sq 0", 8),
Err(NewError::InvalidName)
);
assert_eq!(
ReferenceSequence::new("sq0", 0),
Err(NewError::InvalidLength(0))
);
} | rust_cleaned_test_functions.jsonl/23394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
2060,
10714,
33673,
310,
17207,
14076,
486,
931,
445,
28343,
220,
15,
497,
220,
23,
1326,
310,
15495,
35063,
1454,
486,
7928,
675,
340,
286,
3475,
286,
2060,
10714,
33673,
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_get_device_latency() {
if let Some(device) = test_get_default_device(Scope::Input) {
let latency = get_device_latency(device, DeviceType::INPUT).unwrap();
println!("latency of input device: {}", latency);
} else {
println!("No input device.");
}
if let Some(device) = test_get_default_device(Scope::Output) {
let latency = get_device_latency(device, DeviceType::OUTPUT).unwrap();
println!("latency of output device: {}", latency);
} else {
println!("No output device.");
}
} | rust_cleaned_test_functions.jsonl/113820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9204,
74832,
368,
341,
262,
421,
1077,
4329,
17848,
8,
284,
1273,
3062,
9993,
9204,
3759,
2417,
486,
2505,
8,
341,
286,
1077,
39270,
284,
633,
9204,
74832,
17848,
11,
13903,
929,
486,
2942... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_format_selected_field_range() {
new_ucmd!()
.args(&["--from=auto", "--field", "2-5", "1K 2K 3K 4K 5K 6K"])
.succeeds()
.stdout_only("1K 2000 3000 4000 5000 6K\n");
} | rust_cleaned_test_functions.jsonl/46019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
23755,
5013,
9698,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
1499,
28,
3902,
497,
14482,
2566,
497,
330,
17,
12,
20,
497,
330,
16,
42,
220,
17,
42,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_txn_store_txnkv_api_version() {
let test_data = vec![
(ApiVersion::V1, ApiVersion::V1, TIDB_KEY_CASE, true),
(ApiVersion::V1, ApiVersion::V1, TXN_KEY_CASE, true),
(ApiVersion::V1, ApiVersion::V1, RAW_KEY_CASE, true),
(ApiVersion::V1ttl, ApiVersion::V1, TXN_KEY_CASE, false),
(ApiVersion::V1, ApiVersion::V2, TIDB_KEY_CASE, false),
// storage api_version = V2.
(ApiVersion::V2, ApiVersion::V1, TIDB_KEY_CASE, true),
(ApiVersion::V2, ApiVersion::V1, TXN_KEY_CASE, false),
(ApiVersion::V2, ApiVersion::V1, RAW_KEY_CASE, false),
// V2 api validation.
(ApiVersion::V2, ApiVersion::V2, TXN_KEY_CASE, true),
(ApiVersion::V2, ApiVersion::V2, RAW_KEY_CASE, false),
(ApiVersion::V2, ApiVersion::V2, TIDB_KEY_CASE, false),
];
for (storage_api_version, req_api_version, key, is_legal) in test_data.into_iter() {
dispatch_api_version!(storage_api_version, {
let mut store = AssertionStorage::<_, API>::new();
store.ctx.set_api_version(req_api_version);
let mut end_key = key.to_vec();
if let Some(end_key) = end_key.last_mut() {
*end_key = 0xff;
}
if is_legal {
store.get_none(key, 10);
store.put_ok(key, b"x", 5, 10);
store.get_none(key, 9);
store.get_ok(key, 10, b"x");
store.batch_get_ok(&[key, key, key], 10, vec![b"x", b"x", b"x"]);
store.batch_get_command_ok(&[key, key, key], 10, vec![b"x", b"x", b"x"]);
store.scan_ok(key, Some(&end_key), 100, 10, vec![Some((key, b"x"))]);
store.scan_locks_ok(20, key, &end_key, 10, vec![]);
store.delete_range_ok(key, key);
} else {
store.get_err(key, 10);
store.batch_get_err(&[key, key, key], 10);
store.batch_get_command_err(&[key, key, key], 10);
store.scan_err(key, None, 100, 10);
store.scan_locks_err(20, key, &end_key, 10);
store.delete_range_err(key, key);
}
});
}
} | rust_cleaned_test_functions.jsonl/37892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
92299,
43408,
11697,
9438,
368,
341,
262,
1077,
1273,
1769,
284,
7486,
90515,
1789,
286,
320,
6563,
5637,
486,
53,
16,
11,
13443,
5637,
486,
53,
16,
11,
350,
915,
33,
6600,
28540,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_master_get_config_negative3() {
let (mut master, mut peer) = create_pair2();
let buf = vec![0x0; MAX_MSG_SIZE + 1];
let hdr = VhostUserMsgHeader::new(MasterReq::GET_CONFIG, 0x4, 16);
let mut msg = VhostUserConfig::new(0x100, 4, VhostUserConfigFlags::empty());
peer.send_message_with_payload(&hdr, &msg, &buf[0..4], None)
.unwrap();
assert!(master
.get_config(0x100, 4, VhostUserConfigFlags::WRITABLE, &buf[0..4])
.is_ok());
msg.offset = 0;
peer.send_message_with_payload(&hdr, &msg, &buf[0..4], None)
.unwrap();
assert!(master
.get_config(0x100, 4, VhostUserConfigFlags::WRITABLE, &buf[0..4])
.is_err());
} | rust_cleaned_test_functions.jsonl/75353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24582,
3062,
5332,
53865,
18,
368,
341,
286,
1077,
320,
6984,
7341,
11,
5206,
14397,
8,
284,
1855,
14445,
17,
543,
286,
1077,
6607,
284,
7486,
20703,
15,
87,
15,
26,
8334,
14372,
4098,
488,
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_parse_utf8_char() {
let input = " A demo\u{0}";
match parse_utf8_char(input, "MADRU ") {
Some((c, rest)) => {assert!(rest == "A demo\u{0}"); assert!(c == ' ');},
None => assert!(false)
};
match parse_utf8_char(input, "MADRU") {
Some(_) => assert!(false),
None => assert!(true)
};
} | rust_cleaned_test_functions.jsonl/72356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
39453,
23,
9232,
368,
341,
286,
1077,
1946,
284,
330,
362,
16661,
3770,
90,
15,
71612,
286,
2432,
4715,
39453,
23,
9232,
5384,
11,
330,
44,
1808,
36003,
12310,
341,
310,
4329,
1188,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_serialize_publish_options() {
let reference: Element = "<publish-options xmlns='http://jabber.org/protocol/pubsub'><x xmlns='jabber:x:data' type='submit'/></publish-options>"
.parse()
.unwrap();
let elem: Element = "<x xmlns='jabber:x:data' type='submit'/>".parse().unwrap();
let form = DataForm::try_from(elem).unwrap();
let options = PublishOptions { form: Some(form) };
let serialized: Element = options.into();
assert_eq!(serialized, reference);
} | rust_cleaned_test_functions.jsonl/125432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
58779,
8743,
368,
341,
286,
1077,
5785,
25,
8543,
284,
4055,
27502,
39733,
24967,
1131,
1254,
1110,
38916,
652,
2659,
14,
17014,
59492,
1966,
18407,
87,
24967,
1131,
38916,
652,
35254,
41784,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary() {
let add = Stmt::Expr(binary(literal(2f64), Plus, literal(3f64)));
let sub = Stmt::Expr(binary(literal(2f64), Minus, literal(3f64)));
let mul = Stmt::Expr(binary(literal(2f64), Star, literal(3f64)));
let div = Stmt::Expr(binary(literal(2f64), Slash, literal(4f64)));
let pow = Stmt::Expr(binary(literal(2f64), Power, literal(3f64)));
let equals = Stmt::Expr(binary(literal(2f64), Equals, literal(3f64)));
let not_equals = Stmt::Expr(binary(literal(2f64), NotEquals, literal(3f64)));
let greater_than = Stmt::Expr(binary(literal(2f64), GreaterThan, literal(3f64)));
let less_than = Stmt::Expr(binary(literal(2f64), LessThan, literal(3f64)));
let greater_or_equals = Stmt::Expr(binary(literal(2f64), GreaterOrEquals, literal(3f64)));
let less_or_equals = Stmt::Expr(binary(literal(2f64), LessOrEquals, literal(3f64)));
assert_eq!(interpret(add).unwrap().unwrap().to_f64(), 5f64);
assert_eq!(interpret(sub).unwrap().unwrap().to_f64(), -1f64);
assert_eq!(interpret(mul).unwrap().unwrap().to_f64(), 6f64);
assert_eq!(interpret(div).unwrap().unwrap().to_f64(), 0.5f64);
assert_eq!(interpret(pow).unwrap().unwrap().to_f64(), 8f64);
let result = interpret(equals).unwrap().unwrap();
assert_eq!(
(result.to_f64(), result.boolean_value.unwrap()),
(3f64, false)
);
let result = interpret(not_equals).unwrap().unwrap();
assert_eq!(
(result.to_f64(), result.boolean_value.unwrap()),
(3f64, true)
);
let result = interpret(greater_than).unwrap().unwrap();
assert_eq!(
(result.to_f64(), result.boolean_value.unwrap()),
(3f64, false)
);
let result = interpret(less_than).unwrap().unwrap();
assert_eq!(
(result.to_f64(), result.boolean_value.unwrap()),
(3f64, true)
);
let result = interpret(greater_or_equals).unwrap().unwrap();
assert_eq!(
(result.to_f64(), result.boolean_value.unwrap()),
(3f64, false)
);
let result = interpret(less_or_equals).unwrap().unwrap();
assert_eq!(
(result.to_f64(), result.boolean_value.unwrap()),
(3f64, true)
);
} | rust_cleaned_test_functions.jsonl/103395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
368,
341,
286,
1077,
912,
284,
97023,
486,
16041,
63926,
2333,
9953,
7,
17,
69,
21,
19,
701,
12343,
11,
23141,
7,
18,
69,
21,
19,
4945,
286,
1077,
1186,
284,
97023,
486,
16041,
63926,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sprague_rows() {
use crate::{NONE, NONE2};
use nalgebra::matrix;
let m_in = matrix!(
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0;
1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0;
1.0, 4.0, 9.0, 16.0, 16.0, 9.0, 4.0, 1.0;
);
println! {"{}", m_in};
let from_domain = Domain::new(2, 9, NONE2);
let to_domain2 = Domain::new(3, 19, NONE);
println! {"{}", sprague_rows(&from_domain, &from_domain, &m_in)};
println! {"{:.2}", sprague_rows(&from_domain, &to_domain2, &m_in)};
} | rust_cleaned_test_functions.jsonl/82197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
649,
4663,
10949,
368,
341,
262,
990,
17717,
22964,
45425,
11,
42869,
17,
2440,
262,
990,
84533,
26083,
486,
18110,
280,
262,
1077,
296,
1243,
284,
6172,
33673,
286,
220,
16,
13,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cstr_mut_write() {
let mut buf = vec![0; 9];
let mut cstr_mut = unsafe { CStrMut::new(buf.as_mut_ptr(), buf.len()) };
use std::fmt::Write;
assert!(write!(&mut cstr_mut, "test").is_ok());
assert!(buf.starts_with(b"test\0"));
assert!(write!(&mut cstr_mut, " foo").is_ok());
assert!(buf.starts_with(b"test foo\0"));
} | rust_cleaned_test_functions.jsonl/42137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
495,
29523,
9165,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
20703,
15,
26,
220,
24,
935,
286,
1077,
5206,
272,
495,
29523,
284,
19860,
314,
356,
2580,
51440,
486,
931,
10731,
5357,
29523,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_with_a_newly_included_range() {
let source_code = "<div><%= foo() %></div><span><%= bar() %></span><%= baz() %>";
let range1_start = source_code.find(" foo").unwrap();
let range2_start = source_code.find(" bar").unwrap();
let range3_start = source_code.find(" baz").unwrap();
let range1_end = range1_start + 7;
let range2_end = range2_start + 7;
let range3_end = range3_start + 7;
// Parse only the first code directive as JavaScript
let mut parser = Parser::new();
parser.set_language(get_language("javascript")).unwrap();
parser
.set_included_ranges(&[simple_range(range1_start, range1_end)])
.unwrap();
let tree = parser.parse(source_code, None).unwrap();
assert_eq!(
tree.root_node().to_sexp(),
concat!(
"(program",
" (expression_statement (call_expression function: (identifier) arguments: (arguments))))",
)
);
// reference.
parser
.set_included_ranges(&[
simple_range(range1_start, range1_end),
simple_range(range3_start, range3_end),
])
.unwrap();
let tree2 = parser.parse(&source_code, Some(&tree)).unwrap();
assert_eq!(
tree2.root_node().to_sexp(),
concat!(
"(program",
" (expression_statement (call_expression function: (identifier) arguments: (arguments)))",
" (expression_statement (call_expression function: (identifier) arguments: (arguments))))",
)
);
assert_eq!(
tree2.changed_ranges(&tree).collect::<Vec<_>>(),
&[simple_range(range1_end, range3_end)]
);
// reference.
parser
.set_included_ranges(&[
simple_range(range1_start, range1_end),
simple_range(range2_start, range2_end),
simple_range(range3_start, range3_end),
])
.unwrap();
let tree3 = parser.parse(&source_code, Some(&tree)).unwrap();
assert_eq!(
tree3.root_node().to_sexp(),
concat!(
"(program",
" (expression_statement (call_expression function: (identifier) arguments: (arguments)))",
" (expression_statement (call_expression function: (identifier) arguments: (arguments)))",
" (expression_statement (call_expression function: (identifier) arguments: (arguments))))",
)
);
assert_eq!(
tree3.changed_ranges(&tree2).collect::<Vec<_>>(),
&[simple_range(range2_start + 1, range2_end - 1)]
);
} | rust_cleaned_test_functions.jsonl/15880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
6615,
4306,
5921,
398,
1243,
10181,
9698,
368,
341,
262,
1077,
2530,
4136,
284,
4055,
611,
1784,
35205,
15229,
368,
1018,
1472,
611,
1784,
1480,
1784,
35205,
3619,
368,
1018,
1472,
148... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_head_content_length_headers() {
let mut srv = test::init_service(
App::new().service(Files::new("test", ".").index_file("tests/test.binary")),
);
// Valid range header
let request = TestRequest::default()
.method(Method::HEAD)
.uri("/t%65st/tests/test.binary")
.to_request();
let _response = test::call_service(&mut srv, request);
// TODO: fix check
// let contentlength = response
} | rust_cleaned_test_functions.jsonl/35494 | {
"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,
13138,
7495,
5118,
26719,
368,
341,
286,
1077,
5206,
43578,
284,
1273,
486,
2327,
12267,
1006,
310,
1845,
486,
931,
1005,
7936,
7,
10809,
486,
931,
445,
1944,
497,
22760,
568,
1252,
2458,
445,
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_cred_def_id_parts_for_id_as_unqualified_without_tag_with_schema_as_seq_no() {
assert_eq!(
_cred_def_id_unqualified_with_schema_as_seq_no(),
_cred_def_id_unqualified_with_schema_as_seq_no().to_unqualified()
);
} | rust_cleaned_test_functions.jsonl/38081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73475,
7844,
842,
33217,
5478,
842,
11898,
4907,
36335,
39904,
9372,
6615,
25371,
11898,
14486,
6536,
368,
341,
310,
2060,
10714,
33673,
394,
716,
10844,
7844,
842,
4907,
36335,
6615,
25371,
11898,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_index_manual_policy_mmap() {
let schema = throw_away_schema();
let field = schema.get_field("num_likes").unwrap();
let mut index = Index::create_from_tempdir(schema).unwrap();
let mut writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
writer.commit().unwrap();
let reader = index
.reader_builder()
.reload_policy(ReloadPolicy::Manual)
.try_into()
.unwrap();
assert_eq!(reader.searcher().num_docs(), 0);
writer.add_document(doc!(field=>1u64));
let (sender, receiver) = crossbeam::channel::unbounded();
let _handle = index.directory_mut().watch(Box::new(move || {
let _ = sender.send(());
}));
writer.commit().unwrap();
assert!(receiver.recv().is_ok());
assert_eq!(reader.searcher().num_docs(), 0);
reader.reload().unwrap();
assert_eq!(reader.searcher().num_docs(), 1);
} | rust_cleaned_test_functions.jsonl/117332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 556
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
75428,
22773,
717,
2186,
368,
341,
310,
1077,
10802,
284,
2510,
62,
13757,
25371,
543,
310,
1077,
2070,
284,
10802,
670,
5013,
445,
2413,
89178,
1827,
15454,
543,
310,
1077,
5206,
1922,
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_refresh_neuron_by_id_by_controller() {
let owner = *TEST_NEURON_1_OWNER_PRINCIPAL;
refresh_neuron_by_id_or_subaccount(owner, owner, RefreshBy::NeuronId);
} | rust_cleaned_test_functions.jsonl/1152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42076,
13925,
36090,
3710,
842,
3710,
21600,
368,
341,
262,
1077,
6372,
284,
353,
10033,
14039,
1511,
711,
62,
16,
74323,
10571,
38439,
3298,
969,
280,
262,
10408,
13925,
36090,
3710,
842,
8734,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_builder_i32_empty() {
let mut b = Int32BufferBuilder::new(5);
assert_eq!(0, b.len());
assert_eq!(16, b.capacity());
let a = b.finish();
assert_eq!(0, a.len());
} | rust_cleaned_test_functions.jsonl/30959 | {
"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,
28532,
5318,
18,
17,
15124,
368,
341,
286,
1077,
5206,
293,
284,
1333,
18,
17,
4095,
3297,
486,
931,
7,
20,
317,
286,
2060,
10714,
10297,
15,
11,
293,
19406,
1423,
286,
2060,
10714,
10297,
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_stale_peer_destroy_when_apply_snapshot() {
let mut cluster = new_node_cluster(0, 3);
configure_for_snapshot(&mut cluster);
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
cluster.run();
cluster.must_put(b"k1", b"v1");
must_get_equal(&cluster.get_engine(2), b"k1", b"v1");
must_get_equal(&cluster.get_engine(3), b"k1", b"v1");
cluster.add_send_filter(IsolationFilterFactory::new(3));
for i in 2..10 {
cluster.must_put(format!("k{}", i).as_bytes(), b"v1");
}
let region_apply_snap_fp = "region_apply_snap";
fail::cfg(region_apply_snap_fp, "pause").unwrap();
let (notify_tx, notify_rx) = mpsc::channel();
cluster.sim.wl().add_recv_filter(
3,
Box::new(MessageTypeNotifier::new(
MessageType::MsgSnapshot,
notify_tx,
Arc::new(AtomicBool::new(true)),
)),
);
cluster.clear_send_filters();
// Wait for leader sending snapshot to peer 3
notify_rx.recv_timeout(Duration::from_secs(5)).unwrap();
let region = pd_client.get_region(b"k1").unwrap();
// Wait for peer 3 handling snapshot
let timer = Instant::now();
loop {
let local_state = cluster.region_local_state(region.get_id(), 3);
if local_state.get_state() == PeerState::Applying {
break;
}
if timer.saturating_elapsed() > Duration::from_secs(3) {
panic!("not become applying state after 3 seconds.");
}
sleep_ms(10);
}
pd_client.must_remove_peer(region.get_id(), new_peer(3, 3));
let region = pd_client.get_region(b"k1").unwrap();
let mut tombstone_msg = RaftMessage::default();
tombstone_msg.set_region_id(region.get_id());
tombstone_msg.set_from_peer(new_peer(3, 3));
tombstone_msg.set_to_peer(new_peer(3, 3));
tombstone_msg.set_region_epoch(region.get_region_epoch().clone());
tombstone_msg.set_is_tombstone(true);
cluster
.sim
.wl()
.send_raft_msg(tombstone_msg.clone())
.unwrap();
// Wait for cancelling snapshot
sleep_ms(100);
fail::remove(region_apply_snap_fp);
// Wait for peer 3 changing `SnapState`
sleep_ms(100);
cluster.sim.wl().send_raft_msg(tombstone_msg).unwrap();
must_get_none(&cluster.get_engine(3), b"k1");
} | rust_cleaned_test_functions.jsonl/39366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1052
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
1574,
45159,
18066,
47636,
36551,
53265,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
5478,
53265,
2099,
6984,
10652,
317,
262,
1077,
7744,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sort() {
let v = to_value(vec![3, -1, 2, 5, 4]).unwrap();
let args = HashMap::new();
let result = sort(&v, &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(vec![-1, 2, 3, 4, 5]).unwrap());
} | rust_cleaned_test_functions.jsonl/62049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
368,
341,
286,
1077,
348,
284,
311,
3142,
25592,
20703,
18,
11,
481,
16,
11,
220,
17,
11,
220,
20,
11,
220,
19,
10697,
15454,
543,
286,
1077,
2827,
284,
10528,
486,
931,
543,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_b64_errors() {
// No end padding
{
let unpad_cfg = Config::B64.end_padding(false);
{
let err = unpad_cfg.encode::<2>(&[0xAB, 0xCD]).unwrap_err();
assert!(err.expected() == 2 && err.found() == 3, "{:?}", err);
}
assert_eq!(unpad_cfg.encode::<3>(&[0xAB, 0xCD]).unwrap(), *b"q80");
{
let err = unpad_cfg.encode::<4>(&[0xAB, 0xCD]).unwrap_err();
assert!(err.expected() == 4 && err.found() == 3, "{:?}", err);
}
}
// With end padding
{
let err = Config::B64.encode::<3>(&[0xAB, 0xCD]).unwrap_err();
assert!(err.expected() == 3 && err.found() == 4, "{:?}", err);
}
assert_eq!(Config::B64.encode::<4>(&[0xAB, 0xCD]).unwrap(), *b"q80=");
{
let err = Config::B64.encode::<5>(&[0xAB, 0xCD]).unwrap_err();
assert!(err.expected() == 5 && err.found() == 4, "{:?}", err);
}
} | rust_cleaned_test_functions.jsonl/98054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 507
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
880,
21,
19,
20196,
368,
341,
262,
442,
2308,
835,
5300,
198,
262,
341,
286,
1077,
650,
13242,
18343,
284,
5532,
486,
33,
21,
19,
5073,
40726,
3576,
626,
286,
341,
310,
1077,
1848,
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_should_succeed_if_range_out_of_bounds() {
new_ucmd!()
.args(&["--from=auto", "--field", "5-10", "1K 2K 3K 4K 5K 6K"])
.succeeds()
.stdout_only("1K 2K 3K 4K 5000 6000\n");
} | rust_cleaned_test_functions.jsonl/46020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
643,
29264,
11119,
9698,
6068,
3575,
36878,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
1499,
28,
3902,
497,
14482,
2566,
497,
330,
20,
12,
16,
15,
497,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_client_missing_settings() {
let (mut hconn, mut neqo_trans_conn) = connect_and_receive_settings(Client);
// Create server control stream.
let control_stream = neqo_trans_conn.stream_create(StreamType::UniDi).unwrap();
let sent = neqo_trans_conn.stream_send(control_stream, &[0x0, 0x1, 0x3, 0x0, 0x1, 0x2]);
assert_eq!(sent, Ok(6));
let out = neqo_trans_conn.process(None, now());
hconn.process(out.dgram(), now());
assert_closed(&hconn, Error::MissingSettings);
} | rust_cleaned_test_functions.jsonl/10915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
40447,
10853,
368,
341,
286,
1077,
320,
6984,
305,
5148,
11,
5206,
834,
80,
78,
7965,
17241,
8,
284,
4564,
8378,
38557,
10853,
46851,
317,
286,
442,
4230,
3538,
2524,
4269,
624,
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_check_transaction_for_nonce_not_nonce_fail() {
let mut feature_set = FeatureSet::all_enabled();
feature_set.deactivate(&tx_wide_compute_cap::id());
let (bank, _mint_keypair, custodian_keypair, nonce_keypair) =
setup_nonce_with_bank(10_000_000, |_| {}, 5_000_000, 250_000, None, feature_set)
.unwrap();
let custodian_pubkey = custodian_keypair.pubkey();
let nonce_pubkey = nonce_keypair.pubkey();
let nonce_hash = get_nonce_blockhash(&bank, &nonce_pubkey).unwrap();
let tx = Transaction::new_signed_with_payer(
&[
system_instruction::transfer(&custodian_pubkey, &nonce_pubkey, 100_000),
system_instruction::advance_nonce_account(&nonce_pubkey, &nonce_pubkey),
],
Some(&custodian_pubkey),
&[&custodian_keypair, &nonce_keypair],
nonce_hash,
);
assert!(bank
.check_transaction_for_nonce(
&SanitizedTransaction::from_transaction_for_tests(tx,),
true, // enable_durable_nonce
&bank.next_durable_nonce(),
)
.is_none());
} | rust_cleaned_test_functions.jsonl/28920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
28884,
5478,
48508,
7913,
48508,
22121,
368,
341,
286,
1077,
5206,
4565,
2602,
284,
19998,
1649,
486,
541,
18220,
543,
286,
4565,
2602,
2285,
16856,
2099,
3998,
1670,
577,
57028,
16388,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_modem_status_command() {
let buf = [
0b11100011,
0b00000111,
0b00001111,
0b00000000,
0b00000001,
];
let expected = MuxCommand {
params: MuxCommandParams::ModemStatus(ModemStatusParams {
dlci: DLCI::try_from(3).unwrap(),
signals: ModemStatusSignals(0),
break_value: None,
}),
command_response: CommandResponse::Command,
};
assert_eq!(MuxCommand::decode(&buf[..]).unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/107776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
7480,
336,
4773,
10811,
368,
341,
286,
1077,
6607,
284,
2278,
310,
220,
15,
65,
16,
16,
16,
15,
15,
15,
16,
16,
11,
715,
310,
220,
15,
65,
15,
15,
15,
15,
15,
16,
16,
16,
11,
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... | 1 |
#[test]
fn test_load_header() {
// deploy contract
let mut context = Context::default();
let test_contract_bin = fs::read(TEST_CONTRACT_PATH).unwrap();
let lock_out_point = context.deploy_cell(test_contract_bin.to_vec().into());
let lock_script = context
.build_script(&lock_out_point, Bytes::from(vec![42]))
.expect("script")
.as_builder()
.build();
// prepare cells
let input_out_point = context.create_cell(
CellOutput::new_builder()
.capacity(1000u64.pack())
.lock(lock_script.clone())
.build(),
Bytes::new(),
);
let input = CellInput::new_builder()
.previous_output(input_out_point.clone())
.build();
let dep_out_point = context.deploy_cell(Vec::new().into());
let dep_cell = CellDep::new_builder()
.out_point(dep_out_point.clone())
.build();
let outputs = vec![
CellOutput::new_builder()
.capacity(500u64.pack())
.lock(lock_script.clone())
.build(),
CellOutput::new_builder()
.capacity(500u64.pack())
.lock(lock_script)
.build(),
];
let outputs_data = vec![Bytes::new(); 2];
// prepare headers
let h1 = Header::new_builder()
.raw(RawHeader::new_builder().number(1u64.pack()).build())
.build()
.into_view();
let h2 = Header::new_builder()
.raw(RawHeader::new_builder().number(2u64.pack()).build())
.build()
.into_view();
let h3 = Header::new_builder()
.raw(RawHeader::new_builder().number(3u64.pack()).build())
.build()
.into_view();
context.insert_header(h1.clone());
context.insert_header(h2.clone());
context.insert_header(h3.clone());
context.link_cell_with_block(input_out_point, h1.hash(), 0);
context.link_cell_with_block(dep_out_point, h2.hash(), 5);
// build transaction
let tx = TransactionBuilder::default()
.input(input)
.outputs(outputs)
.outputs_data(outputs_data.pack())
.cell_dep(dep_cell)
.header_dep(h3.hash())
.header_dep(h2.hash())
.header_dep(h1.hash())
.build();
let tx = context.complete_tx(tx);
// run
context
.verify_tx(&tx, MAX_CYCLES)
.expect("pass verification");
} | rust_cleaned_test_functions.jsonl/92568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
8757,
368,
341,
262,
442,
10517,
5116,
198,
262,
1077,
5206,
2266,
284,
9608,
486,
2258,
543,
262,
1077,
1273,
51499,
21816,
284,
8619,
486,
878,
50320,
4307,
41105,
7944,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_hex() {
use rand::Rng;
for _ in 0..20000 {
let bytes = rand::thread_rng().gen::<[u64; 1]>();
let f = f64::from_bits(bytes[0]);
if !f.is_finite() {
continue;
}
let hex = to_hex(f);
let roundtrip = hexf_parse::parse_hexf64(&hex, false).unwrap();
assert!(f == roundtrip, "{} {} {}", f, hex, roundtrip);
}
} | rust_cleaned_test_functions.jsonl/32744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
32655,
368,
341,
262,
990,
10382,
486,
49,
968,
280,
262,
369,
716,
304,
220,
15,
496,
17,
15,
15,
15,
15,
341,
286,
1077,
5820,
284,
10382,
486,
4528,
66849,
1005,
4370,
27638,
58,
84... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_shapes() {
let iter: GTFSIterator<_, ShapePoint> =
GTFSIterator::from_path("./examples/good_feed/shapes.txt").unwrap();
for result in iter {
assert!(result.is_ok(), format!("{}", result.err().unwrap()));
}
} | rust_cleaned_test_functions.jsonl/7509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
71315,
368,
341,
262,
1077,
5367,
25,
11911,
8485,
11951,
27,
6878,
22526,
2609,
29,
4035,
286,
11911,
8485,
11951,
486,
1499,
2638,
13988,
51668,
4846,
1386,
42390,
14688,
9337,
3909,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_filter() {
let f = PartitionFilter::extract(
&Schema::new(vec![]),
&[Expr::Literal(ScalarValue::Boolean(Some(true)))],
);
assert_eq!(f.min_max, vec![]);
assert!(f.can_match(Some(&[]), Some(&[])));
} | rust_cleaned_test_functions.jsonl/65535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
8727,
368,
341,
286,
1077,
282,
284,
54626,
5632,
486,
23493,
1006,
310,
609,
8632,
486,
931,
25592,
0,
1294,
1326,
310,
44590,
16041,
486,
17350,
7,
20639,
1130,
486,
6890,
65405,
3715,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_happy_path() {
use super::CaptureSink;
use crate::ground::Variable;
use crate::matching::plan::Source;
use crate::unification::Element;
use differential_dataflow::input::InputSession;
use std::collections::HashSet;
let x = MetaVar::new("x");
let source = Source::new("foo", 2);
let pattern = [Element::Reference(x.clone()), Element::Reference(x.clone())];
let filter = Plan::filter(source.clone(), &pattern).expect("ok");
let sink = CaptureSink::new(filter.result().into());
let writer = sink.writer();
timely::execute::example(move |scope| {
let mut foo = InputSession::new();
let sources = vec![(
"foo".into(),
FactCollection::new(2, foo.to_collection(scope)),
)]
.into_iter()
.collect::<std::collections::HashMap<String, _>>();
let captures =
lower_matching_plan(scope, &mut default_injector, &filter, &sources).expect("ok");
writer.attach(&captures).expect("ok");
foo.advance_to(0);
for i in 1..10 {
if (i % 2) == 0 {
foo.insert([Variable::new(i), Variable::new(i)].into());
} else {
foo.insert([Variable::new(i), Variable::new(i + 1)].into());
}
}
foo.flush();
foo.advance_to(1);
});
assert_eq!(
sink.values::<HashSet<_>>(),
[2, 4, 6, 8]
.iter()
.map(|i| [Variable::new(*i)].into())
.collect()
);
} | rust_cleaned_test_functions.jsonl/31138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
1523,
11144,
2638,
368,
341,
262,
990,
2256,
486,
27429,
45094,
280,
262,
990,
17717,
486,
1951,
486,
7827,
280,
262,
990,
17717,
486,
89043,
486,
10393,
486,
3608,
280,
262,
990,
17717,
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_two_rule_bodies_not_nested() -> TestResult {
let p = polar();
p.load_str(
r#"f(x) if a(x);
f(1);
a(_x) if false;"#,
)?;
qvar(&p, "f(x)", "x", values![1]);
Ok(())
} | rust_cleaned_test_functions.jsonl/68108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
21124,
880,
10028,
7913,
66279,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
5104,
2895,
1006,
286,
435,
55543,
69,
2075,
8,
421,
264,
2075,
317,
1843,
282,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_hash_to_try_and_increment_2() {
let data = hex::decode("68656c6c6f").unwrap();
let hash_point = Bn256.hash_to_try_and_increment(&data).unwrap();
let hash_bytes = Bn256.to_compressed_g1(hash_point).unwrap();
let expected_hash = "0200b201235f522abbd3863b7496dfa213be0ed1f4c7a22196d8afddec7e64c8ec";
assert_eq!(hex::encode(hash_bytes), expected_hash);
} | rust_cleaned_test_functions.jsonl/65095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
2346,
53283,
8378,
51482,
62,
17,
368,
341,
1789,
286,
1077,
821,
284,
12371,
486,
18196,
445,
21,
23,
21,
20,
21,
66,
21,
66,
21,
69,
1827,
15454,
543,
286,
1077,
5175,
6085,
284,
425... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kill_with_signal() {
use nix::sys::signal;
use nix::unistd::Pid;
unsafe {
let result = run_in_pty(|| {
signal::kill(Pid::this(), Signal::SIGKILL).expect("sending signal should succeed");
std::thread::sleep(Duration::from_secs(3));
Ok(())
});
assert!(
matches!(result, Err(Error::KilledBySignal(Signal::SIGKILL))),
"expected child process to kill itself with SIGKILL"
);
}
} | rust_cleaned_test_functions.jsonl/20654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73327,
6615,
21137,
368,
341,
286,
990,
308,
941,
486,
7791,
486,
26622,
280,
286,
990,
308,
941,
486,
27483,
486,
32339,
280,
286,
19860,
341,
310,
1077,
1102,
284,
1598,
1243,
62,
1595,
79453,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rev_iterator() {
use iter::*;
let xs = [1, 2, 5, 10, 11];
let ys = [11, 10, 5, 2, 1];
let mut i = 0;
for &x in xs.rev_iter() {
assert_eq!(x, ys[i]);
i += 1;
}
assert_eq!(i, 5);
} | rust_cleaned_test_functions.jsonl/117101 | {
"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,
38082,
13491,
368,
341,
286,
990,
5367,
79304,
286,
1077,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
20,
11,
220,
16,
15,
11,
220,
16,
16,
935,
286,
1077,
31810,
284,
508,
16,
16,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_purge() {
let key = Keypair::new();
let mut index = AccountsIndex::<u64>::default();
let mut gc = Vec::new();
assert_eq!(Some(12), index.update(1, &key.pubkey(), 12, &mut gc));
index.insert(1, &key.pubkey(), 12, &mut gc);
assert_eq!(None, index.update(1, &key.pubkey(), 10, &mut gc));
let purges = index.purge(&key.pubkey());
assert_eq!(purges, (vec![], false));
index.add_root(1);
let purges = index.purge(&key.pubkey());
assert_eq!(purges, (vec![(1, 10)], true));
assert_eq!(None, index.update(1, &key.pubkey(), 9, &mut gc));
} | rust_cleaned_test_functions.jsonl/20406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
368,
341,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5206,
1922,
284,
40655,
1552,
27638,
84,
21,
19,
6831,
2258,
543,
286,
1077,
5206,
22122,
284,
11312,
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_reset() {
let mut ema = ExponentialMovingAverage::new(5).unwrap();
assert_eq!(ema.next(4.0), 4.0);
ema.next(10.0);
ema.next(15.0);
ema.next(20.0);
assert_ne!(ema.next(4.0), 4.0);
ema.reset();
assert_eq!(ema.next(4.0), 4.0);
} | rust_cleaned_test_functions.jsonl/124095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18983,
368,
341,
286,
1077,
5206,
976,
64,
284,
1374,
59825,
39732,
26292,
486,
931,
7,
20,
568,
15454,
1428,
286,
2060,
10714,
10297,
9176,
4529,
7,
19,
13,
15,
701,
220,
19,
13,
15,
317,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_populate_rewards_not_funded() {
let gen = |c, r| -> Vec<(RemoteAccountOf<Test>, RewardAmountOf<Test>, VestingPeriodOf<Test>)> {
generate_accounts(c)
.into_iter()
.map(|(_, account)| (account.as_remote_public(), r, DEFAULT_VESTING_PERIOD))
.collect()
};
ExtBuilder::default().build().execute_with(|| {
Balances::make_free_balance_be(&CrowdloanRewards::account_id(), 0);
assert_noop!(
CrowdloanRewards::populate(Origin::root(), gen(100, DEFAULT_REWARD)),
Error::<Test>::RewardsNotFunded
);
});
} | rust_cleaned_test_functions.jsonl/41079 | {
"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,
17061,
6334,
77997,
7913,
761,
36053,
368,
341,
10217,
4081,
284,
760,
66,
11,
435,
91,
1464,
11312,
28706,
24703,
7365,
2124,
71273,
8066,
55800,
10093,
2124,
71273,
8066,
55888,
287,
23750,
2124,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_eval_fail_1() {
#[derive(Debug, Clone, Copy)]
struct FnFoo;
impl_template_fn! { 1 arg @ FnFoo }
impl FnFoo {
fn call(
_ctx: &mut EvalContext,
_payload: RpnFnCallPayload<'_>,
_v: &Option<i64>,
) -> Result<Option<i64>> {
unreachable!()
}
}
let rpn_nodes = vec![RpnExpressionNode::FnCall {
func: Box::new(FnFoo),
field_type: {
let mut ft = FieldType::new();
ft.as_mut_accessor().set_tp(FieldTypeTp::LongLong);
ft
},
}];
let exp = RpnExpression::from(rpn_nodes);
let mut ctx = EvalContext::default();
let mut columns = LazyBatchColumnVec::from(vec![]);
let hooked_eval = ::panic_hook::recover_safe(|| {
let _ = exp.eval(&mut ctx, 3, &[], &mut columns);
});
assert!(hooked_eval.is_err());
} | rust_cleaned_test_functions.jsonl/121518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
22121,
62,
16,
368,
341,
286,
11506,
27098,
42618,
11,
27913,
11,
14540,
5563,
286,
2036,
50182,
40923,
401,
286,
11605,
8693,
15246,
0,
314,
220,
16,
1392,
569,
50182,
40923,
555,
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... | 1 |
#[test]
fn test_circuit_with_small_tables() {
use crate::pairing::bn256::{Bn256, Fr};
use crate::worker::Worker;
let mut assembly = TrivialAssembly::<Bn256, PlonkCsWidth4WithNextStepParams, Width4MainGateWithDNext>::new();
let circuit = TestCircuit4WithLookupsManyGatesSmallTable::<Bn256> {
_marker: PhantomData
};
circuit.synthesize(&mut assembly).expect("must work");
println!("Assembly contains {} gates", assembly.n());
assert!(assembly.is_satisfied());
assert_eq!(assembly.gates.len(), 1);
assert_eq!(assembly.total_length_of_all_tables, 4*4 + 4*4 + 4);
assembly.finalize();
println!("Finalized assembly contains {} gates", assembly.n());
let worker = Worker::new();
let _ = assembly.prover_stub(&worker).unwrap();
} | rust_cleaned_test_functions.jsonl/78085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
37268,
6615,
31966,
35632,
368,
341,
286,
990,
17717,
486,
12670,
287,
486,
11081,
17,
20,
21,
22964,
33,
77,
17,
20,
21,
11,
2869,
2440,
286,
990,
17717,
486,
21462,
486,
21936,
401,
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_partial_add_front() {
let mut assr = contigs![(4, 8), (4, 0)];
assert_eq!(assr.add(0, 4), Ok(()));
assert_eq!(assr, contigs![(0, 12), (4, 0)]);
} | rust_cleaned_test_functions.jsonl/52005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
2891,
22926,
368,
341,
286,
1077,
5206,
1071,
81,
284,
683,
14462,
0,
9697,
19,
11,
220,
23,
701,
320,
19,
11,
220,
15,
12587,
286,
2060,
10714,
10297,
395,
81,
1364,
7,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_code_spectral_envelope() {
let x: Vec<f64> = vec![0.0; 256];
let x_length = x.len() as i32;
let fs = 44100_i32;
let temporal_positions = vec![0.0, 0.005];
let f0 = vec![0.0, 0.0];
let f0_length = f0.len() as i32;
let mut option = CheapTrickOption::new(fs);
unsafe {
GetFFTSizeForCheapTrick(fs, &mut option as *mut _);
}
let number_of_dimensions = 256_i32;
let xl = (option.fft_size/2+1) as usize;
let yl = f0_length as usize;
let mut spectrogram = vec![vec![0.0; xl]; yl];
let mut spectrogram_ptr = spectrogram.iter_mut().map(|inner| inner.as_mut_ptr()).collect::<Vec<_>>();
let spectrogram_ptr = spectrogram_ptr.as_mut_ptr();
unsafe {
CheapTrick(x.as_ptr(), x_length, fs, temporal_positions.as_ptr(), f0.as_ptr(), f0_length, &option as *const _, spectrogram_ptr);
}
let spectrogram_ptr = spectrogram.iter().map(|inner| inner.as_ptr()).collect::<Vec<_>>();
let spectrogram_ptr = spectrogram_ptr.as_ptr();
let mut coded_spectrogram = vec![vec![0.0; number_of_dimensions as usize]; f0_length as usize];
let mut coded_spectrogram_ptr = coded_spectrogram.iter_mut().map(|inner| inner.as_mut_ptr()).collect::<Vec<_>>();
let coded_spectrogram_ptr = coded_spectrogram_ptr.as_mut_ptr();
unsafe {
CodeSpectralEnvelope(spectrogram_ptr, f0_length, fs, option.fft_size, number_of_dimensions, coded_spectrogram_ptr);
}
assert_eq!(coded_spectrogram.len(), f0_length as usize);
assert_eq!(coded_spectrogram[0].len(), number_of_dimensions as usize);
} | rust_cleaned_test_functions.jsonl/20839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 779
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4136,
643,
86575,
6205,
18853,
368,
341,
286,
1077,
856,
25,
11312,
63895,
21,
19,
29,
286,
284,
7486,
20703,
15,
13,
15,
26,
220,
17,
20,
21,
935,
286,
1077,
856,
5118,
1843,
284,
856,
1940... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_switch_between_sender_and_receiver() {
struct Notifier<F>(Arc<Mutex<Option<Spawn<F>>>>);
impl<F> Clone for Notifier<F> {
fn clone(&self) -> Notifier<F> {
Notifier(Arc::clone(&self.0))
}
}
impl<F> Notify for Notifier<F>
where
F: Future<Item = (), Error = ()> + Send + 'static,
{
fn notify(&self, id: usize) {
let n = Arc::new(self.clone());
let mut s = self.0.lock().unwrap();
match s.as_mut().map(|spawn| spawn.poll_future_notify(&n, id)) {
Some(Ok(Async::NotReady)) | None => {}
_ => *s = None,
}
}
}
let (tx, rx) = unbounded::<u64>(4);
let f = rx.for_each(|_| Ok(())).map_err(|_| ());
let spawn = Arc::new(Mutex::new(Some(executor::spawn(f))));
Notifier(Arc::clone(&spawn)).notify(0);
// Switch to `receiver` in one thread in where `sender` is dropped.
drop(tx);
assert!(spawn.lock().unwrap().is_none());
} | rust_cleaned_test_functions.jsonl/54985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
48302,
54356,
8378,
65691,
368,
341,
286,
2036,
2806,
3049,
30499,
2235,
36809,
33274,
9371,
94150,
27,
41005,
30499,
18153,
317,
286,
11605,
30499,
29,
27913,
369,
2806,
3049,
30499,
29,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consume_and_get_buf() {
let mut rdr = BufferIo::new(SlowRead(0));
rdr.bump_read().unwrap();
rdr.consume(1);
assert_eq!(rdr.get_reader_buf().as_ref(), b"oo");
rdr.bump_read().unwrap();
rdr.bump_read().unwrap();
assert_eq!(rdr.get_reader_buf().as_ref(), b"oobarbaz");
rdr.consume(5);
assert_eq!(rdr.get_reader_buf().as_ref(), b"baz");
rdr.consume(3);
assert_eq!(rdr.get_reader_buf().as_ref(), b"");
} | rust_cleaned_test_functions.jsonl/125445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
31323,
8378,
3062,
10363,
368,
341,
286,
1077,
5206,
66984,
284,
10312,
42799,
486,
931,
3759,
10303,
4418,
7,
15,
1106,
286,
66984,
948,
1510,
6443,
1005,
15454,
543,
286,
66984,
79424,
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_combined_file_set_unset() {
let out = new_ucmd!()
.arg("-u")
.arg("BAR")
.arg("-f")
.arg("vars.conf.txt")
.arg("FOO=bar.alt")
.run()
.stdout;
assert_eq!(
out.lines()
.filter(|&line| line == "FOO=bar.alt" || line.starts_with("BAR="))
.count(),
1
);
} | rust_cleaned_test_functions.jsonl/1542 | {
"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,
89945,
2458,
2602,
98109,
368,
341,
262,
1077,
700,
284,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
84,
1138,
286,
659,
858,
445,
33065,
1138,
286,
659,
858,
13645,
69,
1138,
286,
659,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_utf8_byte_index() {
let s = "你好世界";
assert_eq!(&s[..get_utf8_byte_index(s, 0)], "");
assert_eq!(&s[..get_utf8_byte_index(s, 2)], "你好");
assert_eq!(&s[..get_utf8_byte_index(s, 4)], "你好世界");
assert_eq!(&s[..get_utf8_byte_index(s, 9)], "你好世界");
} | rust_cleaned_test_functions.jsonl/60486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
39453,
23,
19737,
3560,
368,
341,
286,
1077,
274,
284,
330,
108386,
99489,
3302,
286,
2060,
10714,
0,
2099,
82,
95874,
455,
39453,
23,
19737,
3560,
1141,
11,
220,
15,
25035,
14498,
286,
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_method_conversions() {
assert_eq!(HyperMethod::DELETE, Method::Delete.into_hyper());
assert_eq!(HyperMethod::GET, Method::Get.into_hyper());
assert_eq!(HyperMethod::PATCH, Method::Patch.into_hyper());
assert_eq!(HyperMethod::POST, Method::Post.into_hyper());
assert_eq!(HyperMethod::PUT, Method::Put.into_hyper());
} | rust_cleaned_test_functions.jsonl/116944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
3382,
28290,
368,
341,
286,
2060,
10714,
10297,
73946,
3523,
486,
14424,
11,
6730,
486,
6435,
39860,
93416,
1423,
286,
2060,
10714,
10297,
73946,
3523,
486,
3806,
11,
6730,
486,
1949,
39860,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ipv6packet_matcher_rule_corrupt() {
let packet3 = hex::decode("deadbeef").expect("bad ipv6 hex");
assert!(!Ipv6PacketMatcherRule::default().match_inbound_packet(&packet3));
assert!(!Ipv6PacketMatcherRule::default().match_outbound_packet(&packet3));
} | rust_cleaned_test_functions.jsonl/122559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49378,
21,
24829,
10708,
261,
21124,
14734,
6585,
368,
341,
286,
1077,
10151,
18,
284,
12371,
486,
18196,
445,
33754,
1371,
823,
1827,
17119,
445,
13855,
45475,
21,
12371,
797,
286,
2060,
0,
3471,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log2() {
assert_eq!(0, 0.log2());
assert_eq!(0, 1.log2());
assert_eq!(1, 2.log2());
assert_eq!(5, 32.log2());
assert_eq!(10, 1024.log2());
} | rust_cleaned_test_functions.jsonl/12841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
17,
368,
341,
262,
2060,
10714,
10297,
15,
11,
220,
15,
1665,
17,
1423,
262,
2060,
10714,
10297,
15,
11,
220,
16,
1665,
17,
1423,
262,
2060,
10714,
10297,
16,
11,
220,
17,
1665,
17,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_signature_abi_compatible() {
let abi_type = abi::FunctionSignature {
arg_types: std::ptr::null(),
return_type: std::ptr::null(),
num_arg_types: 0,
};
super::FunctionSignature::test(&abi_type);
} | rust_cleaned_test_functions.jsonl/98922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
39859,
22885,
72,
2965,
37079,
368,
341,
262,
1077,
61050,
1819,
284,
61050,
486,
5152,
25088,
341,
286,
1392,
9763,
25,
1460,
486,
3505,
486,
2921,
3148,
286,
470,
1819,
25,
1460,
486,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_a() {
let orbits = vec![
"COM)B".parse().unwrap(),
"B)C".parse().unwrap(),
"C)D".parse().unwrap(),
"D)E".parse().unwrap(),
"E)F".parse().unwrap(),
"B)G".parse().unwrap(),
"G)H".parse().unwrap(),
"D)I".parse().unwrap(),
"E)J".parse().unwrap(),
"J)K".parse().unwrap(),
"K)L".parse().unwrap(),
];
let mut subject = Puzzle1 { orbits };
let result = subject.final_result();
assert!(result.contains("checksum: 42"));
} | rust_cleaned_test_functions.jsonl/91265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
368,
341,
286,
1077,
85128,
284,
7486,
90515,
310,
330,
8696,
8,
33,
3263,
6400,
1005,
15454,
3148,
310,
330,
33,
8,
34,
3263,
6400,
1005,
15454,
3148,
310,
330,
34,
8,
35,
3263,
6400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_or_with_multiple_in_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let name2 = _random_vector(10);
let value2 = _random_string(10);
let name3 = _random_vector(10);
let value3 = _random_string(10);
let query = Operator::Or(
vec![
Operator::In(
TagName::PlainTagName(name1.clone()),
vec![TargetValue::Unencrypted(value1.clone())]
),
Operator::In(
TagName::PlainTagName(name2.clone()),
vec![TargetValue::Unencrypted(value2.clone())]
),
Operator::In(
TagName::PlainTagName(name3.clone()),
vec![TargetValue::Unencrypted(value3.clone())]
)
]
);
let json = query.to_string();
let expected = format!(r#"{{"$or":[{{"~{}":{{"$in":["{}"]}}}},{{"~{}":{{"$in":["{}"]}}}},{{"~{}":{{"$in":["{}"]}}}}]}}"#,
base64::encode(&name1), value1,
base64::encode(&name2), value2,
base64::encode(&name3), value3
);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 762
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
45233,
1243,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
829,
17,
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_version_error_display() {
let e: Error = BlockVersionError {
expected: 0,
actual: 1,
}
.into();
assert_eq!(
"Header(Version(BlockVersionError(expected: 0, actual: 1)))",
format!("{}", e)
);
} | rust_cleaned_test_functions.jsonl/57996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
4096,
14825,
368,
341,
286,
1077,
384,
25,
4600,
284,
8362,
5637,
1454,
341,
310,
3601,
25,
220,
15,
345,
310,
5042,
25,
220,
16,
345,
286,
456,
286,
659,
18122,
1428,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_parser_has() {
let mut input = Cursor::new("foo".as_bytes());
let mut parser = Parser::make(&mut input).expect("Should create parser");
let has = parser.parse().expect("Has");
assert_eq!(has.to_string(), "foo");
} | rust_cleaned_test_functions.jsonl/125355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
18517,
21778,
368,
972,
286,
1077,
5206,
1946,
284,
28067,
486,
931,
445,
7975,
3263,
300,
12524,
6201,
286,
1077,
5206,
6729,
284,
21102,
486,
6927,
2099,
6984,
1946,
568,
17119,
445,
14996... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kv_ops() {
let mut mock = mock::MockServer::start();
std::thread::sleep(std::time::Duration::from_secs(5));
mock.stop();
} | rust_cleaned_test_functions.jsonl/33479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97066,
21959,
368,
341,
262,
1077,
5206,
7860,
284,
7860,
486,
11571,
5475,
486,
2468,
1428,
262,
1460,
486,
4528,
486,
25809,
5194,
486,
1678,
486,
12945,
486,
1499,
68718,
7,
20,
3237,
262,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_non_controller_cant_claim_neuron_for_themselves() {
let owner = *TEST_NEURON_1_OWNER_PRINCIPAL;
let claimer = *TEST_NEURON_2_OWNER_PRINCIPAL;
let memo = 1234u64;
let (_, mut gov, _) =
governance_with_staked_unclaimed_neuron(&owner, memo, Tokens::from_tokens(10u64).unwrap());
let manage_neuron_response = gov
.manage_neuron(
&claimer,
&ManageNeuron {
neuron_id_or_subaccount: None,
id: None,
command: Some(Command::ClaimOrRefresh(ClaimOrRefresh {
by: Some(By::MemoAndController(MemoAndController {
memo,
controller: Some(claimer),
})),
})),
},
)
.now_or_never()
.unwrap();
match manage_neuron_response.command.unwrap() {
CommandResponse::Error(_) => (),
_ => panic!("Claim should have failed."),
};
} | rust_cleaned_test_functions.jsonl/1149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
21600,
666,
517,
84969,
13925,
36090,
5478,
5854,
11852,
4275,
368,
341,
262,
1077,
6372,
284,
353,
10033,
14039,
1511,
711,
62,
16,
74323,
10571,
38439,
3298,
969,
280,
262,
1077,
3717,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.