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_empty_block() { let (pub_key, secret_key) = gen_keypair(); let content = Block::new( blockchain::SCHEMA_MAJOR_VERSION, ValidatorId::zero(), Height(200), 1, &hash(&[1]), &hash(&[2]), &hash(&[3]), ); let precommits = Vec::new(); let transactions = Vec::new(); let block = BlockResponse::new( &pub_key, &pub_key, content.clone(), precommits.clone(), transactions.clone(), &secret_key, ); assert_eq!(block.from(), &pub_key); assert_eq!(block.to(), &pub_key); assert_eq!(block.block(), content); assert_eq!(block.precommits(), precommits); assert_eq!(block.transactions(), transactions); let block2 = BlockResponse::from_raw(block.raw().clone()).unwrap(); assert_eq!(block2.from(), &pub_key); assert_eq!(block2.to(), &pub_key); assert_eq!(block2.block(), content); assert_eq!(block2.precommits(), precommits); assert_eq!(block2.transactions(), transactions); }
rust_cleaned_test_functions.jsonl/118860
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 475 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15124, 7113, 368, 341, 262, 1077, 320, 9585, 3097, 11, 6234, 3097, 8, 284, 4081, 3097, 12670, 1428, 262, 1077, 2213, 284, 8362, 486, 931, 1006, 286, 17944, 486, 3540, 35839, 52045, 10678, 345, 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_mem_reader_fake_stream() { let mut reader = MemReaderFakeStream::new(vec!(0, 1, 2, 3, 4, 5, 6, 7)); let mut buf = vec![]; assert_eq!(reader.read(buf.as_mut_slice()), Ok(0)); assert_eq!(reader.tell(), Ok(0)); let mut buf = vec![0]; assert_eq!(reader.read(buf.as_mut_slice()), Ok(1)); assert_eq!(reader.tell(), Ok(1)); assert_eq!(buf, vec![0]); let mut buf = vec![0, 0, 0, 0]; assert_eq!(reader.read(buf.as_mut_slice()), Ok(4)); assert_eq!(reader.tell(), Ok(5)); assert_eq!(buf, vec![1, 2, 3, 4]); assert_eq!(reader.read(buf.as_mut_slice()), Ok(3)); assert_eq!(&buf[0..3], [5, 6, 7]); assert_eq!(reader.read(buf.as_mut_slice()).ok(), None); }
rust_cleaned_test_functions.jsonl/115237
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 529 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12976, 22306, 56881, 12673, 368, 341, 286, 1077, 5206, 6604, 284, 13550, 5062, 52317, 3027, 486, 931, 25592, 10297, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_nlerp_quarter() { let q = Quaternion::from([-0.5, 0.5, 0.5, 0.5]); let r = Quaternion::from([0.5, 0.5, 0.5, 0.5]); let expected = Quaternion::from([ -1.0 / 13f64.sqrt(), 2.0 / 13f64.sqrt(), 2.0 / 13f64.sqrt(), 2.0 / 13f64.sqrt(), ]); assert_ulps_eq!(expected, q.nlerp(r, 0.25)); }
rust_cleaned_test_functions.jsonl/15350
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 243 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1089, 1536, 79, 11280, 5295, 368, 341, 286, 1077, 2804, 284, 24801, 486, 1499, 41197, 15, 13, 20, 11, 220, 15, 13, 20, 11, 220, 15, 13, 20, 11, 220, 15, 13, 20, 2558, 286, 1077, 435, 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_gather_order() { let r = Registry::new(); let counter_a = Counter::new("test_a_counter", "test help").unwrap(); let counter_b = Counter::new("test_b_counter", "test help").unwrap(); let counter_2 = Counter::new("test_2_counter", "test help").unwrap(); r.register(Box::new(counter_b.clone())).unwrap(); r.register(Box::new(counter_2.clone())).unwrap(); r.register(Box::new(counter_a.clone())).unwrap(); let mfs = r.gather(); assert_eq!(mfs.len(), 3); assert_eq!(mfs[0].get_name(), "test_2_counter"); assert_eq!(mfs[1].get_name(), "test_a_counter"); assert_eq!(mfs[2].get_name(), "test_b_counter"); let r = Registry::new(); let opts = Opts::new("test", "test help") .const_label("a", "1") .const_label("b", "2"); let counter_vec = CounterVec::new(opts, &["cc", "c1", "a2", "c0"]).unwrap(); r.register(Box::new(counter_vec.clone())).unwrap(); let mut map1 = HashMap::new(); map1.insert("cc", "12"); map1.insert("c1", "a1"); map1.insert("a2", "0"); map1.insert("c0", "hello"); counter_vec.with(&map1).inc(); let mut map2 = HashMap::new(); map2.insert("cc", "12"); map2.insert("c1", "0"); map2.insert("a2", "0"); map2.insert("c0", "hello"); counter_vec.with(&map2).inc(); counter_vec.with(&map2).inc(); let mut map3 = HashMap::new(); map3.insert("cc", "12"); map3.insert("c1", "0"); map3.insert("a2", "da"); map3.insert("c0", "hello"); counter_vec.with(&map3).inc(); counter_vec.with(&map3).inc(); counter_vec.with(&map3).inc(); let mut map4 = HashMap::new(); map4.insert("cc", "12"); map4.insert("c1", "0"); map4.insert("a2", "da"); map4.insert("c0", "你好"); counter_vec.with(&map4).inc(); counter_vec.with(&map4).inc(); counter_vec.with(&map4).inc(); counter_vec.with(&map4).inc(); // # HELP test test help // # TYPE test counter // t // t // t // t let mfs = r.gather(); assert_eq!(mfs.len(), 1); let ms = mfs[0].get_metric(); assert_eq!(ms.len(), 4); assert_eq!(ms[0].get_counter().get_value() as u64, 2); assert_eq!(ms[1].get_counter().get_value() as u64, 1); assert_eq!(ms[2].get_counter().get_value() as u64, 3); assert_eq!(ms[3].get_counter().get_value() as u64, 4); }
rust_cleaned_test_functions.jsonl/132417
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1297 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 1856, 7869, 368, 341, 286, 1077, 435, 284, 32112, 486, 931, 1428, 286, 1077, 5546, 4306, 284, 19735, 486, 931, 445, 1944, 4306, 15730, 497, 330, 1944, 1492, 1827, 15454, 543, 286, 1077, 55...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_negation() { let a = Fp([ 0x5360bb5978678032, 0x7dd275ae799e128e, 0x5c5b5071ce4f4dcf, 0xcdb21f93078dbb3e, 0xc32365c5e73f474a, 0x115a2a5489babe5b, ]); let b = Fp([ 0x669e44a687982a79, 0xa0d98a5037b5ed71, 0xad5822f2861a854, 0x96c52bf1ebf75781, 0x87f841f05c0c658c, 0x8a6e795afc5283e, ]); assert_eq!(-a, b); }
rust_cleaned_test_functions.jsonl/70424
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 311 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28209, 367, 368, 341, 262, 1077, 264, 284, 434, 79, 8956, 286, 220, 15, 87, 20, 18, 21, 15, 6066, 20, 24, 22, 23, 21, 22, 23, 15, 18, 17, 345, 286, 220, 15, 87, 22, 631, 17, 22, 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_vec_list_get_next_index() { let mut list = VecList::new(); let index = list.push_back(0); assert_eq!(list.get_next_index(index), None); list.push_back(1); assert_eq!(list.get_next_index(index).unwrap().index, 1); }
rust_cleaned_test_functions.jsonl/11526
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 137 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 2019, 3062, 11257, 3560, 368, 341, 286, 1077, 5206, 1140, 284, 11312, 852, 486, 931, 1428, 286, 1077, 1922, 284, 1140, 2552, 3895, 7, 15, 317, 286, 2060, 10714, 10297, 1607, 670, 11257, 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_text_encoder() { let counter_opts = Opts::new("test_counter", "test help") .const_label("a", "1") .const_label("b", "2"); let counter = Counter::with_opts(counter_opts).unwrap(); counter.inc(); let mf = counter.collect(); let mut writer = Vec::<u8>::new(); let encoder = TextEncoder::new(); let txt = encoder.encode(&mf, &mut writer); assert!(txt.is_ok()); let counter_ans = r##"# HELP test_counter test help # TYPE test_counter counter test_counter{a="1",b="2"} 1 "##; assert_eq!(counter_ans.as_bytes(), writer.as_slice()); let gauge_opts = Opts::new("test_gauge", "test help") .const_label("a", "1") .const_label("b", "2"); let gauge = Gauge::with_opts(gauge_opts).unwrap(); gauge.inc(); gauge.set(42.0); let mf = gauge.collect(); writer.clear(); let txt = encoder.encode(&mf, &mut writer); assert!(txt.is_ok()); let gauge_ans = r##"# HELP test_gauge test help # TYPE test_gauge gauge test_gauge{a="1",b="2"} 42 "##; assert_eq!(gauge_ans.as_bytes(), writer.as_slice()); }
rust_cleaned_test_functions.jsonl/52442
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 589 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4326, 39068, 368, 341, 286, 1077, 5546, 32354, 284, 506, 12754, 486, 931, 445, 1944, 15730, 497, 330, 1944, 1492, 1138, 310, 659, 1024, 6106, 445, 64, 497, 330, 16, 1138, 310, 659, 1024, 6106, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_type_expression_function_with_params() { let mut p = Parser::new(r#"(A: int, B: uint) => int"#); let parsed = p.parse_type_expression(); let loc = Locator::new(&p.source[..]); assert_eq!( parsed, TypeExpression { base: BaseNode { location: loc.get(1, 1, 1, 25), ..BaseNode::default() }, monotype: MonoType::Function(Box::new(FunctionType { base: BaseNode { location: loc.get(1, 1, 1, 25), ..BaseNode::default() }, parameters: vec![ ParameterType::Required { base: BaseNode { location: loc.get(1, 2, 1, 8), ..BaseNode::default() }, name: Identifier { base: BaseNode { location: loc.get(1, 2, 1, 3), ..BaseNode::default() }, name: "A".to_string(), }, monotype: MonoType::Basic(NamedType { base: BaseNode { location: loc.get(1, 5, 1, 8), ..BaseNode::default() }, name: Identifier { base: BaseNode { location: loc.get(1, 5, 1, 8), ..BaseNode::default() }, name: "int".to_string(), }, }), }, ParameterType::Required { base: BaseNode { location: loc.get(1, 10, 1, 17), ..BaseNode::default() }, name: Identifier { base: BaseNode { location: loc.get(1, 10, 1, 11), ..BaseNode::default() }, name: "B".to_string(), }, monotype: MonoType::Basic(NamedType { base: BaseNode { location: loc.get(1, 13, 1, 17), ..BaseNode::default() }, name: Identifier { base: BaseNode { location: loc.get(1, 13, 1, 17), ..BaseNode::default() }, name: "uint".to_string(), }, }), } ], monotype: MonoType::Basic(NamedType { base: BaseNode { location: loc.get(1, 22, 1, 25), ..BaseNode::default() }, name: Identifier { base: BaseNode { location: loc.get(1, 22, 1, 25), ..BaseNode::default() }, name: "int".to_string(), } }), })), constraints: vec![], }, ) }
rust_cleaned_test_functions.jsonl/67830
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2556 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 1819, 28068, 9174, 6615, 6745, 368, 341, 262, 1077, 5206, 281, 284, 21102, 486, 931, 2601, 2, 29209, 32, 25, 526, 11, 425, 25, 2622, 8, 589, 526, 57676, 317, 262, 1077, 15676, 284, 281,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ruleset_duplicates() { let ruleset = Ruleset::new(); ruleset .add_rule(Rule::GlobalTag(Tag::new( "key1".to_string(), "value".to_string(), ))) .unwrap(); ruleset .add_rule(Rule::GlobalTag(Tag::new( "key1".to_string(), "value".to_string(), ))) .unwrap(); assert_eq!( ruleset.get_global_tags().unwrap(), vec![Tag::new("key1".to_string(), "value".to_string())] ); }
rust_cleaned_test_functions.jsonl/124450
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 277 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21407, 295, 75051, 368, 341, 262, 1077, 5601, 295, 284, 22847, 295, 486, 931, 1428, 262, 5601, 295, 198, 286, 659, 718, 21124, 2785, 1111, 486, 11646, 5668, 69161, 486, 931, 1006, 310, 330, 792,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_evil_date() { let service = DateService::new(); // Make sure that `check_date` doesn't try to spawn a task service.0.update(); service.set_date(|_| service.0.reset()); }
rust_cleaned_test_functions.jsonl/36163
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43713, 321, 4164, 368, 341, 286, 1077, 2473, 284, 2631, 1860, 486, 931, 543, 286, 442, 7405, 2704, 429, 1565, 2028, 4164, 63, 3171, 944, 1430, 311, 18042, 264, 3383, 198, 286, 2473, 13, 15, 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
#[test] fn test_cache() { let mut c: Lru<u64, u64> = Lru::new(14); for i in 0..10000 { c.insert(i, i); } }
rust_cleaned_test_functions.jsonl/14488
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 106 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11529, 368, 341, 262, 1077, 5206, 272, 25, 444, 2672, 34837, 21, 19, 11, 575, 21, 19, 29, 284, 444, 2672, 486, 931, 7, 16, 19, 317, 262, 369, 600, 304, 220, 15, 496, 16, 15, 15, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
#[test] fn test_report_attempts_to_successful_install_fails_then_succeeds() { block_on(async { let response = json!({"response":{ "server": "prod", "protocol": "3.0", "app": [{ "appid": "{00000000-0000-0000-0000-000000000001}", "status": "ok", "updatecheck": { "status": "ok" } }], }}); let response = serde_json::to_vec(&response).unwrap(); let mut http = MockHttpRequest::new(HttpResponse::new(response.clone())); http.add_response(HttpResponse::new(response.clone())); http.add_response(HttpResponse::new(response.clone())); // Respond to the next request. http.add_response(HttpResponse::new(response.clone())); // for a successful install. http.add_response(HttpResponse::new(response.clone())); http.add_response(HttpResponse::new(response.clone())); let storage = Rc::new(Mutex::new(MemStorage::new())); let mock_time = MockTimeSource::new_from_now(); let mut state_machine = StateMachineBuilder::new_stub() .http(http) .installer(TestInstaller::builder(mock_time.clone()).add_install_fail().build()) .policy_engine(StubPolicyEngine::new(mock_time.clone())) .metrics_reporter(MockMetricsReporter::new()) .storage(Rc::clone(&storage)) .build() .await; state_machine.run_once().await; state_machine.run_once().await; // patterns yet. #[rustfmt::skip] assert_matches!( state_machine.metrics_reporter.metrics.as_slice(), [ Metrics::UpdateCheckResponseTime { response_time: _, successful: true }, Metrics::RequestsPerCheck { count: 1, successful: true }, Metrics::FailedUpdateDuration(_), Metrics::AttemptsToSuccessfulCheck(1), Metrics::AttemptsToSuccessfulInstall { count: 1, successful: false }, Metrics::UpdateCheckInterval { .. }, Metrics::UpdateCheckResponseTime { response_time: _, successful: true }, Metrics::RequestsPerCheck { count: 1, successful: true }, Metrics::SuccessfulUpdateDuration(_), Metrics::OmahaEventLost(Event { .. }), Metrics::SuccessfulUpdateFromFirstSeen(_), Metrics::AttemptsToSuccessfulCheck(1), Metrics::AttemptsToSuccessfulInstall { count: 2, successful: true } ] ); }); }
rust_cleaned_test_functions.jsonl/59708
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1500 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14813, 79490, 2346, 92951, 34245, 761, 6209, 68367, 643, 29264, 82, 368, 341, 286, 2504, 4470, 18285, 341, 310, 1077, 2033, 284, 2951, 0, 16864, 2322, 12602, 1060, 330, 4030, 788, 330, 19748, 756,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_and_subexpression() { let add_sub_expr = ArithmeticExpression::Add( Box::new(ArithmeticExpression::Value(1)), Box::new(ArithmeticExpression::Sub( Box::new(ArithmeticExpression::Value(2)), Box::new(ArithmeticExpression::Value(3)), )), ); println!("add_sub_expr = {:?}", add_sub_expr); let sub_add_expr = ArithmeticExpression::Sub( Box::new(ArithmeticExpression::Add( Box::new(ArithmeticExpression::Value(1)), Box::new(ArithmeticExpression::Value(2)), )), Box::new(ArithmeticExpression::Value(3)), ); println!("sub_add_expr = {:?}", sub_add_expr); }
rust_cleaned_test_functions.jsonl/57258
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 383 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 8378, 5228, 28099, 368, 341, 286, 1077, 912, 5228, 21915, 284, 92984, 9595, 486, 2212, 1006, 310, 8261, 486, 931, 4346, 81, 25922, 9595, 486, 1130, 7, 16, 6965, 310, 8261, 486, 931, 4346, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_serde_ciphertext() { let ElGamalKeypair { public, secret: _ } = ElGamalKeypair::new_rand(); let amount: u64 = 77; let ciphertext = public.encrypt(amount); let encoded = bincode::serialize(&ciphertext).unwrap(); let decoded: ElGamalCiphertext = bincode::deserialize(&encoded).unwrap(); assert_eq!(ciphertext, decoded); }
rust_cleaned_test_functions.jsonl/36654
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75861, 450, 666, 45043, 368, 341, 286, 1077, 3984, 78884, 278, 6608, 1082, 1310, 314, 584, 11, 6234, 25, 716, 335, 284, 3984, 78884, 278, 6608, 1082, 1310, 486, 931, 33864, 543, 286, 1077, 3311,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_conditions() { assert!(are_selections_equal( r#" fragment Left on User { ...CommonFragment @include(if: $conditional1) @skip(if: $conditional3) } fragment Right on User { ...CommonFragment @include(if: $conditional1) @skip(if: $conditional3) } fragment CommonFragment on User { name } "# )); assert!(!are_selections_equal( r#" fragment Left on User { ...CommonFragment @include(if: $conditional1) } fragment Right on User { ...CommonFragment @include(if: $conditional2) } fragment CommonFragment on User { name } "# )); }
rust_cleaned_test_functions.jsonl/6187
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 501 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54099, 368, 341, 262, 2060, 10297, 546, 23672, 82, 11478, 1006, 286, 435, 2, 698, 394, 12289, 13727, 389, 2657, 341, 503, 2503, 10839, 9488, 569, 997, 33333, 25, 400, 45368, 16, 8, 569, 20599, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_split_url() { assert_eq!(split_url("/foo.js"), (Some(""), "foo", Some("js"))); assert_eq!(split_url("foo.js"), (None, "foo", Some("js"))); assert_eq!(split_url("foo"), (None, "foo", None)); assert_eq!(split_url("/foo"), (Some(""), "foo", None)); assert_eq!( split_url("/foo.deadbeef0123.js"), (Some(""), "foo", Some("deadbeef0123.js")) ); assert_eq!( split_url("/foo/bar/baz.js"), (Some("/foo/bar"), "baz", Some("js")) ); }
rust_cleaned_test_functions.jsonl/32393
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 249 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17052, 2903, 368, 341, 262, 2060, 10714, 10297, 6960, 2903, 4283, 7975, 2857, 3975, 320, 8373, 86076, 330, 7975, 497, 4329, 445, 2519, 17621, 262, 2060, 10714, 10297, 6960, 2903, 445, 7975, 2857, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_embed_complete() { let value = Embed { author: Some(EmbedAuthor { icon_url: Some("https://example.com/1.png".to_owned()), name: Some("test".to_owned()), proxy_icon_url: Some("https://example.com".to_owned()), url: Some("https://example.com".to_owned()), }), color: Some(123), description: Some("a description".to_owned()), fields: vec![EmbedField { inline: true, name: "name".to_owned(), value: "value".to_owned(), }], footer: Some(EmbedFooter { icon_url: Some("https://example.com/1.png".to_owned()), proxy_icon_url: Some("https://cdn.example.com/1-hash.png".to_owned()), text: "a footer".to_owned(), }), image: Some(EmbedImage { height: Some(1440), proxy_url: Some("https://cdn.example.com/1-hash.png".to_owned()), url: Some("https://example.com/1.png".to_owned()), width: Some(2560), }), kind: "rich".to_owned(), provider: Some(EmbedProvider { name: Some("Example".to_owned()), url: Some("https://example.com".to_owned()), }), thumbnail: Some(EmbedThumbnail { height: Some(1440), proxy_url: Some("https://cdn.example.com/1-hash.png".to_owned()), url: Some("https://example.com/1.png".to_owned()), width: Some(2560), }), timestamp: Some("a timestamp".to_owned()), title: Some("a title".to_owned()), url: Some("https://example.com".to_owned()), video: Some(EmbedVideo { height: Some(1440), url: Some("https://cdn.example.com/1-hash.mp4".to_owned()), width: Some(2560), }), }; serde_test::assert_tokens( &value, &[ Token::Struct { name: "Embed", len: 13, }, Token::Str("author"), Token::Some, Token::Struct { name: "EmbedAuthor", len: 4, }, Token::Str("icon_url"), Token::Some, Token::Str("https://example.com/1.png"), Token::Str("name"), Token::Some, Token::Str("test"), Token::Str("proxy_icon_url"), Token::Some, Token::Str("https://example.com"), Token::Str("url"), Token::Some, Token::Str("https://example.com"), Token::StructEnd, Token::Str("color"), Token::Some, Token::U32(123), Token::Str("description"), Token::Some, Token::Str("a description"), Token::Str("fields"), Token::Seq { len: Some(1) }, Token::Struct { name: "EmbedField", len: 3, }, Token::Str("inline"), Token::Bool(true), Token::Str("name"), Token::Str("name"), Token::Str("value"), Token::Str("value"), Token::StructEnd, Token::SeqEnd, Token::Str("footer"), Token::Some, Token::Struct { name: "EmbedFooter", len: 3, }, Token::Str("icon_url"), Token::Some, Token::Str("https://example.com/1.png"), Token::Str("proxy_icon_url"), Token::Some, Token::Str("https://cdn.example.com/1-hash.png"), Token::Str("text"), Token::Str("a footer"), Token::StructEnd, Token::Str("image"), Token::Some, Token::Struct { name: "EmbedImage", len: 4, }, Token::Str("height"), Token::Some, Token::U64(1440), Token::Str("proxy_url"), Token::Some, Token::Str("https://cdn.example.com/1-hash.png"), Token::Str("url"), Token::Some, Token::Str("https://example.com/1.png"), Token::Str("width"), Token::Some, Token::U64(2560), Token::StructEnd, Token::Str("type"), Token::Str("rich"), Token::Str("provider"), Token::Some, Token::Struct { name: "EmbedProvider", len: 2, }, Token::Str("name"), Token::Some, Token::Str("Example"), Token::Str("url"), Token::Some, Token::Str("https://example.com"), Token::StructEnd, Token::Str("thumbnail"), Token::Some, Token::Struct { name: "EmbedThumbnail", len: 4, }, Token::Str("height"), Token::Some, Token::U64(1440), Token::Str("proxy_url"), Token::Some, Token::Str("https://cdn.example.com/1-hash.png"), Token::Str("url"), Token::Some, Token::Str("https://example.com/1.png"), Token::Str("width"), Token::Some, Token::U64(2560), Token::StructEnd, Token::Str("timestamp"), Token::Some, Token::Str("a timestamp"), Token::Str("title"), Token::Some, Token::Str("a title"), Token::Str("url"), Token::Some, Token::Str("https://example.com"), Token::Str("video"), Token::Some, Token::Struct { name: "EmbedVideo", len: 3, }, Token::Str("height"), Token::Some, Token::U64(1440), Token::Str("url"), Token::Some, Token::Str("https://cdn.example.com/1-hash.mp4"), Token::Str("width"), Token::Some, Token::U64(2560), Token::StructEnd, Token::StructEnd, ], ); }
rust_cleaned_test_functions.jsonl/134730
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4279 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24007, 27675, 368, 341, 286, 1077, 897, 284, 37068, 341, 310, 3150, 25, 4329, 7, 25486, 7133, 341, 394, 4603, 2903, 25, 4329, 445, 2428, 1110, 8687, 905, 14, 16, 3508, 3263, 983, 51973, 14702, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_proposal_by_proxy() { let l = default_logger(); let mut tests = vec![ Network::new(vec![None, None, None], &l), Network::new(vec![None, None, NOP_STEPPER], &l), ]; for (j, tt) in tests.iter_mut().enumerate() { // promote 0 the leader tt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]); // propose via follower tt.send(vec![new_message(2, 2, MessageType::MsgPropose, 1)]); for p in tt.peers.values() { if p.raft.is_none() { continue; } if let Some(ref raft) = p.raft { let prefix = format!("#{}: ", j); assert_raft_log(&prefix, &raft.raft_log, (2, 0, 2)); } } if tt.peers[&1].term != 1 { panic!("#{}: term = {}, want {}", j, tt.peers[&1].term, 1); } } }
rust_cleaned_test_functions.jsonl/19104
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 481 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21663, 32556, 3710, 29712, 368, 341, 262, 1077, 326, 284, 1638, 27413, 543, 262, 1077, 5206, 7032, 284, 7486, 90515, 286, 8141, 486, 931, 25592, 20703, 4064, 11, 2240, 11, 2240, 1125, 609, 75, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_raw_idents() { Python::with_gil(|py| { let raw_idents_type = py.get_type::<r#RawIdents>(); py_run!( py, raw_idents_type, r#" instance = raw_idents_type(type=None, subtype=5, subsubtype="foo") assert instance.type is None assert instance.subtype == 5 assert instance.subsubtype == "foo" instance.type = 1 instance.subtype = 2 instance.subsubtype = 3 assert instance.type == 1 assert instance.subtype == 2 assert instance.subsubtype == 3 assert raw_idents_type.static_method(type=30) == 30 assert instance.class_method(type=40) == 40 instance(type=50) assert instance.type == 50 assert raw_idents_type.class_attr_fn == 5 assert raw_idents_type.CLASS_ATTR_CONST == 6 "# ); }) }
rust_cleaned_test_functions.jsonl/95164
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 500 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16067, 842, 805, 368, 341, 262, 13027, 486, 4197, 1889, 321, 22428, 3288, 91, 341, 286, 1077, 7112, 842, 805, 1819, 284, 4510, 670, 1819, 27638, 81, 2, 20015, 764, 805, 3913, 286, 4510, 14007, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mutex() { let wrapper = Wrapper { inner: Mutex::new(Inner), }; assert_eq!(wrapper.method(3), 3); assert_eq!(wrapper.method2(3), 3); }
rust_cleaned_test_functions.jsonl/43058
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 88 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14204, 368, 341, 262, 1077, 13261, 284, 35488, 341, 286, 9179, 25, 66215, 486, 931, 7, 31597, 1326, 262, 3634, 262, 2060, 10714, 10297, 21364, 12908, 7, 18, 701, 220, 18, 317, 262, 2060, 10714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_filter_cpuid_1vcpu_ht_off() { let mut kvm_cpuid = CpuId::new(11); { let entries = kvm_cpuid.mut_entries_slice(); entries[0].function = 0x1; } { let entries = kvm_cpuid.mut_entries_slice(); entries[1].function = 0x4; entries[1].eax = 0b10000; } { let entries = kvm_cpuid.mut_entries_slice(); entries[2].function = 0x4; entries[2].eax = 0b100000; } { let entries = kvm_cpuid.mut_entries_slice(); entries[3].function = 0x4; entries[3].eax = 0b1000000; } { let entries = kvm_cpuid.mut_entries_slice(); entries[4].function = 0x4; entries[4].eax = 0b1100000; } { let entries = kvm_cpuid.mut_entries_slice(); entries[5].function = 0x6; entries[5].eax = 1; entries[5].ecx = 1; } { let entries = kvm_cpuid.mut_entries_slice(); entries[6].function = 0xA; } { let entries = kvm_cpuid.mut_entries_slice(); entries[7].function = 0xB; entries[7].index = 0; } { let entries = kvm_cpuid.mut_entries_slice(); entries[8].function = 0xB; entries[8].index = 1; } { let entries = kvm_cpuid.mut_entries_slice(); entries[9].function = 0xB; entries[9].index = 2; } { let entries = kvm_cpuid.mut_entries_slice(); entries[10].function = 0x80000003; } filter_cpuid(0, 1, false, &mut kvm_cpuid).unwrap(); let max_addr_cpu = get_max_addressable_lprocessors(1).unwrap() as u32; let cpuid_f1 = kvm_cpuid_entry2 { function: 1, index: 0, flags: 0, eax: 0, ebx: (EBX_CLFLUSH_CACHELINE << leaf_0x1::ebx::CLFLUSH_SIZE_SHIFT) | max_addr_cpu << leaf_0x1::ebx::CPU_COUNT_SHIFT, ecx: 1 << leaf_0x1::ecx::TSC_DEADLINE_TIMER_SHIFT | 1 << leaf_0x1::ecx::HYPERVISOR_SHIFT, edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[0], cpuid_f1); } let cpuid_f4 = kvm_cpuid_entry2 { function: 0x4, index: 0, flags: 0, eax: 0b10000 & !(0b111111111111 << leaf_0x4::eax::MAX_ADDR_IDS_SHARING_CACHE), ebx: 0, ecx: 0, edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[1], cpuid_f4); } let cpuid_f4 = kvm_cpuid_entry2 { function: 0x4, index: 0, flags: 0, eax: 0b100000 & !(0b111111111111 << leaf_0x4::eax::MAX_ADDR_IDS_SHARING_CACHE), ebx: 0, ecx: 0, edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[2], cpuid_f4); } let cpuid_f4 = kvm_cpuid_entry2 { function: 0x4, index: 0, flags: 0, eax: 0b1000000 & !(0b111111111111 << leaf_0x4::eax::MAX_ADDR_IDS_SHARING_CACHE), ebx: 0, ecx: 0, edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[3], cpuid_f4); } let cpuid_f4 = kvm_cpuid_entry2 { function: 0x4, index: 0, flags: 0, eax: 0b1100000 & !(0b111111111111 << leaf_0x4::eax::MAX_ADDR_IDS_SHARING_CACHE), ebx: 0, ecx: 0, edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[4], cpuid_f4); } let cpuid_f6 = kvm_cpuid_entry2 { function: 0x6, index: 0, flags: 0, eax: 1 & !(1 << leaf_0x6::eax::TURBO_BOOST_SHIFT), ebx: 0, ecx: 1 & !(1 << leaf_0x6::ecx::EPB_SHIFT), edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[5], cpuid_f6); } let cpuid_fa = kvm_cpuid_entry2 { function: 0xA, index: 0, flags: 0, eax: 0, ebx: 0, ecx: 0, edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[6], cpuid_fa); } let cpuid_fb = kvm_cpuid_entry2 { function: 0xB, index: 0, flags: 0, eax: 0, ebx: 1, ecx: leaf_0xb::LEVEL_TYPE_CORE << leaf_0xb::ecx::LEVEL_TYPE_SHIFT, edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[7], cpuid_fb); } let cpuid_fb = kvm_cpuid_entry2 { function: 0xB, index: 1, flags: 0, eax: LEAFBH_INDEX1_APICID_SHIFT, ebx: 0, ecx: 1 | (leaf_0xb::LEVEL_TYPE_INVALID << leaf_0xb::ecx::LEVEL_TYPE_SHIFT), edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[8], cpuid_fb); } let cpuid_fb = kvm_cpuid_entry2 { function: 0xB, index: 2, flags: 0, eax: 0, ebx: 0, ecx: 2, edx: 0, padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[9], cpuid_fb); } let bstr = get_brand_string(); let cpuid_fother = kvm_cpuid_entry2 { function: 0x80000003, index: 0, flags: 0, eax: bstr.get_reg_for_leaf(0x80000003, BsReg::EAX), ebx: bstr.get_reg_for_leaf(0x80000003, BsReg::EBX), ecx: bstr.get_reg_for_leaf(0x80000003, BsReg::ECX), edx: bstr.get_reg_for_leaf(0x80000003, BsReg::EDX), padding: [0, 0, 0], }; { let entries = kvm_cpuid.mut_entries_slice(); assert_eq!(entries[10], cpuid_fother); } }
rust_cleaned_test_functions.jsonl/110144
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4254 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8727, 39811, 2423, 62, 16, 85, 16475, 49086, 13651, 368, 341, 286, 1077, 5206, 94748, 39811, 2423, 284, 356, 5584, 764, 486, 931, 7, 16, 16, 317, 286, 341, 310, 1077, 10695, 284, 94748, 39811, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_neg() { assert_eq!(-_1_0i + _0_1i, _neg1_1i); assert_eq!((-_0_1i) * _0_1i, _1_0i); for &c in all_consts.iter() { assert_eq!(-(-c), c); } }
rust_cleaned_test_functions.jsonl/105714
{ "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, 28209, 368, 341, 310, 2060, 10714, 0, 4080, 62, 16, 62, 15, 72, 488, 716, 15, 62, 16, 72, 11, 716, 28775, 16, 62, 16, 72, 317, 310, 2060, 10714, 0, 54934, 62, 15, 62, 16, 72, 8, 353, 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_top_score_collector_collect() { let mut collector = TopScoreCollector::new(10); collector.collect(DocumentMatch::new_scored(0, 1.0f32)); collector.collect(DocumentMatch::new_scored(1, 0.5f32)); collector.collect(DocumentMatch::new_scored(2, 2.0f32)); collector.collect(DocumentMatch::new_scored(3, 1.5f32)); let docs = collector.into_sorted_vec(); assert_eq!(docs.len(), 4); assert_eq!(docs[0].id, 2); assert_eq!(docs[1].id, 3); assert_eq!(docs[2].id, 0); assert_eq!(docs[3].id, 1); }
rust_cleaned_test_functions.jsonl/96805
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 285 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10426, 10405, 10211, 27669, 68140, 368, 341, 286, 1077, 5206, 31953, 284, 6909, 10570, 53694, 486, 931, 7, 16, 15, 626, 286, 31953, 29124, 60880, 8331, 486, 931, 10405, 67, 7, 15, 11, 220, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_update_data_set_values_and_post() { init!("false"); let (agent_did, agent_vk) = create_and_store_my_did(Some(MY2_SEED)).unwrap(); let (my_did, my_vk) = create_and_store_my_did(Some(MY1_SEED)).unwrap(); let (agency_did, agency_vk) = create_and_store_my_did(Some(MY3_SEED)).unwrap(); settings::set_config_value(settings::CONFIG_AGENCY_VERKEY, &agency_vk); settings::set_config_value(settings::CONFIG_REMOTE_TO_SDK_VERKEY, &agent_vk); settings::set_config_value(settings::CONFIG_SDK_TO_REMOTE_VERKEY, &my_vk); let msg = update_data() .to(agent_did.as_ref()) .name("name") .logo_url("https://random.com") .msgpack().unwrap(); assert!(msg.len() > 0); }
rust_cleaned_test_functions.jsonl/38975
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 393 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 1769, 2602, 9146, 8378, 6333, 368, 341, 286, 2930, 17223, 3849, 797, 286, 1077, 320, 8092, 814, 307, 11, 8315, 89852, 8, 284, 1855, 8378, 14809, 35686, 814, 307, 65405, 3189, 56, 17, 3620,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_components() { let gliffn = "test_data/TT2020Base.ufo/glyphs/gershayim.glif"; let mut glif: glifparser::Glif<()> = glifparser::glif::read_from_filename(gliffn).unwrap(); glif.filename = Some(gliffn.into()); let sanity = glif.filename_is_sane(); assert!(sanity.is_ok() && sanity.unwrap()); assert!(glif.components.vec.len() == 2); assert!(&glif.components.vec[0].base == "acute"); let forest: Result<trees::Forest<glifparser::Component<()>>, _> = (&glif.components).into(); match forest { Ok(mut f) => { eprintln!("(Glif: {})", &glif.name); while let Some(tree) = f.pop_front() { pprint_component_tree(tree); } }, Err(e) => eprintln!("{}", e) } let flattened = glif.flattened(&mut None).unwrap(); let flatxml = glifparser::glif::write(&flattened).unwrap(); assert!(flatxml.len() > 0); }
rust_cleaned_test_functions.jsonl/64035
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 448 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23258, 368, 341, 262, 1077, 2770, 3092, 77, 284, 330, 1944, 1769, 14, 14903, 17, 15, 17, 15, 3978, 11634, 824, 4846, 9525, 82, 4846, 54990, 352, 318, 19787, 333, 876, 9401, 262, 1077, 5206, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_try_rfold_moves_iter() { let v: VecDeque<_> = [10, 20, 30, 40, 100, 60, 70, 80, 90].iter().collect(); let mut iter = v.into_iter(); assert_eq!(iter.try_rfold(0_i8, |acc, &x| acc.checked_add(x)), None); assert_eq!(iter.next_back(), Some(&70)); }
rust_cleaned_test_functions.jsonl/73751
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 133 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53283, 1710, 19961, 45390, 11723, 368, 341, 262, 1077, 348, 25, 11312, 73891, 32399, 29, 284, 508, 16, 15, 11, 220, 17, 15, 11, 220, 18, 15, 11, 220, 19, 15, 11, 220, 16, 15, 15, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mul() { let a = Vec3::new(3.0, 4.0, 1.0) * 2.0; assert_eq!(a.x, 6.0); assert_eq!(a.y, 8.0); assert_eq!(a.z, 2.0); let b = 2.0f64 * Vec3::new(3.0, 4.0, 1.0); assert_eq!(b.x, 6.0); assert_eq!(b.y, 8.0); assert_eq!(b.z, 2.0); }
rust_cleaned_test_functions.jsonl/29319
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 252 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24944, 368, 341, 310, 1077, 264, 284, 11312, 18, 486, 931, 7, 18, 13, 15, 11, 220, 19, 13, 15, 11, 220, 16, 13, 15, 8, 353, 220, 17, 13, 15, 280, 310, 2060, 10714, 10297, 64, 1993, 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_find_state_3() { /* /----+ 0 <--+ | | | | v | | +-> 1 -> 3 4 5 | | | | | v | | +-- 2 <----+-+ */ let graph = TestGraph::new(0, &[(0, 1), (0, 4), (1, 2), (1, 3), (2, 1), (3, 0), (4, 2), (5, 2)]); let sccs: Sccs<_, usize> = Sccs::new(&graph); assert_eq!(sccs.num_sccs(), 2); assert_eq!(sccs.scc(0), 0); assert_eq!(sccs.scc(1), 0); assert_eq!(sccs.scc(2), 0); assert_eq!(sccs.scc(3), 0); assert_eq!(sccs.scc(4), 0); assert_eq!(sccs.scc(5), 1); assert_eq!(sccs.successors(0), &[]); assert_eq!(sccs.successors(1), &[0]); }
rust_cleaned_test_functions.jsonl/83571
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 419 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 4387, 62, 18, 368, 341, 262, 9049, 688, 608, 381, 16930, 286, 220, 15, 70386, 10, 9248, 286, 760, 262, 760, 9248, 286, 348, 262, 760, 9248, 262, 488, 405, 220, 16, 1464, 220, 18, 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_completed_without_date_ical_parsing() { let version_tag = VersionTag::from(String::from("test-tag")); let sync_status = SyncStatus::Synced(version_tag); let item_url: Url = "http://some.id/for/testing".parse().unwrap(); let item = parse(EXAMPLE_ICAL_COMPLETED_WITHOUT_A_COMPLETION_DATE, item_url.clone(), sync_status.clone()).unwrap(); let task = item.unwrap_task(); assert_eq!(task.completed(), true); assert_eq!(task.completion_status(), &CompletionStatus::Completed(None)); }
rust_cleaned_test_functions.jsonl/99772
{ "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, 49068, 39904, 4164, 62, 938, 620, 28598, 368, 341, 286, 1077, 2319, 9372, 284, 6079, 5668, 486, 1499, 2242, 486, 1499, 445, 1944, 38204, 4010, 286, 1077, 12811, 4773, 284, 28937, 2522, 486, 12154,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_si_should_truncate_output() { new_ucmd!() .args(&["--to=si"]) .pipe_in_fixture("gnutest_si_input.txt") .succeeds() .stdout_is_fixture("gnutest_si_result.txt"); }
rust_cleaned_test_functions.jsonl/46013
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 124 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 40983, 43378, 3547, 26900, 7645, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 313, 983, 28, 6321, 14108, 286, 659, 13768, 1243, 74409, 445, 4905, 332, 477, 40983, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_register() { run_test(|url, client| { let response = client .post(&format!("{}/biome/register", url)) .json(&UsernamePassword { username: "test_register@gmail.com".to_string(), hashed_password: "Admin2193!".to_string(), }) .send() .unwrap(); assert_eq!(response.status().as_u16(), 200); let new_user = response.json::<RegistrationResponse>().unwrap(); assert_eq!("test_register@gmail.com", new_user.data.username); }) }
rust_cleaned_test_functions.jsonl/32285
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 335 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14000, 368, 341, 286, 1598, 4452, 22428, 1085, 11, 2943, 91, 341, 310, 1077, 2033, 284, 2943, 198, 394, 659, 2203, 2099, 2243, 88928, 4472, 8221, 635, 37837, 497, 2515, 1171, 394, 659, 2236, 209...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vget_lane_u64() { unsafe { let v: [u64; 1] = [1]; let r = vget_lane_u64(transmute(v), 0); assert_eq!(r, 1); } }
rust_cleaned_test_functions.jsonl/33019
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 124 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2273, 455, 60302, 7300, 21, 19, 368, 341, 286, 19860, 341, 310, 1077, 348, 25, 508, 84, 21, 19, 26, 220, 16, 60, 284, 508, 16, 935, 310, 1077, 435, 284, 348, 455, 60302, 7300, 21, 19, 3308...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_lower() { // Test non-binary string case let cases = vec![ ( Datum::Bytes(b"HELLO".to_vec()), Datum::Bytes(b"hello".to_vec()), ), (Datum::Bytes(b"123".to_vec()), Datum::Bytes(b"123".to_vec())), ( Datum::Bytes("CAFÉ".as_bytes().to_vec()), Datum::Bytes("café".as_bytes().to_vec()), ), ( Datum::Bytes("数据库".as_bytes().to_vec()), Datum::Bytes("数据库".as_bytes().to_vec()), ), ( Datum::Bytes("НОЧЬ НА ОКРАИНЕ МОСКВЫ".as_bytes().to_vec()), Datum::Bytes("ночь на окраине москвы".as_bytes().to_vec()), ), ( Datum::Bytes("قاعدة البيانات".as_bytes().to_vec()), Datum::Bytes("قاعدة البيانات".as_bytes().to_vec()), ), (Datum::Null, Datum::Null), ]; let mut ctx = EvalContext::default(); for (input, exp) in cases { let input = datum_expr(input); let op = scalar_func_expr(ScalarFuncSig::Lower, &[input]); let op = Expression::build(&mut ctx, op).unwrap(); let got = op.eval(&mut ctx, &[]).unwrap(); assert_eq!(got, exp); } // Test binary string case let cases = vec![ ( Datum::Bytes(b"hello".to_vec()), Datum::Bytes(b"hello".to_vec()), ), ( Datum::Bytes("CAFÉ".as_bytes().to_vec()), Datum::Bytes("CAFÉ".as_bytes().to_vec()), ), ( Datum::Bytes("数据库".as_bytes().to_vec()), Datum::Bytes("数据库".as_bytes().to_vec()), ), ( Datum::Bytes("НОЧЬ НА ОКРАИНЕ МОСКВЫ".as_bytes().to_vec()), Datum::Bytes("НОЧЬ НА ОКРАИНЕ МОСКВЫ".as_bytes().to_vec()), ), ( Datum::Bytes("قاعدة البيانات".as_bytes().to_vec()), Datum::Bytes("قاعدة البيانات".as_bytes().to_vec()), ), (Datum::Null, Datum::Null), ]; let mut ctx = EvalContext::default(); for (input, exp) in cases { let input = string_datum_expr_with_tp( input, FieldTypeTp::VarString, FieldTypeFlag::BINARY, -1, CHARSET_BIN.to_owned(), Collation::Binary, ); let op = scalar_func_expr(ScalarFuncSig::Lower, &[input]); let op = Expression::build(&mut ctx, op).unwrap(); let got = op.eval(&mut ctx, &[]).unwrap(); assert_eq!(got, exp); } }
rust_cleaned_test_functions.jsonl/9097
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1801 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30425, 368, 341, 286, 442, 3393, 2477, 94839, 914, 1142, 198, 286, 1077, 5048, 284, 7486, 90515, 310, 2399, 394, 68459, 486, 7078, 1883, 1, 50712, 1593, 3263, 983, 13251, 14702, 394, 68459, 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...
3
#[test] fn test_number_type_from_error() { assert_eq!( NumberType::from("xyz").unwrap_err(), NumberTypeError::NumberOfChunks("xyz".to_string()) ); assert_eq!( NumberType::from("l/xyz").unwrap_err(), NumberTypeError::NumberOfChunks("xyz".to_string()) ); assert_eq!( NumberType::from("l/123/xyz").unwrap_err(), NumberTypeError::NumberOfChunks("xyz".to_string()) ); assert_eq!( NumberType::from("l/abc/456").unwrap_err(), NumberTypeError::ChunkNumber("abc".to_string()) ); // split: invalid number of chunks: ‘xyz’ // assert_eq!( NumberType::from("l/abc/xyz").unwrap_err(), NumberTypeError::NumberOfChunks("xyz".to_string()) ); assert_eq!( NumberType::from("r/xyz").unwrap_err(), NumberTypeError::NumberOfChunks("xyz".to_string()) ); assert_eq!( NumberType::from("r/123/xyz").unwrap_err(), NumberTypeError::NumberOfChunks("xyz".to_string()) ); assert_eq!( NumberType::from("r/abc/456").unwrap_err(), NumberTypeError::ChunkNumber("abc".to_string()) ); // I // // // split: invalid number of chunks: ‘xyz’ // assert_eq!( NumberType::from("r/abc/xyz").unwrap_err(), NumberTypeError::NumberOfChunks("xyz".to_string()) ); }
rust_cleaned_test_functions.jsonl/16013
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 838 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5500, 1819, 5673, 4096, 368, 341, 286, 2060, 10714, 33673, 310, 5624, 929, 486, 1499, 445, 28854, 1827, 15454, 9266, 3148, 310, 5624, 80076, 486, 40619, 89681, 445, 28854, 3263, 983, 3904, 2398, 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_primitive_array_gt_eq() { cmp_i64!( gt_eq, &[8, 8, 8, 8, 8, 8, 8, 8, 8, 8], &[6, 7, 8, 9, 10, 6, 7, 8, 9, 10], vec![true, true, true, false, false, true, true, true, false, false] ); }
rust_cleaned_test_functions.jsonl/38881
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 173 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84087, 3858, 37479, 10714, 368, 341, 286, 26089, 5318, 21, 19, 33673, 310, 25161, 10714, 345, 310, 44590, 23, 11, 220, 23, 11, 220, 23, 11, 220, 23, 11, 220, 23, 11, 220, 23, 11, 220, 23, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_single_lock_manager() { let lock_mgr = start_lock_manager(); // Timeout assert!(!lock_mgr.has_waiter()); let (waiter, lock_info, f) = new_test_waiter(10.into(), 20.into(), 20); lock_mgr.wait_for( waiter.start_ts, waiter.cb, waiter.pr, waiter.lock, true, Some(WaitTimeout::Default), ); assert!(lock_mgr.has_waiter()); assert_elapsed( || expect_key_is_locked(f.wait().unwrap().unwrap(), lock_info), 2900, 3200, ); assert!(!lock_mgr.has_waiter()); // Wake up let (waiter_ts, lock) = ( 10.into(), Lock { ts: 20.into(), hash: 20, }, ); let (waiter, lock_info, f) = new_test_waiter(waiter_ts, lock.ts, lock.hash); lock_mgr.wait_for( waiter.start_ts, waiter.cb, waiter.pr, waiter.lock, true, Some(WaitTimeout::Default), ); assert!(lock_mgr.has_waiter()); lock_mgr.wake_up(lock.ts, vec![lock.hash], 30.into(), false); assert_elapsed( || expect_write_conflict(f.wait().unwrap(), waiter_ts, lock_info, 30.into()), 0, 200, ); assert!(!lock_mgr.has_waiter()); // Deadlock let (waiter1, lock_info1, f1) = new_test_waiter(10.into(), 20.into(), 20); lock_mgr.wait_for( waiter1.start_ts, waiter1.cb, waiter1.pr, waiter1.lock, false, Some(WaitTimeout::Default), ); assert!(lock_mgr.has_waiter()); let (waiter2, lock_info2, f2) = new_test_waiter(20.into(), 10.into(), 10); lock_mgr.wait_for( waiter2.start_ts, waiter2.cb, waiter2.pr, waiter2.lock, false, Some(WaitTimeout::Default), ); assert!(lock_mgr.has_waiter()); assert_elapsed( || expect_deadlock(f2.wait().unwrap(), 20.into(), lock_info2, 20), 0, 200, ); // Waiter2 releases its lock. lock_mgr.wake_up(20.into(), vec![20], 20.into(), true); assert_elapsed( || expect_write_conflict(f1.wait().unwrap(), 10.into(), lock_info1, 20.into()), 0, 200, ); assert!(!lock_mgr.has_waiter()); for is_first_lock in &[true, false] { let (waiter, _, f) = new_test_waiter(30.into(), 40.into(), 40); lock_mgr.wait_for( waiter.start_ts, waiter.cb, waiter.pr, waiter.lock, *is_first_lock, Some(WaitTimeout::Default), ); assert!(lock_mgr.has_waiter()); assert_eq!(lock_mgr.remove_from_detected(30.into()), !is_first_lock); lock_mgr.wake_up(40.into(), vec![40], 40.into(), false); f.wait().unwrap().unwrap_err(); } assert!(!lock_mgr.has_waiter()); let prev_wake_up = TASK_COUNTER_METRICS.wake_up.get(); lock_mgr.wake_up(10.into(), vec![], 10.into(), false); assert_eq!(TASK_COUNTER_METRICS.wake_up.get(), prev_wake_up); let prev_clean_up = TASK_COUNTER_METRICS.clean_up.get(); lock_mgr.wake_up(10.into(), vec![], 10.into(), false); assert_eq!(TASK_COUNTER_METRICS.clean_up.get(), prev_clean_up); let prev_clean_up = TASK_COUNTER_METRICS.clean_up.get(); lock_mgr.wake_up(10.into(), vec![], 10.into(), true); assert_eq!(TASK_COUNTER_METRICS.clean_up.get(), prev_clean_up); let (waiter, lock_info, f) = new_test_waiter(10.into(), 20.into(), 20); let prev_wait_for = TASK_COUNTER_METRICS.wait_for.get(); lock_mgr.wait_for( waiter.start_ts, waiter.cb, waiter.pr, waiter.lock, false, None, ); assert_elapsed( || expect_key_is_locked(f.wait().unwrap().unwrap(), lock_info), 0, 200, ); assert_eq!(TASK_COUNTER_METRICS.wait_for.get(), prev_wait_for,); }
rust_cleaned_test_functions.jsonl/12320
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2517 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19487, 9818, 12144, 368, 341, 286, 1077, 5296, 42438, 284, 1191, 9818, 12144, 1428, 286, 442, 39380, 198, 286, 2060, 0, 3471, 1023, 42438, 6858, 18760, 261, 1423, 286, 1077, 320, 11489, 261, 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...
7
#[test] fn test_insufficient_funds() { let (genesis_config, mint_keypair) = create_genesis_config(11_000); let bank = Bank::new_for_tests(&genesis_config); let pubkey = solana_sdk::pubkey::new_rand(); bank.transfer(1_000, &mint_keypair, &pubkey).unwrap(); assert_eq!(bank.transaction_count(), 1); assert_eq!(bank.get_balance(&pubkey), 1_000); assert_eq!( bank.transfer(10_001, &mint_keypair, &pubkey), Err(TransactionError::InstructionError( 0, SystemError::ResultWithNegativeLamports.into(), )) ); assert_eq!(bank.transaction_count(), 1); let mint_pubkey = mint_keypair.pubkey(); assert_eq!(bank.get_balance(&mint_pubkey), 10_000); assert_eq!(bank.get_balance(&pubkey), 1_000); }
rust_cleaned_test_functions.jsonl/28860
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 415 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34386, 26683, 761, 42950, 368, 341, 286, 1077, 320, 77894, 5332, 11, 28337, 3097, 12670, 8, 284, 1855, 16322, 13774, 5332, 7, 16, 16, 62, 15, 15, 15, 317, 286, 1077, 6073, 284, 8547, 486, 931,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_compare_larger_equal_lists() { use std::iter::repeat; let v: Vec<char> = repeat('x').take(1000).collect(); assert_eq!(Comparison::Equal, sublist(&v, &v)); }
rust_cleaned_test_functions.jsonl/68276
{ "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, 32235, 907, 41776, 11478, 37288, 368, 341, 262, 990, 1460, 486, 2015, 486, 30624, 401, 262, 1077, 348, 25, 11312, 21919, 29, 284, 13153, 492, 87, 1823, 22769, 7, 16, 15, 15, 15, 568, 17384, 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
#[test] fn test_all_items() { check( r#" macro_rules! m { ($($i:item)*) => ($($i )*) } m! { extern crate a; mod b; mod c {} use d; const E: i32 = 0; static F: i32 = 0; impl G {} struct H; enum I { Foo } trait J {} fn h() {} extern {} type T = u8; } "#, expect![[r#" macro_rules! m { ($($i:item)*) => ($($i )*) } extern crate a; mod b; mod c {} use d; const E: i32 = 0; static F: i32 = 0; impl G {} struct H; enum I { Foo } trait J {} fn h() {} extern {} type T = u8; "#]], ); }
rust_cleaned_test_functions.jsonl/85232
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 301 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5705, 12134, 368, 341, 262, 1779, 1006, 286, 435, 2, 698, 32606, 21407, 0, 296, 314, 1711, 699, 72, 78852, 8, 3764, 589, 1711, 699, 72, 873, 3764, 456, 76, 0, 341, 262, 15637, 17717, 264, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_build_url_mget() { let url_builder = ElasticsearchUrlBuilder::new("http://server".to_string(), "INDEX_NAME".to_string()); assert_that(&url_builder.mget()).is_equal_to("http://server/INDEX_NAME/_doc/_mget".to_string()); }
rust_cleaned_test_functions.jsonl/35094
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 94 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20801, 2903, 717, 455, 368, 341, 220, 1077, 2515, 28532, 284, 58887, 2864, 3297, 486, 931, 445, 1254, 1110, 4030, 3263, 983, 3904, 1507, 330, 44331, 4708, 3263, 983, 3904, 5231, 220, 2060, 70197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_channel_config() { assert!(serde_yaml::from_str::<ChannelConfig>("{}").is_err()); assert_eq!( serde_yaml::from_str::<ChannelConfig>(r#" name: x type: GR channel: y "#).unwrap(), ChannelConfig { name: "x".to_string(), channel_type: ChannelType::GR, channel: "y".to_string(), services: vec![], excluded_services: vec![], disabled: false, }); assert_eq!( serde_yaml::from_str::<ChannelConfig>(r#" name: x type: GR channel: y disabled: true "#).unwrap(), ChannelConfig { name: "x".to_string(), channel_type: ChannelType::GR, channel: "y".to_string(), services: vec![], excluded_services: vec![], disabled: true, }); assert_eq!( serde_yaml::from_str::<ChannelConfig>(r#" name: x type: GR channel: y excluded-services: [100] "#).unwrap(), ChannelConfig { name: "x".to_string(), channel_type: ChannelType::GR, channel: "y".to_string(), services: vec![], excluded_services: vec![100.into()], disabled: false, }); assert!( serde_yaml::from_str::<ChannelConfig>(r#" name: x type: WOWOW channel: y "#).is_err()); }
rust_cleaned_test_functions.jsonl/6413
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1075 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14571, 5332, 368, 341, 286, 2060, 10297, 47024, 64380, 486, 1499, 2895, 27638, 9629, 2648, 13211, 6257, 1827, 285, 9266, 5231, 286, 2060, 10714, 33673, 310, 61570, 64380, 486, 1499, 2895, 27638, 962...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_delete_ns() -> Result<()> { let data_directory = tempdir().unwrap(); let index = Index::at(data_directory.path()).unwrap(); let namespace_name = "some_namespace".parse().unwrap(); index.create_ns(&namespace_name)?; index.delete_ns(&namespace_name)?; assert!(index.list_ns().unwrap().is_empty()); Ok(()) }
rust_cleaned_test_functions.jsonl/44411
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 174 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3560, 11353, 34728, 368, 1464, 5714, 71698, 341, 286, 1077, 821, 14846, 284, 2730, 3741, 1005, 15454, 1428, 286, 1077, 1922, 284, 8008, 486, 266, 2592, 14846, 3875, 6011, 15454, 543, 286, 1077, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_from_glib_container() { unsafe { let test_a: GString = FromGlibContainer::from_glib_container_num( ffi::g_strdup("hello_world".as_ptr() as *const i8), 5, ); assert_eq!("hello", test_a.as_str()); let test_b: GString = FromGlibContainer::from_glib_none_num("hello_world".as_ptr(), 5); assert_eq!("hello", test_b.as_str()); let test_c: GString = FromGlibContainer::from_glib_none_num(std::ptr::null::<i8>(), 0); assert_eq!("", test_c.as_str()); let test_d: GString = FromGlibContainer::from_glib_none_num("".as_ptr(), 0); assert_eq!("", test_d.as_str()); let test_e: GString = FromGlibContainer::from_glib_container_num( ffi::g_strdup(std::ptr::null::<i8>()), 0, ); assert_eq!("", test_e.as_str()); } }
rust_cleaned_test_functions.jsonl/58212
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 516 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 1889, 2740, 15847, 368, 341, 286, 19860, 341, 310, 1077, 1273, 4306, 25, 479, 703, 284, 5542, 38, 2740, 4502, 486, 1499, 1889, 2740, 15847, 4273, 1006, 394, 76956, 486, 70, 45901, 445, 149...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mine() { let mut chain = Chain::new(); let (t0, t0_s) = Transaction::debug_make_register(format!("SN1337BIKE")); let (t1, t1_s) = Transaction::debug_make_transfer(&t0, &t0_s); let (t2, _) = Transaction::debug_make_transfer(&t1, &t1_s); // First block let block = chain.mine(t0); let hash = hash::hash_to_str(&block.calc_hash()); assert!( hash.ends_with(HASH_END_PATTERN), "Hash must end with \"{}\" (was: \"{}\")", HASH_END_PATTERN, hash ); chain.push(block, false).expect("Chain::push failure (0)"); // Second block let block = chain.mine(t1); let hash = hash::hash_to_str(&block.calc_hash()); assert!( hash.ends_with(HASH_END_PATTERN), "Hash must end with \"{}\" (was: \"{}\")", HASH_END_PATTERN, hash ); chain.push(block, false).expect("Chain::push failure (0)"); // Third block let block = chain.mine(t2); let hash = hash::hash_to_str(&block.calc_hash()); assert!( hash.ends_with(HASH_END_PATTERN), "Hash must end with \"{}\" (was: \"{}\")", HASH_END_PATTERN, hash ); chain.push(block, false).expect("Chain::push failure (0)"); }
rust_cleaned_test_functions.jsonl/102224
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 720 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 482, 368, 341, 286, 1077, 5206, 8781, 284, 28525, 486, 931, 1428, 286, 1077, 320, 83, 15, 11, 259, 15, 643, 8, 284, 17869, 486, 8349, 28230, 14000, 20698, 17223, 18966, 16, 18, 18, 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_split_evenly() { let colors = vec![ &RED, &BLUE, &YELLOW, &WHITE, &BLACK, &MAGENTA, &CYAN, &BLUE, &RED, ]; let drawing_area = create_mocked_drawing_area(902, 900, |m| { for col in 0..3 { for row in 0..3 { let colors = colors.clone(); m.check_draw_rect(move |c, _, f, u, d| { assert_eq!(c, colors[col * 3 + row].to_rgba()); assert_eq!(f, true); assert_eq!(u, (300 * row as i32 + 2.min(row) as i32, 300 * col as i32)); assert_eq!( d, ( 300 + 300 * row as i32 + 2.min(row + 1) as i32 - 1, 300 + 300 * col as i32 - 1 ) ); }); } } m.drop_check(|b| { assert_eq!(b.num_draw_rect_call, 9); assert_eq!(b.draw_count, 9); }); }); drawing_area .split_evenly((3, 3)) .iter_mut() .zip(colors.iter()) .for_each(|(d, c)| { d.fill(*c).expect("Drawing Failure"); }); }
rust_cleaned_test_functions.jsonl/81493
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 904 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17052, 68347, 398, 368, 341, 286, 1077, 7987, 284, 7486, 90515, 310, 609, 6504, 11, 609, 64330, 11, 609, 97029, 11, 609, 56999, 11, 609, 62849, 11, 609, 44, 1890, 72321, 11, 609, 34525, 1093, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_response_cookies() { use crate::httpmessage::HttpMessage; let req = crate::test::TestRequest::default() .header(COOKIE, "cookie1=value1") .header(COOKIE, "cookie2=value2") .finish(); let cookies = req.cookies().unwrap(); let resp = Response::Ok() .cookie( crate::http::Cookie::build("name", "value") .domain("www.rust-lang.org") .path("/test") .http_only(true) .max_age(time::Duration::days(1)) .finish(), ) .del_cookie(&cookies[0]) .finish(); let mut val: Vec<_> = resp .headers() .get_all("Set-Cookie") .iter() .map(|v| v.to_str().unwrap().to_owned()) .collect(); val.sort(); assert!(val[0].starts_with("cookie1=; Max-Age=0;")); assert_eq!( val[1], "name=value; HttpOnly; Path=/test; Domain=www.rust-lang.org; Max-Age=86400" ); }
rust_cleaned_test_functions.jsonl/18832
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 640 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9655, 94158, 368, 341, 286, 990, 17717, 486, 1254, 1994, 486, 2905, 2052, 401, 286, 1077, 4232, 284, 17717, 486, 1944, 486, 2271, 1900, 486, 2258, 741, 310, 659, 2708, 3025, 46, 23588, 11, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_eval_binary_function_vector_scalar() { #[rpn_fn(nullable)] fn foo(v1: Option<&Real>, v2: Option<&Real>) -> Result<Option<Real>> { Ok(Some(*v1.unwrap() - *v2.unwrap())) } let mut columns = LazyBatchColumnVec::from(vec![{ let mut col = LazyBatchColumn::decoded_with_capacity_and_tp(3, EvalType::Real); col.mut_decoded().push_real(Real::new(1.0).ok()); col.mut_decoded().push_real(Real::new(5.5).ok()); col.mut_decoded().push_real(Real::new(-4.3).ok()); col }]); let schema = &[FieldTypeTp::Double.into()]; let exp = RpnExpressionBuilder::new_for_test() .push_column_ref_for_test(0) .push_constant_for_test(1.5f64) .push_fn_call_for_test(foo_fn_meta(), 2, FieldTypeTp::Double) .build_for_test(); let mut ctx = EvalContext::default(); let result = exp.eval(&mut ctx, schema, &mut columns, &[2, 0], 2); let val = result.unwrap(); assert!(val.is_vector()); assert_eq!( val.vector_value().unwrap().as_ref().to_real_vec(), [ Real::new(-5.8).ok(), // original row 2 Real::new(-0.5).ok(), // original row 0 ] ); assert_eq!(val.vector_value().unwrap().logical_rows(), &[0, 1]); assert_eq!(val.field_type().as_accessor().tp(), FieldTypeTp::Double); }
rust_cleaned_test_functions.jsonl/92666
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 766 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 31761, 9174, 12247, 41652, 368, 341, 394, 11506, 81, 19958, 15246, 34885, 5563, 286, 5168, 15229, 3747, 16, 25, 6959, 52244, 12768, 8066, 348, 17, 25, 6959, 52244, 12768, 9231, 1464, 5714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mount_cgroups() { let stdout_fd = std::io::stdout().as_raw_fd(); let mount = oci::Mount { destination: "/cgroups".to_string(), r#type: "cgroup".to_string(), source: "/cgroups".to_string(), options: vec!["shared".to_string()], }; let tempdir = tempdir().unwrap(); let rootfs = tempdir.path().to_str().unwrap().to_string(); let flags = MsFlags::MS_RDONLY; let mut cpath = HashMap::new(); let mut cgroup_mounts = HashMap::new(); cpath.insert("cpu".to_string(), "cpu".to_string()); cpath.insert("memory".to_string(), "memory".to_string()); cgroup_mounts.insert("default".to_string(), "default".to_string()); cgroup_mounts.insert("cpu".to_string(), "cpu".to_string()); cgroup_mounts.insert("memory".to_string(), "memory".to_string()); let ret = create_dir_all(tempdir.path().join("cgroups")); assert!(ret.is_ok(), "Should pass. Got {:?}", ret); let ret = create_dir_all(tempdir.path().join("cpu")); assert!(ret.is_ok(), "Should pass. Got {:?}", ret); let ret = create_dir_all(tempdir.path().join("memory")); assert!(ret.is_ok(), "Should pass. Got {:?}", ret); let ret = mount_cgroups( stdout_fd, &mount, &rootfs, flags, "", &cpath, &cgroup_mounts, ); assert!(ret.is_ok(), "Should pass. Got: {:?}", ret); }
rust_cleaned_test_functions.jsonl/42575
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 744 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 57593, 666, 16753, 368, 341, 286, 1077, 20075, 17676, 284, 1460, 486, 815, 486, 36358, 1005, 300, 16067, 17676, 543, 286, 1077, 6470, 284, 93975, 486, 16284, 341, 310, 9106, 25, 3521, 66, 16753, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_outamemory() { let mut array = ArrayVecFormatter::<1>::new(); array.push_byte(b'x').unwrap(); assert_eq!( array.push_byte(b'x'), Err(Error::from(ErrorCode::OutOfMemory)) ); assert_eq!( array.push_str(b"x"), Err(Error::from(ErrorCode::OutOfMemory)) ); }
rust_cleaned_test_functions.jsonl/95662
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6068, 309, 4731, 368, 341, 262, 1077, 5206, 1334, 284, 2910, 10050, 14183, 27638, 16, 6831, 931, 543, 262, 1334, 2552, 19737, 1883, 6, 87, 1823, 15454, 543, 262, 2060, 10714, 33673, 286, 1334, 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_bad_hyphen() { // See: https://github.com/chyh1990/yaml-rust/issues/23 let s = "{-"; assert!(YamlLoader::load_from_str(&s).is_err()); }
rust_cleaned_test_functions.jsonl/1208
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 95 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34199, 1523, 88, 14769, 368, 341, 286, 442, 3496, 25, 3703, 1110, 5204, 905, 21284, 73801, 16, 24, 24, 15, 26491, 9467, 3795, 590, 38745, 14, 17, 18, 198, 286, 1077, 274, 284, 13868, 12, 876, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_request() { use helix::*; let req = GetStreamsRequest::builder().build(); let data = br#" { "data": [ { "id": "26007494656", "user_id": "23161357", "user_name": "LIRIK", "user_login": "lirik", "game_id": "417752", "type": "live", "title": "Hey Guys, It's Monday - Twitter: @Lirik", "viewer_count": 32575, "started_at": "2017-08-14T16:08:32Z", "language": "en", "thumbnail_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_lirik-{width}x{height}.jpg", "tag_ids": [ "6ea6bca4-4712-4ab9-a906-e3336a9d8039" ] }, { "id": "26007494656", "user_id": "23161357", "user_name": "LIRIK", "user_login": "lirik", "game_id": "417752", "type": "live", "title": "Hey Guys, It's Monday - Twitter: @Lirik", "viewer_count": 32575, "started_at": "2017-08-14T16:08:32Z", "language": "en", "thumbnail_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_lirik-{width}x{height}.jpg", "tag_ids": [ "6ea6bca4-4712-4ab9-a906-e3336a9d8039" ] } ], "pagination": { "cursor": "eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MjB9fQ==" } } "# .to_vec(); let http_response = http::Response::builder().body(data).unwrap(); let uri = req.get_uri().unwrap(); assert_eq!(uri.to_string(), "https://api.twitch.tv/helix/streams?"); dbg!(GetStreamsRequest::parse_response(Some(req), &uri, http_response).unwrap()); }
rust_cleaned_test_functions.jsonl/44002
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1004 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7893, 368, 341, 262, 990, 11338, 941, 56162, 262, 1077, 4232, 284, 2126, 73576, 1900, 486, 17850, 1005, 5834, 1428, 1066, 262, 1077, 821, 284, 1411, 2, 698, 515, 262, 330, 691, 788, 2278, 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_invalid_projection() -> Result<()> { let schema = Arc::new(Schema::new(vec![ Field::new("a", DataType::Int32, false), Field::new("b", DataType::Int32, false), Field::new("c", DataType::Int32, false), ])); let batch = RecordBatch::try_new( schema.clone(), vec![ Arc::new(Int32Array::from(vec![1, 2, 3])), Arc::new(Int32Array::from(vec![4, 5, 6])), Arc::new(Int32Array::from(vec![7, 8, 9])), ], )?; let provider = MemTable::new(schema, vec![vec![batch]])?; let projection: Vec<usize> = vec![0, 4]; match provider.scan(&Some(projection), 1024) { Err(ExecutionError::General(e)) => { assert_eq!("\"Projection index out of range\"", format!("{:?}", e)) } _ => assert!(false, "Scan should failed on invalid projection"), }; Ok(()) }
rust_cleaned_test_functions.jsonl/20928
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 522 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31433, 72738, 368, 1464, 5714, 71698, 341, 286, 1077, 10802, 284, 19689, 486, 931, 3759, 3416, 486, 931, 25592, 90515, 310, 8601, 486, 931, 445, 64, 497, 33172, 486, 1072, 18, 17, 11, 895, 1326,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_remove_requests() { let (mut request_manager, validators) = generate_request_manager_and_validators(0, 2); let validator_0 = vec![validators[0].clone()]; let validator_1 = vec![validators[1].clone()]; // Add version requests to request manager request_manager.add_request(1, validator_0.clone()); request_manager.add_request(3, validator_1.clone()); request_manager.add_request(5, validator_0.clone()); request_manager.add_request(10, validator_0); request_manager.add_request(12, validator_1); // Remove all request versions below 5 request_manager.remove_requests(5); // Verify versions updated correctly assert!(request_manager.get_last_request_time(1).is_none()); assert!(request_manager.get_last_request_time(3).is_none()); assert!(request_manager.get_last_request_time(5).is_some()); assert!(request_manager.get_last_request_time(10).is_some()); assert!(request_manager.get_last_request_time(12).is_some()); }
rust_cleaned_test_functions.jsonl/42116
{ "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, 18193, 37216, 368, 341, 286, 1077, 320, 6984, 1681, 12144, 11, 38588, 8, 284, 6923, 7893, 12144, 8378, 8337, 2973, 7, 15, 11, 220, 17, 626, 286, 1077, 22935, 62, 15, 284, 7486, 20703, 59424, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_latin1_byte_compatible_up_to() { let buffer = b"a\x81\xB6\xF6\xF0\x82\xB4"; assert_eq!( BIG5.new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( EUC_JP .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( EUC_KR .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( GB18030 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( GBK.new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert!(REPLACEMENT .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .is_none()); assert_eq!( SHIFT_JIS .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( UTF_8 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert!(UTF_16BE .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .is_none()); assert!(UTF_16LE .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .is_none()); assert_eq!( ISO_2022_JP .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( IBM866 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( ISO_8859_2 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 2 ); assert_eq!( ISO_8859_3 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 2 ); assert_eq!( ISO_8859_4 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 2 ); assert_eq!( ISO_8859_5 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 2 ); assert_eq!( ISO_8859_6 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 2 ); assert_eq!( ISO_8859_7 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 2 ); assert_eq!( ISO_8859_8 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 3 ); assert_eq!( ISO_8859_10 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 2 ); assert_eq!( ISO_8859_13 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 4 ); assert_eq!( ISO_8859_14 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 4 ); assert_eq!( ISO_8859_15 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 6 ); assert_eq!( ISO_8859_16 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 4 ); assert_eq!( ISO_8859_8_I .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 3 ); assert_eq!( KOI8_R .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( KOI8_U .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( MACINTOSH .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( WINDOWS_874 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 2 ); assert_eq!( WINDOWS_1250 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 4 ); assert_eq!( WINDOWS_1251 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( WINDOWS_1252 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 5 ); assert_eq!( WINDOWS_1253 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 3 ); assert_eq!( WINDOWS_1254 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 4 ); assert_eq!( WINDOWS_1255 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 3 ); assert_eq!( WINDOWS_1256 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( WINDOWS_1257 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 4 ); assert_eq!( WINDOWS_1258 .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 4 ); assert_eq!( X_MAC_CYRILLIC .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert_eq!( X_USER_DEFINED .new_decoder_without_bom_handling() .latin1_byte_compatible_up_to(buffer) .unwrap(), 1 ); assert!(UTF_8 .new_decoder() .latin1_byte_compatible_up_to(buffer) .is_none()); let mut decoder = UTF_8.new_decoder(); let mut output = [0u16; 4]; let _ = decoder.decode_to_utf16(b"\xEF", &mut output, false); assert!(decoder.latin1_byte_compatible_up_to(buffer).is_none()); let _ = decoder.decode_to_utf16(b"\xBB\xBF", &mut output, false); assert_eq!(decoder.latin1_byte_compatible_up_to(buffer), Some(1)); let _ = decoder.decode_to_utf16(b"\xEF", &mut output, false); assert_eq!(decoder.latin1_byte_compatible_up_to(buffer), None); }
rust_cleaned_test_functions.jsonl/90286
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 5548 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 907, 14768, 16, 19737, 2965, 37079, 8237, 2346, 368, 341, 286, 1077, 4147, 284, 293, 56693, 3462, 23, 16, 3462, 33, 21, 3462, 37, 21, 3462, 37, 15, 3462, 23, 17, 3462, 33, 19, 876, 286, 2060...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ply_read_write() { let tmp_dir = TempDir::new("test_ply_read_write").unwrap(); let file_path_test = tmp_dir.path().join("out.ply"); let file_path_gt = "src/test_data/xyz_f32_rgb_u8_intensity_f32.ply"; { let mut ply_writer = PlyNodeWriter::new(&file_path_test, Encoding::Plain, OpenMode::Truncate); PlyIterator::from_file(file_path_gt, BATCH_SIZE) .unwrap() .for_each(|p| { ply_writer.write(&p).unwrap(); }); } // Now append to the file { let mut ply_writer = PlyNodeWriter::new(&file_path_test, Encoding::Plain, OpenMode::Append); PlyIterator::from_file(file_path_gt, BATCH_SIZE) .unwrap() .for_each(|p| { ply_writer.write(&p).unwrap(); }); } PlyIterator::from_file(file_path_gt, BATCH_SIZE) .unwrap() .chain(PlyIterator::from_file(file_path_gt, BATCH_SIZE).unwrap()) .zip(PlyIterator::from_file(&file_path_test, BATCH_SIZE).unwrap()) .for_each(|(gt, test)| { assert_eq!(gt.position, test.position); let gt_color: &Vec<Vector3<u8>> = gt.get_attribute_vec("color").unwrap(); let test_color: &Vec<Vector3<u8>> = test.get_attribute_vec("color").unwrap(); assert_eq!(gt_color, test_color); let gt_intensity: &Vec<f32> = gt.get_attribute_vec("intensity").unwrap(); let test_intensity: &Vec<f32> = test.get_attribute_vec("intensity").unwrap(); assert_eq!(gt_intensity.len(), test_intensity.len()); assert!(gt_intensity.iter().all(|i| i.is_nan())); assert!(test_intensity.iter().all(|i| i.is_nan())); }); }
rust_cleaned_test_functions.jsonl/85538
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1049 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 398, 6443, 9165, 368, 341, 286, 1077, 4174, 4334, 284, 19944, 6184, 486, 931, 445, 1944, 620, 398, 6443, 9165, 1827, 15454, 543, 286, 1077, 1034, 2638, 4452, 284, 4174, 4334, 3875, 1005, 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
#[test] fn test_four_of_a_kind_cascade() { test(&["3S 3H 2S 3D 3C", "3S 3H 4S 3D 3C"], &["3S 3H 4S 3D 3C"]) }
rust_cleaned_test_functions.jsonl/49919
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 77 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 56142, 3575, 4306, 33162, 666, 19977, 368, 341, 1066, 262, 1273, 2099, 1183, 18, 50, 220, 18, 39, 220, 17, 50, 220, 18, 35, 220, 18, 34, 497, 330, 18, 50, 220, 18, 39, 220, 19, 50, 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_bounded() { let (tx, rx) = super::bounded::<u64>(10); tx.try_send(1).unwrap(); for i in 2..11 { tx.clone().send(i).unwrap(); } assert_eq!(tx.try_send(11), Err(TrySendError::Full(11))); assert_eq!(rx.try_recv(), Ok(1)); for i in 2..11 { assert_eq!(rx.recv(), Ok(i)); } assert_eq!(rx.try_recv(), Err(TryRecvError::Empty)); let timer = Instant::now(); assert_eq!( rx.recv_timeout(Duration::from_millis(100)), Err(RecvTimeoutError::Timeout) ); assert!((i64::from(timer.elapsed().subsec_nanos()) - 100_000_000).abs() < 1_000_000); drop(rx); assert_eq!(tx.send(2), Err(SendError(2))); assert_eq!(tx.try_send(2), Err(TrySendError::Disconnected(2))); let (tx, rx) = super::bounded::<u64>(10); tx.send(2).unwrap(); tx.send(3).unwrap(); drop(tx); assert_eq!(rx.try_recv(), Ok(2)); assert_eq!(rx.recv(), Ok(3)); assert_eq!(rx.recv(), Err(RecvError)); assert_eq!(rx.try_recv(), Err(TryRecvError::Disconnected)); assert_eq!( rx.recv_timeout(Duration::from_millis(100)), Err(RecvTimeoutError::Disconnected) ); let (tx1, rx1) = super::bounded::<u64>(10); let (tx2, rx2) = super::bounded::<u64>(0); thread::spawn(move || { thread::sleep(Duration::from_millis(100)); tx1.send(10).unwrap(); thread::sleep(Duration::from_millis(100)); assert_eq!(rx2.recv(), Ok(2)); }); let timer = Instant::now(); assert_eq!(rx1.recv(), Ok(10)); assert!((i64::from(timer.elapsed().subsec_nanos()) - 100_000_000).abs() < 1_000_000); let timer = Instant::now(); tx2.send(2).unwrap(); assert!(timer.elapsed() > Duration::from_millis(50)); }
rust_cleaned_test_functions.jsonl/43344
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1020 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 13082, 368, 341, 286, 1077, 320, 3998, 11, 19111, 8, 284, 2256, 486, 65686, 27638, 84, 21, 19, 2235, 16, 15, 317, 286, 9854, 48779, 13565, 7, 16, 568, 15454, 543, 286, 369, 600, 304, 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...
4
#[test] fn test_to_querystring() { macro_rules! qs_test { (| $r:ident | $b:block, $expected:expr) => {{ let $r = StatusesRequest::new(); let $r = $b; let qs = $r .to_querystring() .expect("Failed to serialize querystring"); assert_eq!(&qs, $expected); }}; } qs_test!(|request| { request.only_media() }, "?only_media=1"); qs_test!( |request| { request.exclude_replies() }, "?exclude_replies=1" ); qs_test!(|request| { request.pinned() }, "?pinned=1"); qs_test!(|request| { request.max_id("foo") }, "?max_id=foo"); qs_test!(|request| { request.since_id("foo") }, "?since_id=foo"); qs_test!(|request| { request.limit(42) }, "?limit=42"); qs_test!( |request| { request.only_media().exclude_replies() }, "?only_media=1&exclude_replies=1" ); qs_test!( |request| { request.only_media().pinned() }, "?only_media=1&pinned=1" ); qs_test!( |request| { request.only_media().max_id("foo") }, "?only_media=1&max_id=foo" ); qs_test!( |request| { request.only_media().since_id("foo") }, "?only_media=1&since_id=foo" ); qs_test!( |request| { request.only_media().limit(42) }, "?only_media=1&limit=42" ); qs_test!( |request| { request.exclude_replies().only_media() }, "?only_media=1&exclude_replies=1" ); qs_test!( |request| { request.exclude_replies().pinned() }, "?exclude_replies=1&pinned=1" ); qs_test!( |request| { request.exclude_replies().max_id("foo") }, "?exclude_replies=1&max_id=foo" ); qs_test!( |request| { request.exclude_replies().since_id("foo") }, "?exclude_replies=1&since_id=foo" ); qs_test!( |request| { request.exclude_replies().limit(42) }, "?exclude_replies=1&limit=42" ); qs_test!( |request| { request.pinned().only_media() }, "?only_media=1&pinned=1" ); qs_test!( |request| { request.pinned().exclude_replies() }, "?exclude_replies=1&pinned=1" ); qs_test!( |request| { request.pinned().max_id("foo") }, "?pinned=1&max_id=foo" ); qs_test!( |request| { request.pinned().since_id("foo") }, "?pinned=1&since_id=foo" ); qs_test!( |request| { request.pinned().limit(42) }, "?pinned=1&limit=42" ); qs_test!( |request| { request.max_id("foo").only_media() }, "?only_media=1&max_id=foo" ); qs_test!( |request| { request.max_id("foo").exclude_replies() }, "?exclude_replies=1&max_id=foo" ); qs_test!( |request| { request.max_id("foo").pinned() }, "?pinned=1&max_id=foo" ); qs_test!( |request| { request.max_id("foo").since_id("foo") }, "?max_id=foo&since_id=foo" ); qs_test!( |request| { request.max_id("foo").limit(42) }, "?max_id=foo&limit=42" ); qs_test!( |request| { request.since_id("foo").only_media() }, "?only_media=1&since_id=foo" ); qs_test!( |request| { request.since_id("foo").exclude_replies() }, "?exclude_replies=1&since_id=foo" ); qs_test!( |request| { request.since_id("foo").pinned() }, "?pinned=1&since_id=foo" ); qs_test!( |request| { request.since_id("foo").max_id("foo") }, "?max_id=foo&since_id=foo" ); qs_test!( |request| { request.since_id("foo").limit(42) }, "?since_id=foo&limit=42" ); qs_test!( |request| { request.limit(42).only_media() }, "?only_media=1&limit=42" ); qs_test!( |request| { request.limit(42).exclude_replies() }, "?exclude_replies=1&limit=42" ); qs_test!( |request| { request.limit(42).pinned() }, "?pinned=1&limit=42" ); qs_test!( |request| { request.limit(42).max_id("foo") }, "?max_id=foo&limit=42" ); qs_test!( |request| { request.limit(42).since_id("foo") }, "?since_id=foo&limit=42" ); }
rust_cleaned_test_functions.jsonl/6373
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2806 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 5738, 917, 368, 341, 286, 18072, 21407, 0, 32421, 4452, 341, 310, 320, 91, 400, 81, 25, 1713, 760, 400, 65, 57628, 11, 400, 7325, 96011, 8, 589, 80505, 394, 1077, 400, 81, 284, 8104, 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_reformat_tabs() { let input = indoc! {r#" datasource pg { provider\t=\t"postgresql" url = "postgresql://" } "#}; let expected = expect![[r#" datasource pg { provider = "postgresql" url = "postgresql://" } "#]]; let result = Reformatter::new(&input.replace("\\t", "\t")).reformat_to_string(); expected.assert_eq(&result); }
rust_cleaned_test_functions.jsonl/73217
{ "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, 1288, 2243, 57953, 368, 341, 262, 1077, 1946, 284, 1257, 509, 0, 314, 81, 2, 698, 286, 69156, 17495, 341, 688, 9109, 4955, 34433, 83, 1, 88470, 698, 688, 2515, 284, 330, 88470, 1110, 698, 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_datetime_format_alignment() { let datetime = Utc.ymd(2007, 01, 02); // Item::Literal let percent = datetime.format("%%"); assert_eq!(" %", format!("{:>3}", percent)); assert_eq!("% ", format!("{:<3}", percent)); assert_eq!(" % ", format!("{:^3}", percent)); // Item::Numeric let year = datetime.format("%Y"); assert_eq!(" 2007", format!("{:>6}", year)); assert_eq!("2007 ", format!("{:<6}", year)); assert_eq!(" 2007 ", format!("{:^6}", year)); // Item::Fixed let tz = datetime.format("%Z"); assert_eq!(" UTC", format!("{:>5}", tz)); assert_eq!("UTC ", format!("{:<5}", tz)); assert_eq!(" UTC ", format!("{:^5}", tz)); let ymd = datetime.format("%Y %B %d"); let ymd_formatted = "2007 January 02"; assert_eq!(format!(" {}", ymd_formatted), format!("{:>17}", ymd)); assert_eq!(format!("{} ", ymd_formatted), format!("{:<17}", ymd)); assert_eq!(format!(" {} ", ymd_formatted), format!("{:^17}", ymd)); }
rust_cleaned_test_functions.jsonl/89868
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 555 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28943, 8955, 51006, 368, 341, 286, 1077, 8874, 284, 547, 10413, 13, 1600, 67, 7, 17, 15, 15, 22, 11, 220, 15, 16, 11, 220, 15, 17, 626, 286, 442, 5739, 486, 17350, 198, 286, 1077, 3266, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_backup() { let mut t = make_parser(); assert_eq!(t.next().and_then(|n| Some(n.typ)), Some(ItemType::ItemText)); let i = t.next().unwrap(); let s = i.to_string(); t.backup(i); assert_eq!(t.next().and_then(|n| Some(n.to_string())), Some(s)); assert_eq!(t.last().and_then(|n| Some(n.typ)), Some(ItemType::ItemEOF)); }
rust_cleaned_test_functions.jsonl/8625
{ "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, 44710, 368, 341, 286, 1077, 5206, 259, 284, 1281, 18517, 543, 286, 2060, 10714, 10297, 83, 4529, 1005, 437, 68367, 22428, 77, 91, 4329, 1445, 49286, 5731, 4329, 29771, 929, 486, 1234, 1178, 1106, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_note_on_midi_conversion() { let event = NoteEvent::NoteOn { timing: TIMING, channel: 1, note: 2, velocity: 0.6929134, }; assert_eq!( NoteEvent::from_midi(TIMING, event.as_midi().unwrap()).unwrap(), event ); }
rust_cleaned_test_functions.jsonl/115671
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 211 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27207, 4470, 717, 12278, 64132, 368, 341, 286, 1077, 1538, 284, 7036, 1556, 486, 9112, 1925, 341, 310, 18405, 25, 17742, 1718, 345, 310, 5496, 25, 220, 16, 345, 310, 5185, 25, 220, 17, 345, 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_set_tss_address() { let kvm = Kvm::new().unwrap(); let vm = kvm.create_vm().unwrap(); assert!(vm.set_tss_address(0xfffb_d000).is_ok()); }
rust_cleaned_test_functions.jsonl/86833
{ "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, 2602, 528, 778, 6744, 368, 341, 286, 1077, 94748, 284, 730, 7338, 486, 931, 1005, 15454, 543, 286, 1077, 10995, 284, 94748, 2520, 39008, 1005, 15454, 543, 286, 2060, 10297, 7338, 980, 528, 778, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_bigint_value() { let seven = BigInt { base: 10, powers: vec![7], }; assert_eq!(seven.value(), 7); let twenty_seven = BigInt { base: 10, powers: vec![2, 7], }; assert_eq!(twenty_seven.value(), 27); let three_hundred_seven = BigInt { base: 10, powers: vec![3, 0, 7], }; assert_eq!(three_hundred_seven.value(), 307); }
rust_cleaned_test_functions.jsonl/48672
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 277 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36386, 396, 3142, 368, 341, 286, 1077, 8094, 284, 62608, 341, 310, 2331, 25, 220, 16, 15, 345, 310, 13430, 25, 7486, 20703, 22, 1259, 286, 3634, 286, 2060, 10714, 10297, 80185, 2824, 1507, 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_animation_system() { let (mut w, mut d) = t::init_world(); let player = t::add_player(&mut w); let packet = AnimationServerbound::new(Hand::Main); t::receive_packet(&player, &w, packet); let mut event_reader = t::reader::<PlayerAnimationEvent>(&w); d.dispatch(&w); w.maintain(); let channel = w.fetch::<EventChannel<PlayerAnimationEvent>>(); let events = channel.read(&mut event_reader).collect::<Vec<_>>(); assert_eq!(events.len(), 1); let first = events.first().unwrap(); assert_eq!(first.player, player.entity); assert_eq!(first.animation, ClientboundAnimation::SwingMainArm); }
rust_cleaned_test_functions.jsonl/99802
{ "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, 48487, 17687, 368, 341, 286, 1077, 320, 6984, 289, 11, 5206, 294, 8, 284, 259, 486, 2327, 31792, 1428, 286, 1077, 2781, 284, 259, 486, 718, 15524, 2099, 6984, 289, 626, 286, 1077, 10151, 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_cast_dict_to_dict_bad_index_value_utf8() { use DataType::*; // Same test as test_cast_dict_to_dict_bad_index_value but use let keys_builder = PrimitiveBuilder::<Int32Type>::new(10); let values_builder = StringBuilder::new(10); let mut builder = StringDictionaryBuilder::new(keys_builder, values_builder); // add 200 distinct values (which can be stored by a // with int8) for i in 0..200 { let val = format!("val{}", i); builder.append(&val).unwrap(); } let array: ArrayRef = Arc::new(builder.finish()); let cast_type = Dictionary(Box::new(Int8), Box::new(Utf8)); let res = cast(&array, &cast_type); assert!(res.is_err()); let actual_error = format!("{:?}", res); let expected_error = "Could not convert 72 dictionary indexes from Int32 to Int8"; assert!( actual_error.contains(expected_error), "did not find expected error '{}' in actual error '{}'", actual_error, expected_error ); }
rust_cleaned_test_functions.jsonl/29632
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 518 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5303, 5243, 2346, 5243, 34199, 3560, 3142, 39453, 23, 368, 341, 286, 990, 33172, 56162, 286, 442, 25739, 1273, 438, 1273, 5303, 5243, 2346, 5243, 34199, 3560, 3142, 714, 990, 198, 23459, 286, 1077...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_repr_emit() { let repr = Repr{ next_header: Protocol::Tcp, frag_offset: 0, more_frags: true, ident: 12345 }; let mut bytes = [0u8; 8]; let mut header = Header::new_unchecked(&mut bytes); repr.emit(&mut header); assert_eq!(header.into_inner(), &BYTES_HEADER_MORE_FRAG[0..8]); let repr = Repr{ next_header: Protocol::Tcp, frag_offset: 320, more_frags: false, ident: 67890 }; let mut bytes = [0u8; 8]; let mut header = Header::new_unchecked(&mut bytes); repr.emit(&mut header); assert_eq!(header.into_inner(), &BYTES_HEADER_LAST_FRAG[0..8]); }
rust_cleaned_test_functions.jsonl/22426
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 296 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 68535, 69082, 368, 341, 286, 1077, 30636, 284, 1032, 649, 90, 1790, 8757, 25, 24572, 486, 77536, 11, 8343, 6917, 25, 220, 15, 11, 803, 41537, 2032, 25, 830, 11, 3524, 25, 220, 16, 17, 18, 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_encode_i32() { assert_eq!(encode_i32(0), 0b0000_0000_0000_0000_0000_0000_0000_0000); assert_eq!(encode_i32(-1), 0b0000_0000_0000_0000_0000_0000_0000_0001); assert_eq!(encode_i32(2), 0b0000_0000_0000_0000_0000_0000_0000_0100); assert_eq!(encode_i32(16384), 0b0000_0000_0000_0000_1000_0000_0000_0000); assert_eq!( encode_i32(-16385), 0b0000_0000_0000_0000_1000_0000_0000_0001 ); }
rust_cleaned_test_functions.jsonl/47632
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 254 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11224, 5318, 18, 17, 368, 341, 286, 2060, 10714, 10297, 6180, 5318, 18, 17, 7, 15, 701, 220, 15, 65, 15, 15, 15, 15, 62, 15, 15, 15, 15, 62, 15, 15, 15, 15, 62, 15, 15, 15, 15, 62, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_convert_nested_member_expression() { let b = ast::BaseNode::default(); let pkg = ast::Package { base: b.clone(), path: "path".to_string(), package: "main".to_string(), files: vec![ast::File { base: b.clone(), name: "foo.flux".to_string(), metadata: String::new(), package: None, imports: Vec::new(), body: vec![ast::Statement::Expr(Box::new(ast::ExprStmt { base: b.clone(), expression: ast::Expression::Member(Box::new(ast::MemberExpr { base: b.clone(), object: ast::Expression::Member(Box::new(ast::MemberExpr { base: b.clone(), object: ast::Expression::Identifier(ast::Identifier { base: b.clone(), name: "a".to_string(), }), lbrack: None, property: ast::PropertyKey::Identifier(ast::Identifier { base: b.clone(), name: "b".to_string(), }), rbrack: None, })), lbrack: None, property: ast::PropertyKey::Identifier(ast::Identifier { base: b.clone(), name: "c".to_string(), }), rbrack: None, })), }))], eof: None, }], }; let want = Package { loc: b.location.clone(), package: "main".to_string(), files: vec![File { loc: b.location.clone(), package: None, imports: Vec::new(), body: vec![Statement::Expr(ExprStmt { loc: b.location.clone(), expression: Expression::Member(Box::new(MemberExpr { loc: b.location.clone(), typ: type_info(), object: Expression::Member(Box::new(MemberExpr { loc: b.location.clone(), typ: type_info(), object: Expression::Identifier(IdentifierExpr { loc: b.location.clone(), typ: type_info(), name: "a".to_string(), }), property: "b".to_string(), })), property: "c".to_string(), })), })], }], }; let got = test_convert(pkg).unwrap(); assert_eq!(want, got); }
rust_cleaned_test_functions.jsonl/30456
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1937 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34910, 66279, 19388, 28068, 368, 341, 286, 1077, 293, 284, 11763, 486, 3978, 1955, 486, 2258, 543, 286, 1077, 24793, 284, 11763, 486, 13100, 341, 310, 2331, 25, 293, 15997, 3148, 310, 1815, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_update_rooted() { let cs = ClusterSlots::default(); let mut epoch_slot = EpochSlots::default(); epoch_slot.fill(&[0], 0); cs.update_internal(0, vec![epoch_slot], DEFAULT_SLOTS_PER_EPOCH); assert!(cs.lookup(0).is_none()); }
rust_cleaned_test_functions.jsonl/53447
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 149 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 12993, 291, 368, 341, 1789, 286, 1077, 10532, 284, 35380, 51647, 486, 2258, 543, 286, 1077, 5206, 16342, 27563, 284, 87379, 51647, 486, 2258, 543, 286, 16342, 27563, 12467, 2099, 58, 15, 112...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_qvariantmap() { let mut map = QVariantMap::default(); let key1 = QString::from("a"); let val1 = QString::from("abc"); assert!(map.is_empty()); map.insert(key1.clone(), val1.clone().into()); assert_eq!(map.len(), 1); assert_eq!(map[key1.clone()].to_qbytearray().to_string(), val1.to_string()); assert_eq!(map.take(key1.clone()).to_qbytearray().to_string(), val1.to_string()); assert!(map.is_empty()); map[key1.clone()] = val1.clone().into(); let default_value = QVariant::from(10); assert_eq!(map[key1.clone()].to_qbytearray().to_string(), val1.to_string()); assert_eq!(map.value(key1.clone(), default_value.clone()), val1.clone().into()); assert_eq!(map.value(val1.clone(), default_value.clone()), default_value.clone()); assert_eq!(map.key(val1.clone().into(), val1.clone()), key1.clone()); assert_eq!(map.key(key1.clone().into(), val1.clone()), val1.clone()); }
rust_cleaned_test_functions.jsonl/56768
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 467 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8976, 15969, 2186, 368, 341, 286, 1077, 5206, 2415, 284, 40066, 2227, 486, 2258, 1428, 286, 1077, 1376, 16, 284, 7879, 486, 1499, 445, 64, 797, 286, 1077, 1044, 16, 284, 7879, 486, 1499, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_big_p() { if get_effective_gid() != 0 { new_ucmd!() .arg("-RP") .arg("bin") .arg("/proc/self/cwd") .fails() .stderr_is( "chgrp: changing group of '/proc/self/cwd': Operation not permitted (os error 1)\n", ); } }
rust_cleaned_test_functions.jsonl/53693
{ "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, 36386, 620, 368, 341, 262, 421, 633, 27125, 533, 72893, 368, 961, 220, 15, 341, 286, 501, 68887, 2277, 0, 741, 310, 659, 858, 13645, 21657, 1138, 310, 659, 858, 445, 6863, 1138, 310, 659, 858,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_penalty_one_pixel() { let left_image = vec![vec![0u32; 1]; 1]; let right_image = vec![vec![0u32; 1]; 1]; let disparity_map = vec![vec![0usize; 1]; 1]; let diffusion_graph = DiffusionGraph::initialize(left_image, right_image, 1, 1.); assert_eq!(0., diffusion_graph.penalty(disparity_map)); }
rust_cleaned_test_functions.jsonl/70572
{ "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, 82286, 11667, 29760, 368, 341, 286, 1077, 2115, 4954, 284, 7486, 20703, 4083, 20703, 15, 84, 18, 17, 26, 220, 16, 5265, 220, 16, 935, 286, 1077, 1290, 4954, 284, 7486, 20703, 4083, 20703, 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_attr_type_range() -> Result<(), Error> { let tests = vec![ ATTR_PRIORITY, ATTR_ERROR_CODE, ATTR_USE_CANDIDATE, ATTR_EVEN_PORT, ATTR_REQUESTED_ADDRESS_FAMILY, ]; for a in tests { assert!(!(a.optional() || !a.required()), "should be required"); } let tests = vec![ATTR_SOFTWARE, ATTR_ICE_CONTROLLED, ATTR_ORIGIN]; for a in tests { assert!(!(a.required() || !a.optional()), "should be optional"); } Ok(()) }
rust_cleaned_test_functions.jsonl/108724
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 259 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10422, 1819, 9698, 368, 1464, 5714, 68843, 4600, 29, 341, 262, 1077, 7032, 284, 7486, 90515, 286, 37918, 42694, 345, 286, 37918, 5414, 10020, 345, 286, 37918, 22295, 920, 3976, 915, 2336, 345, 286...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_select_command() -> Result<()> { let output_filename = "/tmp/fzf-integration-test"; let config = config::load("tests/frankenline.yml")?; let config = config::model::Config { fzf_command: Some(vec!["tee".to_string(), output_filename.to_string()]), ..config }; let command = select_command(&config).unwrap().unwrap(); // should get the first command since it echoes out the input and we take the first few characters of that assert_eq!(command.name, "edit yaml config file"); let output_file_contents = fs::read_to_string(output_filename).unwrap(); assert_eq!(output_file_contents, format!(r#" 0 {c1s}edit yaml config file{c1e} {c2s}$EDITOR $HOME/.config/frankenline.yml{c2e} 1 {c1s}edit hocon config file{c1e} {c2s}$EDITOR $HOME/.config/frankenline.hocon{c2e} 2 {c1s}edit toml config file{c1e} {c2s}$EDITOR $HOME/.config/frankenline.toml{c2e} 3 {c1s}example - get json from api{c1e} {c2s}curl "https://dog-facts-api.herokuapp.com/api/v1/resources/dogs?number=3"{c2e} "#, c1s = "\u{1b}[38;5;2m", c1e = "\u{1b}[0m", c2s = "\u{1b}[38;5;4m", c2e = "\u{1b}[0m", ) .trim_start() .replace("\n", "\0")); Ok(()) }
rust_cleaned_test_functions.jsonl/89767
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 922 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13051, 10811, 368, 1464, 5714, 71698, 341, 286, 1077, 2550, 13323, 284, 3521, 5173, 6663, 69394, 20052, 17376, 16839, 876, 286, 1077, 2193, 284, 2193, 486, 1078, 445, 23841, 80870, 89289, 1056, 3393...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_various_store_indices() { match env_logger::try_init() { Ok(_) => println!("Initializing env logger"), Err(e) => println!("env logger already initialized: {:?}", e), }; let chain_dir = ".grin_idx_1"; clean_output_dir(chain_dir); let keychain = ExtKeychain::from_random_seed().unwrap(); let key_id = ExtKeychainPath::new(1, 1, 0, 0, 0).to_identifier(); let db_env = Arc::new(store::new_env(chain_dir.to_string())); let chain_store = chain::store::ChainStore::new(db_env).unwrap(); global::set_mining_mode(ChainTypes::AutomatedTesting); let genesis = pow::mine_genesis_block().unwrap(); let reward = libtx::reward::output(&keychain, &key_id, 0, 1).unwrap(); let block = Block::new(&genesis.header, vec![], Difficulty::min(), reward).unwrap(); let block_hash = block.hash(); { let batch = chain_store.batch().unwrap(); batch.save_block(&genesis).unwrap(); batch .setup_height(&genesis.header, &Tip::new(genesis.hash())) .unwrap(); batch.commit().unwrap(); } { let batch = chain_store.batch().unwrap(); batch.save_block(&block).unwrap(); batch .setup_height(&block.header, &Tip::from_block(&block.header)) .unwrap(); batch.commit().unwrap(); } let block_header = chain_store.get_block_header(&block_hash).unwrap(); assert_eq!(block_header.hash(), block_hash); let block_header = chain_store.get_header_by_height(1).unwrap(); assert_eq!(block_header.hash(), block_hash); // Test we can retrive the block from the db and that we can safely delete the // block from the db even though the block_sums are missing. { // Block exists in the db. assert!(chain_store.get_block(&block_hash).is_ok()); assert!(chain_store.get_block_sums(&block_hash).is_err()); { // Start a new batch and delete the block. let batch = chain_store.batch().unwrap(); assert!(batch.delete_block(&block_hash).is_ok()); // Block is deleted within this batch. assert!(batch.get_block(&block_hash).is_err()); } // Check the batch did not commit any changes to the store . assert!(chain_store.get_block(&block_hash).is_ok()); } }
rust_cleaned_test_functions.jsonl/84112
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 783 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4612, 1223, 14809, 18333, 368, 341, 47706, 6105, 27413, 486, 1539, 6137, 368, 341, 197, 197, 11578, 48139, 589, 13751, 17223, 76775, 6105, 5925, 4461, 197, 197, 7747, 2026, 8, 589, 13751, 17223, 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...
2
#[test] fn test_collisions_normalize() { assert!(unranked_route_collisions(&["/hello/", "/hello"])); assert!(unranked_route_collisions(&["//hello/", "/hello"])); assert!(unranked_route_collisions(&["//hello/", "/hello//"])); assert!(unranked_route_collisions(&["/<a>", "/hello//"])); assert!(unranked_route_collisions(&["/<a>", "/hello///"])); assert!(unranked_route_collisions(&["/hello///bob", "/hello/<b>"])); assert!(unranked_route_collisions(&["/<a..>//", "/a//<a..>"])); assert!(unranked_route_collisions(&["/a/<a..>//", "/a/<a..>"])); assert!(unranked_route_collisions(&["/a/<a..>//", "/a/b//c//d/"])); assert!(unranked_route_collisions(&["/a/<a..>/", "/a/bd/e/"])); assert!(unranked_route_collisions(&["/a/<a..>//", "/a/b//c//d/e/"])); assert!(unranked_route_collisions(&["/a//<a..>//", "/a/b//c//d/e/"])); }
rust_cleaned_test_functions.jsonl/26084
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 441 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43597, 6805, 80807, 368, 341, 286, 2060, 10297, 359, 13129, 291, 28109, 43597, 6805, 2099, 1183, 14, 14990, 28105, 3521, 14990, 74446, 286, 2060, 10297, 359, 13129, 291, 28109, 43597, 6805, 2099, 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_revert_messages() { let tma = TestApi::default(); let mut wallet = Wallet::new(MemKeyStore::new()); let a = mock_block(1, 1); let tipset = Tipset::new(vec![a.clone()]).unwrap(); let b = mock_block_with_parents(tipset, 1, 1); let sender = wallet.generate_addr(SignatureType::BLS).unwrap(); let target = Address::new_id(1001); let mut smsg_vec = Vec::new(); for i in 0..4 { let msg = create_smsg(&target, &sender, wallet.borrow_mut(), i); smsg_vec.push(msg); } task::block_on(async move { let mpool = MessagePool::new(tma, "mptest".to_string()).await.unwrap(); let mut api_temp = mpool.api.write().await; api_temp.set_block_messages(&a, vec![smsg_vec[0].clone()]); api_temp.set_block_messages(&b.clone(), smsg_vec[1..4].to_vec()); api_temp.set_state_sequence(&sender, 0); drop(api_temp); mpool.add(&smsg_vec[0]).await.unwrap(); mpool.add(&smsg_vec[1]).await.unwrap(); mpool.add(&smsg_vec[2]).await.unwrap(); mpool.add(&smsg_vec[3]).await.unwrap(); mpool.api.write().await.set_state_sequence(&sender, 0); let api = mpool.api.clone(); let bls_sig_cache = mpool.bls_sig_cache.clone(); let pending = mpool.pending.clone(); let cur_tipset = mpool.cur_tipset.clone(); head_change( api.as_ref(), bls_sig_cache.as_ref(), pending.as_ref(), cur_tipset.as_ref(), Vec::new(), vec![Tipset::new(vec![a]).unwrap()], ) .await .unwrap(); assert_eq!(mpool.get_sequence(&sender).await.unwrap(), 4); mpool.api.write().await.set_state_sequence(&sender, 1); let api = mpool.api.clone(); let bls_sig_cache = mpool.bls_sig_cache.clone(); let pending = mpool.pending.clone(); let cur_tipset = mpool.cur_tipset.clone(); head_change( api.as_ref(), bls_sig_cache.as_ref(), pending.as_ref(), cur_tipset.as_ref(), Vec::new(), vec![Tipset::new(vec![b.clone()]).unwrap()], ) .await .unwrap(); assert_eq!(mpool.get_sequence(&sender).await.unwrap(), 4); mpool.api.write().await.set_state_sequence(&sender, 0); head_change( api.as_ref(), bls_sig_cache.as_ref(), pending.as_ref(), cur_tipset.as_ref(), vec![Tipset::new(vec![b]).unwrap()], Vec::new(), ) .await .unwrap(); assert_eq!(mpool.get_sequence(&sender).await.unwrap(), 4); let (p, _) = mpool.pending().await.unwrap(); assert_eq!(p.len(), 3); }) }
rust_cleaned_test_functions.jsonl/8491
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1728 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1288, 1621, 23428, 368, 341, 286, 1077, 259, 1728, 284, 3393, 6563, 486, 2258, 543, 286, 1077, 5206, 15085, 284, 36483, 486, 931, 3189, 336, 1592, 6093, 486, 931, 5231, 286, 1077, 264, 284, 7860...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_joe() { // Based on discussions at https://github.com/facebookexperimental/starlark-rust/issues/22 let code = r#" def animal(id): return { "kind": "giraffe", "name": "giraffe-%s" % id, "feeding": [ { "name": "feeder", "image": "photos-%s" % id, "commands": [ "lift", "roll-over", ], }, ], } animal("Joe") "#; let m = Module::new(); let globals = Globals::standard(); let mut eval = Evaluator::new(&m); let ast = AstModule::parse("code.bzl", code.to_owned(), &Dialect::Standard).unwrap(); let res: Value = eval.eval_module(ast, &globals).unwrap(); let animal = SmallMap::<String, Value>::unpack_value(res).unwrap(); println!("animal = {:?}", animal); }
rust_cleaned_test_functions.jsonl/92454
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 447 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5374, 4644, 368, 341, 262, 442, 20205, 389, 20333, 518, 3703, 1110, 5204, 905, 75988, 86703, 79264, 75, 838, 3795, 590, 38745, 14, 17, 17, 198, 262, 1077, 2038, 284, 435, 2, 698, 750, 9864, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_err_ldabsb_nomem() { test_interpreter_and_jit_asm!( " ldabsb 0x33 exit", [], (), { |_vm, res: Result| { matches!(res.unwrap_err(), EbpfError::AccessViolation(pc, access_type, vm_addr, len, name) if access_type == AccessType::Load && pc == 29 && vm_addr == 0x400000033 && len == 1 && name == "input" ) } }, 1 ); }
rust_cleaned_test_functions.jsonl/58974
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 301 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9266, 50573, 3435, 65, 53475, 336, 368, 341, 262, 1273, 15318, 28637, 8378, 5374, 275, 67529, 33673, 286, 6228, 286, 26129, 3435, 65, 220, 15, 87, 18, 18, 198, 286, 4869, 756, 286, 10239, 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...
6
#[test] fn test_slice_array_dyn() { let mut arr = Array3::<f64>::zeros((5, 2, 5)); let info = &SliceInfo::<_, IxDyn>::new([ SliceOrIndex::from(1..), SliceOrIndex::from(1), SliceOrIndex::from(..).step_by(2), ]) .unwrap(); arr.slice(info); arr.slice_mut(info); arr.view().slice_move(info); arr.view().slice_collapse(info); }
rust_cleaned_test_functions.jsonl/103424
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 194 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26488, 3858, 69213, 368, 341, 262, 1077, 5206, 2890, 284, 2910, 18, 27638, 69, 21, 19, 6831, 35716, 1188, 20, 11, 220, 17, 11, 220, 20, 1106, 262, 1077, 3546, 284, 609, 33236, 1731, 27638, 687...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_json_extract() { let mut test_cases = vec![ // no path expression ("null", vec![], None), // Index ( "[true, 2017]", vec![PathExpression { legs: vec![PathLeg::Index(0)], flags: PathExpressionFlag::default(), }], Some("true"), ), ( "[true, 2017]", vec![PathExpression { legs: vec![PathLeg::Index(PATH_EXPR_ARRAY_INDEX_ASTERISK)], flags: PATH_EXPRESSION_CONTAINS_ASTERISK, }], Some("[true, 2017]"), ), ( "[true, 2107]", vec![PathExpression { legs: vec![PathLeg::Index(2)], flags: PathExpressionFlag::default(), }], None, ), ( "6.18", vec![PathExpression { legs: vec![PathLeg::Index(0)], flags: PathExpressionFlag::default(), }], Some("6.18"), ), // Key ( r#"{"a": "a1", "b": 20.08, "c": false}"#, vec![PathExpression { legs: vec![PathLeg::Key(String::from("c"))], flags: PathExpressionFlag::default(), }], Some("false"), ), ( r#"{"a": "a1", "b": 20.08, "c": false}"#, vec![PathExpression { legs: vec![PathLeg::Key(String::from(PATH_EXPR_ASTERISK))], flags: PATH_EXPRESSION_CONTAINS_ASTERISK, }], Some(r#"["a1", 20.08, false]"#), ), ( r#"{"a": "a1", "b": 20.08, "c": false}"#, vec![PathExpression { legs: vec![PathLeg::Key(String::from("d"))], flags: PathExpressionFlag::default(), }], None, ), // Double asterisks ( "21", vec![PathExpression { legs: vec![PathLeg::DoubleAsterisk, PathLeg::Key(String::from("c"))], flags: PATH_EXPRESSION_CONTAINS_DOUBLE_ASTERISK, }], None, ), ( r#"{"g": {"a": "a1", "b": 20.08, "c": false}}"#, vec![PathExpression { legs: vec![PathLeg::DoubleAsterisk, PathLeg::Key(String::from("c"))], flags: PATH_EXPRESSION_CONTAINS_DOUBLE_ASTERISK, }], Some("false"), ), ( r#"[{"a": "a1", "b": 20.08, "c": false}, true]"#, vec![PathExpression { legs: vec![PathLeg::DoubleAsterisk, PathLeg::Key(String::from("c"))], flags: PATH_EXPRESSION_CONTAINS_DOUBLE_ASTERISK, }], Some("false"), ), ]; for (i, (js, exprs, expected)) in test_cases.drain(..).enumerate() { let j = js.parse(); assert!(j.is_ok(), "#{} expect parse ok but got {:?}", i, j); let j: Json = j.unwrap(); let expected = match expected { Some(es) => { let e = Json::from_str(es); assert!(e.is_ok(), "#{} expect parse json ok but got {:?}", i, e); Some(e.unwrap()) } None => None, }; let got = j.extract(&exprs[..]); assert_eq!( got, expected, "#{} expect {:?}, but got {:?}", i, expected, got ); } }
rust_cleaned_test_functions.jsonl/56126
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2513 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9455, 39123, 368, 341, 286, 1077, 5206, 1273, 41427, 284, 7486, 90515, 310, 442, 902, 1815, 7493, 198, 310, 3489, 2921, 497, 7486, 0, 12995, 2240, 1326, 310, 442, 8008, 198, 310, 2399, 394, 1054...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_report_check_interval_mono_transition() { block_on(async { let mut mock_time = MockTimeSource::new_from_now(); let mut state_machine = StateMachineBuilder::new_stub() .policy_engine(StubPolicyEngine::new(mock_time.clone())) .metrics_reporter(MockMetricsReporter::new()) .build() .await; // using the wall time. let initial_duration = Duration::from_secs(999); let initial_time = mock_time.now_in_walltime() - initial_duration; state_machine.context.schedule.last_update_check_time = Some(PartialComplexTime::Wall(initial_time)); state_machine.report_check_interval(InstallSource::ScheduledTask).await; let interval = Duration::from_micros(999999); mock_time.advance(interval); state_machine.report_check_interval(InstallSource::ScheduledTask).await; // monotonic time. mock_time.advance(interval); state_machine.report_check_interval(InstallSource::ScheduledTask).await; assert_eq!( state_machine.metrics_reporter.metrics, vec![ Metrics::UpdateCheckInterval { interval: initial_duration, clock: ClockType::Wall, install_source: InstallSource::ScheduledTask, }, Metrics::UpdateCheckInterval { interval, clock: ClockType::Monotonic, install_source: InstallSource::ScheduledTask, }, Metrics::UpdateCheckInterval { interval, clock: ClockType::Monotonic, install_source: InstallSource::ScheduledTask, }, ] ); }); }
rust_cleaned_test_functions.jsonl/59701
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1112 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14813, 7200, 20541, 60080, 53593, 368, 341, 286, 2504, 4470, 18285, 341, 310, 1077, 5206, 7860, 3009, 284, 14563, 1462, 3608, 486, 931, 5673, 20813, 543, 310, 1077, 5206, 1584, 38695, 284, 3234, 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_add() { let x: Complex = Complex::new(3.0, 4.0); let y: Complex = Complex::new(5.0, 6.0); let z: Complex = x.add(&y); assert_that(8.0, is(close_to(z.get_real(), 1.0e-5))); assert_that(10.0, is(close_to(z.get_imaginary(), 1.0e-5))); }
rust_cleaned_test_functions.jsonl/43831
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 164 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 368, 341, 286, 1077, 856, 25, 22096, 284, 22096, 486, 931, 7, 18, 13, 15, 11, 220, 19, 13, 15, 317, 286, 1077, 379, 25, 22096, 284, 22096, 486, 931, 7, 20, 13, 15, 11, 220, 21, 13,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bytes1() { let s = to_chars("bytes1"); let cur = &mut 0; expect_next_token(&s, cur, Token::Bytes1); }
rust_cleaned_test_functions.jsonl/21038
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 80 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12524, 16, 368, 341, 286, 1077, 274, 284, 311, 37418, 445, 9651, 16, 797, 286, 1077, 2847, 284, 609, 6984, 220, 15, 280, 286, 1720, 11257, 6458, 2099, 82, 11, 2847, 11, 9660, 486, 7078, 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
#[test] fn test_deletion() { let x = b"AGCTCGATCTGATCGATCT"; let y = b"AGCTCGATCGATCGATC"; let emission_params = TestEmissionParams { x: x, y: y }; let gap_params = TestGapParams; let mut pair_hmm = PairHMM::new(); let p = pair_hmm.prob_related(&gap_params, &emission_params); assert!(*p <= 0.0); assert_relative_eq!(p.exp(), PROB_ILLUMINA_DEL.powi(2), epsilon = 1e-10); }
rust_cleaned_test_functions.jsonl/110503
{ "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, 2259, 52625, 368, 341, 286, 1077, 856, 284, 293, 1, 1890, 1162, 8798, 828, 1162, 38, 828, 8798, 828, 1162, 876, 286, 1077, 379, 284, 293, 1, 1890, 1162, 8798, 828, 8798, 828, 8798, 828, 34, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rng_seeded() { let mut ra: MyRng = SeedableRng::from_seed((ReseedWithDefault, 2)); let mut rb: MyRng = SeedableRng::from_seed((ReseedWithDefault, 2)); assert!(order::equals(ra.gen_ascii_chars().take(100), rb.gen_ascii_chars().take(100))); }
rust_cleaned_test_functions.jsonl/132550
{ "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, 66849, 3453, 29935, 368, 341, 286, 1077, 5206, 15122, 25, 3017, 49, 968, 284, 35822, 480, 49, 968, 486, 1499, 33809, 1188, 1061, 12051, 2354, 3675, 11, 220, 17, 1106, 286, 1077, 5206, 18717, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_claim_on_remote_revoked_sizeable_push_msat() { // to_remote output is encumbered by a P2WPKH let chanmon_cfgs = create_chanmon_cfgs(2); let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); let nodes = create_network(2, &node_cfgs, &node_chanmgrs); let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 59000000, InitFeatures::known(), InitFeatures::known()); let payment_preimage = route_payment(&nodes[0], &vec!(&nodes[1])[..], 3000000).0; let revoked_local_txn = get_local_commitment_txn!(nodes[0], chan.2); assert_eq!(revoked_local_txn[0].input.len(), 1); assert_eq!(revoked_local_txn[0].input[0].previous_output.txid, chan.3.txid()); claim_payment(&nodes[0], &vec!(&nodes[1])[..], payment_preimage); mine_transaction(&nodes[1], &revoked_local_txn[0]); check_closed_broadcast!(nodes[1], true); check_added_monitors!(nodes[1], 1); check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed); let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap(); mine_transaction(&nodes[1], &node_txn[0]); connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1); let spend_txn = check_spendable_outputs!(nodes[1], node_cfgs[1].keys_manager); assert_eq!(spend_txn.len(), 3); check_spends!(spend_txn[0], revoked_local_txn[0]); // to_remote output on revoked remote commitment_tx check_spends!(spend_txn[1], node_txn[0]); check_spends!(spend_txn[2], revoked_local_txn[0], node_txn[0]); // Both outputs }
rust_cleaned_test_functions.jsonl/16901
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 654 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84969, 4470, 36425, 38082, 10823, 2368, 480, 14218, 21416, 266, 368, 341, 1572, 197, 322, 311, 36425, 2550, 374, 3209, 890, 291, 553, 264, 393, 17, 54, 22242, 39, 271, 10217, 26023, 1645, 18343, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_library_load() { // This test is not yet implemented for Windows let check_path = match std::env::consts::OS { "linux" => Some("test_resources/library/linux/test_op.so"), // TODO: The test op needs to be recompiled for macos. _ => None, }; if let Some(path) = check_path { let lib = Library::load(path).unwrap(); let ops: Vec<OpDef> = lib.op_list().clone().into(); assert!(ops.len() == 1); let op = &ops[0]; assert!(op.name() == "TestOpList"); }; }
rust_cleaned_test_functions.jsonl/69012
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 312 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39461, 12411, 368, 341, 286, 442, 1096, 1273, 374, 537, 3602, 11537, 369, 5515, 198, 286, 1077, 1779, 2638, 284, 2432, 1460, 486, 3160, 486, 95773, 486, 3126, 341, 310, 330, 14210, 1, 589, 4329,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_sanitize_with_invalid_ix_program_id() { assert!(Message { header: MessageHeader { num_required_signatures: 1, ..MessageHeader::default() }, account_keys: vec![Pubkey::new_unique()], address_table_lookups: vec![MessageAddressTableLookup { account_key: Pubkey::new_unique(), writable_indexes: vec![0], readonly_indexes: vec![], }], instructions: vec![CompiledInstruction { program_id_index: 2, accounts: vec![], data: vec![] }], ..Message::default() } .sanitize() .is_err()); }
rust_cleaned_test_functions.jsonl/94118
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 429 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 58652, 6615, 31433, 62686, 25096, 842, 368, 341, 286, 2060, 10297, 2052, 341, 310, 4247, 25, 4856, 4047, 341, 394, 1629, 18743, 11172, 2789, 25, 220, 16, 345, 394, 5241, 2052, 4047, 486, 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_no_commit_working_copy() { let test_env = TestEnvironment::default(); test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]); let repo_path = test_env.env_root().join("repo"); std::fs::write(repo_path.join("file"), "initial").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"]); insta::assert_snapshot!(stdout, @r###" @ 438471f3fbf1004298d8fb01eeb13663a051a643 o 0000000000000000000000000000000000000000 "###); // ID. std::fs::write(repo_path.join("file"), "modified").unwrap(); let stdout_again = test_env.jj_cmd_success( &repo_path, &["log", "-T", "commit_id", "--no-commit-working-copy"], ); assert_eq!(stdout_again, stdout); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"]); insta::assert_snapshot!(stdout, @r###" @ fab22d1acf5bb9c5aa48cb2c3dd2132072a359ca o 0000000000000000000000000000000000000000 "###); }
rust_cleaned_test_functions.jsonl/77487
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 450 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 36346, 81101, 16096, 368, 341, 262, 1077, 1273, 15879, 284, 3393, 12723, 486, 2258, 543, 262, 1273, 15879, 1169, 73, 11684, 18632, 8623, 15879, 9265, 12993, 1507, 609, 1183, 2327, 497, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_create_empty() { let dir = tempfile::tempdir().unwrap(); let rocksfs = RocksFs::new(dir.path()).unwrap(); assert_eq!(rocksfs.number_of_keys().unwrap(), 0); }
rust_cleaned_test_functions.jsonl/3263
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 97 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 15124, 368, 341, 286, 1077, 5419, 284, 54819, 486, 3888, 3741, 1005, 15454, 1428, 286, 1077, 23035, 3848, 284, 68031, 48300, 486, 931, 14161, 3875, 6011, 15454, 543, 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
#[test] fn test_mutual_close_with_data_1() { let mut s = socket_established(); s.send_slice(b"abcdef").unwrap(); s.close(); assert_eq!(s.state, State::FinWait1); recv!(s, [TcpRepr { control: TcpControl::Fin, seq_number: LOCAL_SEQ + 1, ack_number: Some(REMOTE_SEQ + 1), payload: &b"abcdef"[..], ..RECV_TEMPL }]); send!(s, TcpRepr { control: TcpControl::Fin, seq_number: REMOTE_SEQ + 1, ack_number: Some(LOCAL_SEQ + 1 + 6 + 1), ..SEND_TEMPL }); }
rust_cleaned_test_functions.jsonl/1759
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 370 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29523, 928, 12704, 6615, 1769, 62, 16, 368, 341, 286, 1077, 5206, 274, 284, 7575, 18583, 5102, 291, 543, 286, 274, 5219, 26488, 1883, 1, 41202, 1827, 15454, 543, 286, 274, 4653, 543, 286, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_one() { let req = Request::new(Method::Get) .with_path_segs(&["foo"]) .with_query("index=0"); let comments = test_ok(&api(), req); check_type(&comments, "application", "json"); check_content(&comments, DEFAULT_ONE_JSON); }
rust_cleaned_test_functions.jsonl/125375
{ "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, 3062, 11667, 368, 341, 262, 1077, 4232, 284, 6145, 486, 931, 35419, 486, 1949, 340, 286, 659, 4197, 2638, 3453, 5857, 2099, 1183, 7975, 14108, 286, 659, 4197, 5738, 445, 1252, 28, 15, 797, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_stop_after_drop_sync_actor() { let started = Arc::new(AtomicBool::new(false)); let stopping = Arc::new(AtomicBool::new(false)); let stopped = Arc::new(AtomicBool::new(false)); let started1 = Arc::clone(&started); let stopping1 = Arc::clone(&stopping); let stopped1 = Arc::clone(&stopped); let started2 = Arc::clone(&started); let stopping2 = Arc::clone(&stopping); let stopped2 = Arc::clone(&stopped); System::run(move || { let addr = SyncArbiter::start(1, move || MySyncActor { started: Arc::clone(&started1), stopping: Arc::clone(&stopping1), stopped: Arc::clone(&stopped1), restore_after_stop: false, }); actori_rt::spawn(async move { delay_for(Duration::from_secs(2)).await; assert!(started2.load(Ordering::Relaxed), "Not started"); assert!(!stopping2.load(Ordering::Relaxed), "Stopping"); assert!(!stopped2.load(Ordering::Relaxed), "Stopped"); drop(addr); delay_for(Duration::from_secs(2)).await; System::current().stop(); }); }) .unwrap(); assert!(started.load(Ordering::Relaxed), "Not started"); assert!(stopping.load(Ordering::Relaxed), "Not stopping"); assert!(stopped.load(Ordering::Relaxed), "Not stopped"); }
rust_cleaned_test_functions.jsonl/38340
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 602 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19039, 19844, 29584, 23008, 54818, 368, 341, 262, 1077, 3855, 284, 19689, 486, 931, 7, 65857, 11233, 486, 931, 3576, 1106, 262, 1077, 22535, 284, 19689, 486, 931, 7, 65857, 11233, 486, 931, 3576, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_scalar_repr_conversion() { let a = ScalarRepr::from(1); let b = ScalarRepr([1, 0, 0, 0]); assert_eq!(a, b); let a = Scalar::from(1); let b = Scalar::from_repr(ScalarRepr::from(1)).unwrap(); assert_eq!(a, b); assert_eq!(Scalar::from(1).into_repr(), ScalarRepr::from(1)); let a = Scalar::from(12); assert_eq!(a, Scalar::from_repr(a.into_repr()).unwrap()); let a = ScalarRepr::from(12); assert_eq!(Scalar::from_repr(a).unwrap().into_repr(), a); }
rust_cleaned_test_functions.jsonl/56411
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 299 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41652, 68535, 64132, 368, 341, 286, 1077, 264, 284, 35176, 693, 649, 486, 1499, 7, 16, 317, 286, 1077, 293, 284, 35176, 693, 649, 2561, 16, 11, 220, 15, 11, 220, 15, 11, 220, 15, 2558, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_key_manager_persistence() { let (tmp, manager) = new_tmp_key_manager(None, None, None, None); let manager = manager.unwrap().unwrap(); // Create a file and a datakey. manager.new_file("foo").unwrap(); let (files, keys) = { let dicts = manager.dicts.read().unwrap(); (dicts.file_dict.clone(), dicts.key_dict.clone()) }; // Close and re-open. drop(manager); let (_tmp, manager1) = new_tmp_key_manager(Some(tmp), None, None, None); let manager1 = manager1.unwrap().unwrap(); let dicts = manager1.dicts.read().unwrap(); assert_eq!(files, dicts.file_dict); assert_eq!(keys, dicts.key_dict); }
rust_cleaned_test_functions.jsonl/32266
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 345 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3097, 12144, 620, 8026, 368, 341, 286, 1077, 320, 5173, 11, 6645, 8, 284, 501, 16125, 3097, 12144, 26717, 11, 2240, 11, 2240, 11, 2240, 317, 286, 1077, 6645, 284, 6645, 55395, 1005, 15454, 1428,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_resolving_one_dep() { let mut reg = registry(vec!(pkg("foo"), pkg("bar"))); let res = resolve(pkg_id("root"), vec![dep("foo")], &mut reg); assert_that(&res.unwrap(), contains(names(["root", "foo"])).exactly()); }
rust_cleaned_test_functions.jsonl/34730
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4918, 19648, 11667, 49258, 368, 341, 262, 1077, 5206, 1217, 284, 19424, 25592, 10297, 30069, 445, 7975, 3975, 24793, 445, 2257, 17621, 262, 1077, 592, 284, 8830, 68780, 842, 445, 2888, 3975, 7486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_raw_id_from_trigger() -> Result<(), ()> { let mut debug = DebugInfoRegistry::new(); let mut trigger_id = TriggerId::FIRST_REGULAR; let reactor_0 = ReactorId::new(0); let first_trigger = trigger_id; debug.record_reactor(reactor_0, ReactorDebugInfo::test_named("foo")); debug.record_trigger(trigger_id.get_and_incr()?, "t0".into()); debug.record_trigger(trigger_id.get_and_incr()?, "t1".into()); debug.set_id_range(reactor_0, first_trigger..trigger_id); let reactor_1 = ReactorId::new(1); let first_trigger = trigger_id; debug.record_reactor(reactor_1, ReactorDebugInfo::test_named("foo1")); debug.record_trigger(trigger_id.get_and_incr()?, "t0".into()); debug.record_trigger(trigger_id.get_and_incr()?, "t1".into()); debug.set_id_range(reactor_1, first_trigger..trigger_id); let mut trigger_id = TriggerId::FIRST_REGULAR; assert_eq!((reactor_0, 0), debug.raw_id_of_trigger(trigger_id.get_and_incr()?)); assert_eq!((reactor_0, 1), debug.raw_id_of_trigger(trigger_id.get_and_incr()?)); assert_eq!((reactor_1, 0), debug.raw_id_of_trigger(trigger_id.get_and_incr()?)); assert_eq!((reactor_1, 1), debug.raw_id_of_trigger(trigger_id.get_and_incr()?)); assert_eq!((reactor_1, 2), debug.raw_id_of_trigger(TriggerId::STARTUP)); assert_eq!((reactor_1, 3), debug.raw_id_of_trigger(TriggerId::SHUTDOWN)); Ok(()) }
rust_cleaned_test_functions.jsonl/21934
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 683 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16067, 842, 5673, 32925, 368, 1464, 5714, 68843, 1719, 29, 341, 286, 1077, 5206, 7390, 284, 11091, 1731, 15603, 486, 931, 543, 286, 1077, 5206, 8183, 842, 284, 30291, 764, 486, 67792, 8064, 7081, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
#[test] fn test_bytewise_word_boundary_split_should_preserve_empty_lines() { new_ucmd!() .args(&["-s", "-b"]) .pipe_in("\n") .succeeds() .stdout_is("\n"); new_ucmd!() .args(&["-w1", "-s", "-b"]) .pipe_in("0\n1\n\n2\n\n\n") .succeeds() .stdout_is("0\n1\n\n2\n\n\n"); }
rust_cleaned_test_functions.jsonl/23301
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 220 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3710, 83, 24350, 13533, 54004, 17052, 43378, 32116, 5852, 15124, 18323, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 12, 82, 497, 6523, 65, 14108, 286, 659, 13768, 1243, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1