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_multiple_with_nulls() { let array1 = StringArray::from(vec!["hello", "world"]).data(); let array2 = StringArray::from(vec![Some("1"), None]).data(); let arrays = vec![array1.as_ref(), array2.as_ref()]; let mut mutable = MutableArrayData::new(arrays, false, 5); mutable.extend(0, 0, 2); mutable.extend(1, 0, 2); let result = mutable.freeze(); let result = StringArray::from(Arc::new(result)); let expected = StringArray::from(vec![Some("hello"), Some("world"), Some("1"), None]); assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/102342
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 280 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45233, 6615, 15162, 82, 368, 341, 286, 1077, 1334, 16, 284, 923, 1857, 486, 1499, 25592, 0, 1183, 14990, 497, 330, 14615, 45014, 691, 543, 286, 1077, 1334, 17, 284, 923, 1857, 486, 1499, 25592, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_custom_signal_handler_instance_calling_another_instance() -> Result<()> { let engine = Engine::new(&Config::default()); let store = Store::new(&engine); // instance1 which defines 'read' let module1 = Module::new(&engine, WAT1)?; let instance1 = Instance::new(&store, &module1, &make_externs(&store, &module1))?; let (base1, length1) = set_up_memory(&instance1); unsafe { store.set_signal_handler(move |signum, siginfo, _| { println!("instance1"); handle_sigsegv(base1, length1, signum, siginfo) }); } let mut instance1_exports = instance1.exports(); let instance1_read = instance1_exports.next().unwrap(); // instance2 which calls 'instance1.read' let module2 = Module::new(&engine, WAT2)?; let instance2 = Instance::new(&store, &module2, &[instance1_read.into_extern()])?; // SIGSEGV originating from within the memory of instance1 unsafe { store.set_signal_handler(move |signum, siginfo, _| { handle_sigsegv(base1, length1, signum, siginfo) }); } println!("calling instance2.run"); let result = invoke_export(&instance2, "run")?; assert_eq!(123, result[0].unwrap_i32()); Ok(()) }
rust_cleaned_test_functions.jsonl/19981
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 633 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15875, 21137, 10183, 11904, 13429, 287, 12008, 1575, 11904, 368, 1464, 5714, 71698, 341, 286, 1077, 4712, 284, 8200, 486, 931, 2099, 2648, 486, 2258, 1423, 286, 1077, 3553, 284, 9129, 486, 931, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_white_space_omitter() { let source = "hello~ {{~world~}} \n !{{~#if true}}else{{/if~}}".to_string(); let t = Template::compile(source).ok().unwrap(); assert_eq!(t.elements.len(), 4); assert_eq!(t.elements[0], RawString("hello~".to_string())); assert_eq!( t.elements[1], Expression(Box::new(HelperTemplate::with_path(Path::with_named_paths( &["world"] )))) ); assert_eq!(t.elements[2], RawString("!".to_string())); let t2 = Template::compile("{{#if true}}1 {{~ else ~}} 2 {{~/if}}".to_string()) .ok() .unwrap(); assert_eq!(t2.elements.len(), 1); match t2.elements[0] { HelperBlock(ref h) => { assert_eq!( h.template.as_ref().unwrap().elements[0], RawString("1".to_string()) ); assert_eq!( h.inverse.as_ref().unwrap().elements[0], RawString("2".to_string()) ); } _ => unreachable!(), } }
rust_cleaned_test_functions.jsonl/12004
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 550 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44431, 14663, 62, 316, 3248, 368, 341, 262, 1077, 2530, 284, 330, 14990, 93, 257, 5867, 93, 14615, 93, 3417, 1124, 77, 220, 753, 2979, 93, 2, 333, 830, 3417, 1503, 2979, 14, 333, 93, 3417, 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_str() { let s = "this is a test"; let v = s.to_variant(); assert_eq!(v.str(), Some(s)); assert_eq!(42u32.to_variant().str(), None); }
rust_cleaned_test_functions.jsonl/30212
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 104 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2895, 368, 341, 286, 1077, 274, 284, 330, 574, 374, 264, 1273, 876, 286, 1077, 348, 284, 274, 2389, 46112, 543, 286, 2060, 10714, 10297, 85, 9528, 1507, 4329, 1141, 1106, 286, 2060, 10714, 10297...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_subtraction() { let a = Scalar::zero(); let b = Scalar::one(); let c = Scalar::_sub_mod(&a, &b, 12289); assert_eq!(c.rep, 12288); }
rust_cleaned_test_functions.jsonl/1928
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5228, 26425, 368, 341, 286, 1077, 264, 284, 35176, 486, 14154, 543, 286, 1077, 293, 284, 35176, 486, 603, 543, 286, 1077, 272, 284, 35176, 13541, 1966, 7480, 2099, 64, 11, 609, 65, 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_parser_renderer_many_to_many_via_ast() { let ast = parse_to_ast(MANY_TO_MANY_DATAMODEL).expect("failed to parse"); let rendered = render_schema_ast_to_string(&ast); print!("{}", rendered); assert_eq!(rendered, MANY_TO_MANY_DATAMODEL); }
rust_cleaned_test_functions.jsonl/33284
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 123 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18517, 52345, 22101, 2346, 22101, 80710, 48019, 368, 341, 262, 1077, 11763, 284, 4715, 2346, 48019, 3189, 17293, 8650, 97374, 36347, 1402, 2880, 43, 568, 17119, 445, 16091, 311, 4715, 797, 262, 1077...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_graham_hull_ccw() { let initial = vec![ (1.0, 0.0), (2.0, 1.0), (1.75, 1.1), (1.0, 2.0), (0.0, 1.0), (1.0, 0.0), ]; test_convexity(&initial); }
rust_cleaned_test_functions.jsonl/127229
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 195 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15682, 1466, 309, 1523, 617, 28955, 86, 368, 341, 286, 1077, 2856, 284, 7486, 90515, 310, 320, 16, 13, 15, 11, 220, 15, 13, 15, 1326, 310, 320, 17, 13, 15, 11, 220, 16, 13, 15, 1326, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_quantile_vec() { let mut h = Histogram::configure() .max_value(1_000) .precision(4) .build() .unwrap(); for i in 100..200 { h.increment(i).ok().expect("error"); } let pct = vec![0.0, 10.0, 25.0, 50.0, 75.0, 90.0, 95.0, 100.0]; let percentiles = h.quantile_vec(&pct).unwrap(); assert_eq!(percentiles.len(), 8); assert_eq!(percentiles[0], 100); assert_eq!(percentiles[1], 109); assert_eq!(percentiles[2], 124); assert_eq!(percentiles[3], 150); assert_eq!(percentiles[4], 175); assert_eq!(percentiles[5], 190); assert_eq!(percentiles[6], 195); assert_eq!(percentiles[7], 199); }
rust_cleaned_test_functions.jsonl/82157
{ "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, 53346, 457, 13251, 368, 341, 286, 1077, 5206, 305, 284, 82138, 486, 21002, 741, 310, 659, 2810, 3142, 7, 16, 62, 15, 15, 15, 340, 310, 659, 27182, 7, 19, 340, 310, 659, 5834, 741, 310, 659, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_two_event_messages() { let payload = vec![ 0x00, 0x00, 0x00, 0x02, 0x72, 0xe9, 0xe2, 0x84, 0x11, 0x63, 0x88, 0x88, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x16, 0x8e, 0x00, 0x00, 0x45, 0x2b, 0xf3, 0x04, 0x02, 0x00, 0x02, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa, 0xb7, 0x36, 0x01, 0x78, 0x00, 0x00, 0x00, 0x20, 0x03, 0x6b, 0xc9, 0x04, 0xc1, 0xe2, 0x62, 0xd7, 0x08, 0x6b, 0xb0, 0x91, 0xc1, 0x2a, 0x80, 0x1b, 0xc2, 0x26, 0x00, 0x00, 0xb0, 0x40, 0xd8, 0xe6, 0x53, 0xc1, 0x8f, 0xcd, 0xc, 0xc2, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x16, 0x8f, 0xf3, 0x04, 0x01, 0x00, 0x02, 0x00, 0x69, 0x00, 0xa, 0xf6, 0xdf, 0xfc, 0x6b, 0x00, 0x01 ]; let mut photon = photon_decode::Photon::new(); let decoded = photon.decode(&payload); assert!(decoded.len() == 2); let parameters: Parameters = [ (0x01, Value::ByteArray(vec![ 3, 107, 201, 4, 193, 226, 98, 215, 8, 107, 176, 145, 193, 42, 128, 27, 194, 38, 0, 0, 176, 64, 216, 230, 83, 193, 143, 205, 12, 194, 0, 0])), (0x00, Value::Long(702262)) ] .iter().cloned().collect(); assert_eq!(decoded[0], Message::Event(EventData{ code: 2, parameters})); let parameters: Parameters = [ (0x00, Value::Integer(718559)), (0xfc, Value::Short(1)) ] .iter().cloned().collect(); assert_eq!(decoded[1], Message::Event(EventData{ code: 1, parameters})); }
rust_cleaned_test_functions.jsonl/81444
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 860 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23241, 6748, 23428, 741, 515, 10217, 7729, 284, 7486, 90515, 197, 197, 15, 87, 15, 15, 11, 220, 15, 87, 15, 15, 11, 715, 197, 197, 15, 87, 15, 15, 11, 715, 197, 197, 15, 87, 15, 17, 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_wildcard() { quick_test( "SELECT * from person", "Projection: #person.id, #person.first_name, #person.last_name, #person.age, #person.state, #person.salary, #person.birth_date, #person.😀\ \n TableScan: person projection=None", ); }
rust_cleaned_test_functions.jsonl/62893
{ "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, 1670, 695, 4951, 368, 341, 286, 3974, 4452, 1006, 310, 330, 4858, 353, 504, 1697, 756, 310, 330, 46321, 25, 671, 8987, 1764, 11, 671, 8987, 7389, 1269, 11, 671, 8987, 9110, 1269, 11, 671, 8987...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_in_groupby_agg() -> Result<()> { // This tests if the fitler is correctly handled by the binary expression. // but the group tuples could still be untouched leading to out of bounds aggregation. let df = df![ "a" => [1, 1, 2], "b" => [1, 2, 3] ]?; let out = df .clone() .lazy() .groupby(vec![col("a")]) .agg(vec![ (col("b").filter(col("b").eq(lit(100))) * lit(2)).mean() ]) .collect()?; assert_eq!(out.column("b_mean")?.null_count(), 2); let out = df .lazy() .groupby(vec![col("a")]) .agg(vec![(col("b") .filter(col("b").eq(lit(100))) .map(|s| Ok(s), GetOutput::same_type())) .mean()]) .collect()?; assert_eq!(out.column("b_mean")?.null_count(), 2); Ok(()) }
rust_cleaned_test_functions.jsonl/22407
{ "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, 8727, 1243, 6288, 1694, 83534, 368, 1464, 5714, 71698, 341, 262, 442, 1096, 7032, 421, 279, 4946, 1536, 374, 12440, 17608, 553, 279, 7868, 7493, 624, 1066, 262, 442, 714, 279, 1874, 45225, 1410, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_to_from_u64() { assert_eq!(1u64, U256::from(1u64).low_u64()); assert_eq!(11u64, U256::from(11u64).low_u64()); assert_eq!(111u64, U256::from(111u64).low_u64()); }
rust_cleaned_test_functions.jsonl/103848
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 120 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 5673, 7300, 21, 19, 368, 341, 286, 2060, 10714, 10297, 16, 84, 21, 19, 11, 547, 17, 20, 21, 486, 1499, 7, 16, 84, 21, 19, 568, 10303, 7300, 21, 19, 1423, 286, 2060, 10714, 10297, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_push_path() { let mut items = Vec::new(); let mut paths: HashMap<&Path, usize> = HashMap::new(); FileTreeItems::push_dirs( Path::new("a/b/c"), &mut items, &mut paths, &BTreeSet::new(), ) .unwrap(); assert_eq!(*paths.get(&Path::new("a")).unwrap(), 1); FileTreeItems::push_dirs( Path::new("a/b2/c"), &mut items, &mut paths, &BTreeSet::new(), ) .unwrap(); assert_eq!(*paths.get(&Path::new("a")).unwrap(), 2); }
rust_cleaned_test_functions.jsonl/129785
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 234 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 2638, 368, 341, 197, 10217, 5206, 3589, 284, 11312, 486, 931, 543, 197, 10217, 5206, 12716, 25, 10528, 52244, 1820, 11, 22301, 29, 284, 10528, 486, 931, 1428, 197, 24848, 6533, 4353, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_triplet_optional_list_column() { let path = vec!["a", "list", "element", "list", "element", "list", "element"]; let values = vec![ Field::Str("a".to_string()), Field::Str("b".to_string()), Field::Str("c".to_string()), Field::Str("d".to_string()), Field::Str("a".to_string()), Field::Str("b".to_string()), Field::Str("c".to_string()), Field::Str("d".to_string()), Field::Str("e".to_string()), Field::Str("a".to_string()), Field::Str("b".to_string()), Field::Str("c".to_string()), Field::Str("d".to_string()), Field::Str("e".to_string()), Field::Str("f".to_string()), ]; let def_levels = vec![7, 7, 7, 4, 7, 7, 7, 7, 7, 4, 7, 7, 7, 7, 7, 7, 4, 7]; let rep_levels = vec![0, 3, 2, 1, 2, 0, 3, 2, 3, 1, 2, 0, 3, 2, 3, 2, 1, 2]; test_triplet_iter( "nested_lists.snappy.parquet", path, &values, &def_levels, &rep_levels, ); }
rust_cleaned_test_functions.jsonl/43017
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 647 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 63883, 1149, 74644, 2019, 8744, 368, 341, 286, 1077, 1815, 284, 7486, 0, 1183, 64, 497, 330, 1607, 497, 330, 6101, 497, 330, 1607, 497, 330, 6101, 497, 330, 1607, 497, 330, 6101, 6332, 286, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cli_request_airdrop() { let mint_keypair = Keypair::new(); let mint_pubkey = mint_keypair.pubkey(); let faucet_addr = run_local_faucet(mint_keypair, None); let test_validator = TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr)); let mut bob_config = CliConfig::recent_for_tests(); bob_config.json_rpc_url = test_validator.rpc_url(); bob_config.command = CliCommand::Airdrop { pubkey: None, lamports: 50, }; let keypair = Keypair::new(); bob_config.signers = vec![&keypair]; let sig_response = process_command(&bob_config); sig_response.unwrap(); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); let balance = rpc_client .get_balance(&bob_config.signers[0].pubkey()) .unwrap(); assert_eq!(balance, 50); }
rust_cleaned_test_functions.jsonl/22552
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 379 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 47147, 7893, 50827, 6719, 368, 341, 262, 1077, 28337, 3097, 12670, 284, 6569, 1082, 1310, 486, 931, 543, 262, 1077, 28337, 34014, 792, 284, 28337, 3097, 12670, 47773, 792, 543, 262, 1077, 71453, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_basic_state_synchronization() { // - Kill one node and continue submitting transactions to the others. // - Restart the node // - Wait for all the nodes to catch up // - Verify that the restarted node has synced up with the submitted transactions. let (mut swarm, mut client_proxy) = setup_swarm_and_client_proxy(5, 1); client_proxy.create_next_account(false).unwrap(); client_proxy.create_next_account(false).unwrap(); client_proxy.mint_coins(&["mb", "0", "100"], true).unwrap(); client_proxy .transfer_coins(&["tb", "0", "1", "10"], true) .unwrap(); assert_eq!( Decimal::from_f64(90.0), Decimal::from_str(&client_proxy.get_balance(&["b", "0"]).unwrap()).ok() ); assert_eq!( Decimal::from_f64(10.0), Decimal::from_str(&client_proxy.get_balance(&["b", "1"]).unwrap()).ok() ); let node_to_restart = swarm.get_validators_ids().get(0).unwrap().clone(); swarm.kill_node(&node_to_restart); // All these are executed while one node is down assert_eq!( Decimal::from_f64(90.0), Decimal::from_str(&client_proxy.get_balance(&["b", "0"]).unwrap()).ok() ); assert_eq!( Decimal::from_f64(10.0), Decimal::from_str(&client_proxy.get_balance(&["b", "1"]).unwrap()).ok() ); for _ in 0..5 { client_proxy .transfer_coins(&["tb", "0", "1", "1"], true) .unwrap(); } // Reconnect and synchronize the state assert!(swarm.add_node(node_to_restart.clone(), false).is_ok()); // Wait for all the nodes to catch up swarm.wait_for_all_nodes_to_catchup(); // Connect to the newly recovered node and verify its state let tmp_mnemonic_file = tempfile::NamedTempFile::new().unwrap(); let ac_port = swarm.get_validator(&node_to_restart).unwrap().ac_port(); let mut client_proxy2 = ClientProxy::new( "localhost", ac_port.to_string().as_str(), &swarm.get_trusted_peers_config_path(), "", false, /* faucet server */ None, Some( tmp_mnemonic_file .into_temp_path() .canonicalize() .expect("Unable to get canonical path of mnemonic_file_path") .to_str() .unwrap() .to_string(), ), ) .unwrap(); client_proxy2.set_accounts(client_proxy.copy_all_accounts()); assert_eq!( Decimal::from_f64(85.0), Decimal::from_str(&client_proxy2.get_balance(&["b", "0"]).unwrap()).ok() ); assert_eq!( Decimal::from_f64(15.0), Decimal::from_str(&client_proxy2.get_balance(&["b", "1"]).unwrap()).ok() ); }
rust_cleaned_test_functions.jsonl/80406
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1263 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34729, 4387, 643, 67929, 368, 341, 9401, 262, 442, 481, 26835, 825, 2436, 323, 3060, 33094, 14131, 311, 279, 3800, 624, 262, 442, 481, 56801, 279, 2436, 198, 262, 442, 481, 13824, 369, 678, 279,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_single_binary_jit() -> Result<()> { let schema = Arc::new(Schema::new(vec![Field::new("a", Binary, true)])); let values: Vec<Option<&[u8]>> = vec![Some(b"one"), Some(b"two"), None, Some(b""), Some(b"three")]; let a = BinaryArray::from_opt_vec(values); let batch = RecordBatch::try_new(schema.clone(), vec![Arc::new(a)])?; let mut vector = vec![0; 8192]; let assembler = Assembler::default(); let row_offsets = { write_batch_unchecked_jit( &mut vector, 0, &batch, 0, schema.clone(), &assembler, Compact, )? }; let output_batch = { read_as_batch_jit(&vector, schema, &row_offsets, &assembler, Compact)? }; assert_eq!(batch, output_batch); Ok(()) }
rust_cleaned_test_functions.jsonl/17022
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 498 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19487, 31761, 5374, 275, 368, 1464, 5714, 71698, 341, 286, 1077, 10802, 284, 19689, 486, 931, 3759, 3416, 486, 931, 25592, 20703, 1877, 486, 931, 445, 64, 497, 17718, 11, 830, 7252, 1106, 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...
4
#[test] fn test_append_tokens() { let mut a = quote!(a); let b = quote!(b); a.append_all(b); assert_eq!("a b", a.to_string()); }
rust_cleaned_test_functions.jsonl/53415
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 78 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26041, 28838, 368, 341, 262, 1077, 5206, 264, 284, 12641, 10297, 64, 317, 262, 1077, 293, 284, 12641, 10297, 65, 317, 262, 264, 2057, 5705, 1883, 317, 262, 2060, 10714, 17223, 64, 293, 497, 264,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_adjust_lockouts_after_replay_time_warped() { let mut tower = Tower::new_for_tests(10, 0.9); tower.vote_state.votes.push_back(Lockout::new(1)); tower.vote_state.votes.push_back(Lockout::new(0)); let vote = Vote::new(vec![0], Hash::default()); tower.last_vote = vote; let mut slot_history = SlotHistory::default(); slot_history.add(0); let result = tower.adjust_lockouts_after_replay(0, &slot_history); assert_eq!( format!("{}", result.unwrap_err()), "The tower is fatally inconsistent with blockstore: time warped?" ); }
rust_cleaned_test_functions.jsonl/61173
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 294 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44153, 9818, 11672, 19844, 1288, 1363, 3009, 90539, 6874, 368, 341, 286, 1077, 5206, 21271, 284, 21938, 486, 931, 5478, 32509, 7, 16, 15, 11, 220, 15, 13, 24, 317, 286, 21271, 79422, 4387, 3133,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_table_scope() { Lua::new().context(|lua| { let globals = lua.globals(); lua.load( r#" touter = { tin = {1, 2, 3} } "#, ) .exec() .unwrap(); // lua. let tin; { let touter = globals.get::<_, Table>("touter").unwrap(); tin = touter.get::<_, Table>("tin").unwrap(); } assert_eq!(tin.get::<_, i64>(1).unwrap(), 1); assert_eq!(tin.get::<_, i64>(2).unwrap(), 2); assert_eq!(tin.get::<_, i64>(3).unwrap(), 3); }); }
rust_cleaned_test_functions.jsonl/80281
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 403 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5237, 23199, 741, 515, 262, 37662, 486, 931, 1005, 2147, 22428, 27623, 91, 341, 286, 1077, 37785, 284, 20357, 1302, 16616, 543, 286, 20357, 5104, 1006, 310, 435, 2, 698, 394, 259, 2676, 284, 341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_package_set_with_a_lot() { let package_set = PackageSetBuilder::named(Name::from_str("gpg").unwrap()) .description("Gnu Privacy Guard") .env_var("gpg_home", "{{home}}/.gnupg") .package_actions(&[ PackageBuilder::named(Name::from_str("gpg").unwrap()).build(), PackageBuilder::named(Name::from_str("pinentry-gnome3").unwrap()) .for_linux_only() .build(), PackageBuilder::named(Name::from_str("pinentry-mac").unwrap()) .for_macos_only() .build(), ]) .add_link_file("gpg.conf", "{{gpg_home}}/gpg.conf") .add_link_file( "gpg-agent-{{platform_os}}.conf", "{{gpg_home}}/gpg-agent.conf", ) .run_after("gpg --list-keys") .build(); assert_eq!(package_set.name(), &String::from("gpg")); assert_eq!( package_set.description(), &Some("Gnu Privacy Guard".to_string()) ); assert_eq!(package_set.has_actions(), true); assert_eq!(package_set.packages().unwrap().count(), 3); assert_eq!(package_set.link_files().len(), 2); assert_eq!( package_set.run_after(), &Some("gpg --list-keys".to_string()) ); let package_set_str = serde_yaml::to_string(&package_set).unwrap(); println!("{}", package_set_str); let new_package_set = serde_yaml::from_str(&package_set_str).unwrap(); assert_eq!(package_set, new_package_set); }
rust_cleaned_test_functions.jsonl/25404
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 723 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26328, 2602, 6615, 4306, 91849, 368, 341, 262, 1077, 6328, 2602, 284, 16906, 1649, 3297, 486, 30245, 21182, 486, 1499, 2895, 445, 70, 3517, 1827, 15454, 2398, 286, 659, 4684, 445, 38, 8933, 18874,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_str() { assert_eq!( QueryOutputFormat::from_str("pretty").unwrap(), QueryOutputFormat::Pretty ); assert_eq!( QueryOutputFormat::from_str("pRetty").unwrap(), QueryOutputFormat::Pretty ); assert_eq!( QueryOutputFormat::from_str("csv").unwrap(), QueryOutputFormat::Csv ); assert_eq!( QueryOutputFormat::from_str("CSV").unwrap(), QueryOutputFormat::Csv ); assert_eq!( QueryOutputFormat::from_str("json").unwrap(), QueryOutputFormat::Json ); assert_eq!( QueryOutputFormat::from_str("JSON").unwrap(), QueryOutputFormat::Json ); assert_eq!( QueryOutputFormat::from_str("un").unwrap_err().to_string(), "Unknown format type: un. Expected one of 'pretty', 'csv' or 'json'" ); }
rust_cleaned_test_functions.jsonl/76593
{ "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, 5673, 2895, 368, 341, 286, 2060, 10714, 33673, 310, 11361, 5097, 4061, 486, 1499, 2895, 445, 32955, 1827, 15454, 3148, 310, 11361, 5097, 4061, 486, 51940, 198, 286, 1439, 286, 2060, 10714, 33673, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_aes256_cfb128() { let pt = "6bc1bee22e409f96e93d7e117393172a"; let ct = "dc7e84bfda79164b7ecd8486985d3860"; let key = "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"; let iv = "000102030405060708090a0b0c0d0e0f"; cipher_test(super::Cipher::aes_256_cfb128(), pt, ct, key, iv); }
rust_cleaned_test_functions.jsonl/110546
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 208 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 90958, 17, 20, 21, 666, 10798, 16, 17, 23, 368, 341, 286, 1077, 10817, 284, 330, 21, 8904, 16, 32031, 17, 17, 68, 19, 15, 24, 69, 24, 21, 68, 24, 18, 67, 22, 68, 16, 16, 22, 18, 24, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fetch_string_once_with_redirect() { let http_server_guard = crate::test_util::http_server(); let url = Url::parse("http://127.0.0.1:4546/package.json").unwrap(); let target_url = Url::parse("http://localhost:4545/package.json").unwrap(); tokio_util::init(|| { let result = fetch_string_once_sync(&url).unwrap(); assert_eq!(result, FetchOnceResult::Redirect(target_url)); }); drop(http_server_guard); }
rust_cleaned_test_functions.jsonl/112155
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 199 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11803, 3904, 7630, 6615, 30043, 368, 341, 262, 1077, 1758, 12015, 36796, 284, 17717, 486, 1944, 18974, 486, 1254, 12015, 543, 1066, 262, 1077, 2515, 284, 22840, 486, 6400, 445, 1254, 1110, 16, 17,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_vote_process_instruction_decode_bail() { assert_eq!( super::process_instruction( &Pubkey::default(), &[], &mut MockInvokeContext::new(vec![]) ), Err(InstructionError::NotEnoughAccountKeys), ); }
rust_cleaned_test_functions.jsonl/97472
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 180 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54360, 11305, 54923, 15227, 880, 604, 368, 341, 286, 2060, 10714, 33673, 310, 2256, 486, 4630, 54923, 1006, 394, 609, 29162, 792, 486, 2258, 3148, 394, 44590, 1259, 394, 609, 6984, 14563, 17604, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_directory() { new_ucmd!() .args(&["/root/alpha/beta/gamma/delta/epsilon/omega/"]) .succeeds() .stdout_only("omega\n"); }
rust_cleaned_test_functions.jsonl/82219
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 96 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14846, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 14, 2888, 14, 7141, 3470, 1915, 4846, 13099, 3446, 5964, 14, 31767, 14, 32696, 14, 14108, 286, 659, 82, 29264, 82, 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
#[test] fn test_hsv2hsv() { let hsv_vec = vec!["hsv(180,100%,50%)", "hsv(400,100%,50%)"]; let test_result = vec![ vec!["hsv(180,100%,50%)", "HSV(180,100%,50%)", "hsv(180,100%,50%)", "hsv(180,100%,50%)", "HSV(180,100%,50%)", "HSV(180,100%,50%)", "hsv(180,100%,50%)", "HSV(180,100%,50%)", ], vec!["hsv(400,100%,50%)", "HSV(400,100%,50%)", "hsv(400,100%,50%)", "hsv(400,100%,50%)", "HSV(400,100%,50%)", "HSV(400,100%,50%)", "hsv(400,100%,50%)", "HSV(400,100%,50%)", ], ]; let test_color = init_color(hsv_vec); for (i, vec_color) in test_color.iter().enumerate() { for (index, color) in vec_color.iter().enumerate() { assert_eq!(test_result[i][index], color.to_hsv().unwrap()); } } }
rust_cleaned_test_functions.jsonl/35857
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 362 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 3492, 17, 71, 3492, 368, 341, 197, 10217, 82333, 13251, 284, 7486, 0, 1183, 71, 3492, 7, 16, 23, 15, 11, 16, 15, 15, 13384, 20, 15, 11334, 497, 330, 71, 3492, 7, 19, 15, 15, 11, 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...
3
#[test] fn test_generate_mac(){ let shared_secret = "secreto"; let nonce = "nonce"; let user = "user"; let password = "password"; let admin = false; let user_type = None; let result = generate_mac(shared_secret, nonce, user, password, admin, user_type); assert_eq!(result, "3b56e9050e1a170f8805c57537f96a36c02e29f0"); }
rust_cleaned_test_functions.jsonl/50920
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 153 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48851, 22802, 3032, 262, 1077, 6094, 21962, 284, 330, 325, 837, 983, 876, 262, 1077, 39676, 284, 330, 39593, 876, 262, 1077, 1196, 284, 330, 872, 876, 262, 1077, 3552, 284, 330, 3833, 876, 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_erc20_transfer() { // Given token with initial state. let (env, mut token) = setup(); let owner = env.get_account(0); let recipient = env.get_account(1); let amount = U256::one(); let initial_supply = U256::from(INITIAL_SUPPLY); // When transfer more then owned. let result = token.transfer(recipient, initial_supply + amount); // Then it raises an error. assert_eq!(result.unwrap_err(), Error::InsufficientBalance); // When transfer the amount to recipient as owner. token.transfer(recipient, amount).unwrap(); // Then total supply does not change. assert_eq!(token.total_supply(), initial_supply); // Then balance of owner is decremented. assert_eq!(token.balance_of(owner), initial_supply - amount); // Then balance of recipient is incremented. assert_eq!(token.balance_of(recipient), amount); // Then Transfer event is emitted. token.assert_event_at( 1, Transfer { from: Some(owner), to: Some(recipient), value: amount, }, ); }
rust_cleaned_test_functions.jsonl/61314
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 420 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 2962, 17, 15, 35403, 368, 341, 262, 442, 16246, 3950, 448, 2856, 1584, 624, 262, 1077, 320, 3160, 11, 5206, 3950, 8, 284, 6505, 543, 262, 1077, 6372, 284, 6105, 670, 13500, 7, 15, 317, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_matches_invalid_unsupported_option() { let opts = crate::parsers::parse_options(); let argv = ["hl".to_string(), "--bogus".to_string()]; let matches = crate::parsers::parse_matches(&argv, opts); assert!(matches.is_err()); }
rust_cleaned_test_functions.jsonl/132816
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 131 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 38344, 31433, 4907, 18216, 9672, 368, 341, 286, 1077, 12185, 284, 17717, 486, 88564, 486, 6400, 8743, 543, 286, 1077, 10213, 284, 4383, 17958, 3263, 983, 3904, 1507, 14482, 65, 538, 355, 32...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_seq_empty() { let gil = Python::acquire_gil(); let py = gil.python(); let v : Vec<i32> = vec![]; let seq = v.to_py_object(py).into_object().cast_into::<PySequence>(py).unwrap(); assert_eq!(0, seq.len(py).unwrap()); let needle = 7i32.to_py_object(py).into_object(); assert_eq!(false, seq.contains(py, &needle).unwrap()); }
rust_cleaned_test_functions.jsonl/22525
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 199 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14486, 15124, 368, 341, 286, 1077, 342, 321, 284, 13027, 486, 580, 984, 1889, 321, 543, 286, 1077, 4510, 284, 342, 321, 43193, 543, 286, 1077, 348, 549, 11312, 21897, 18, 17, 29, 284, 7486, 0,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cast_utf8_to_date64() { let a = StringArray::from(vec![ "2000-01-01T12:00:00", // date + time valid "2020-12-15T12:34:56", // date + time valid "2020-2-2T12:34:56", // valid date time without leading 0s "2000-00-00T12:00:00", // invalid month and day "2000-01-01 12:00:00", // missing the 'T' "2000-01-01", // just a date is invalid ]); let array = Arc::new(a) as ArrayRef; let b = cast(&array, &DataType::Date64).unwrap(); let c = b.as_any().downcast_ref::<Date64Array>().unwrap(); // test valid inputs assert_eq!(true, c.is_valid(0)); // "2000-01-01T12:00:00" assert_eq!(946728000000, c.value(0)); assert_eq!(true, c.is_valid(1)); // "2020-12-15T12:34:56" assert_eq!(1608035696000, c.value(1)); assert_eq!(true, c.is_valid(2)); // "2020-2-2T12:34:56" assert_eq!(1580646896000, c.value(2)); // test invalid inputs assert_eq!(false, c.is_valid(3)); // "2000-00-00T12:00:00" assert_eq!(false, c.is_valid(4)); assert_eq!(false, c.is_valid(5)); }
rust_cleaned_test_functions.jsonl/45441
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 620 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5303, 39453, 23, 2346, 4164, 21, 19, 368, 341, 286, 1077, 264, 284, 923, 1857, 486, 1499, 25592, 90515, 310, 330, 17, 15, 15, 15, 12, 15, 16, 12, 15, 16, 51, 16, 17, 25, 15, 15, 25, 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_short_roundtrip() { let con : [u8; 8] = [ 0x38, 0xa7, 0xe6, 0x55, 0xbf, 0x62, 0xf5, 0xf7 ]; let header = super::Header::Short { key_phase: false, ptype: super::ShortType::Two, dst_cid: ConnectionId::new(&con), number: 3152957029, }; let mut bytes = Vec::with_capacity(64); header.encode(&mut bytes); println!("encoded : {}", hex::encode(&bytes)); let mut read = Cursor::new(bytes); let decoded = super::Header::decode(&mut read).unwrap(); assert_eq!(decoded, header); }
rust_cleaned_test_functions.jsonl/95399
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 339 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16673, 29896, 32981, 368, 341, 286, 1077, 390, 549, 508, 84, 23, 26, 220, 23, 60, 284, 2278, 310, 220, 15, 87, 18, 23, 11, 220, 15, 9591, 22, 11, 220, 15, 8371, 21, 11, 220, 15, 87, 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_affine_mul_0() { let affine0 = Affine([[1., 2.], [3., 4.]], [5., 6.]); let affine1 = Affine([[1., 6.], [2., 5.]], [3., 4.]); approx_eq!(f64, 5., Affine::mul_0(&affine0, &affine1, 0, 0)); approx_eq!(f64, 16., Affine::mul_0(&affine0, &affine1, 0, 1)); approx_eq!(f64, 11., Affine::mul_0(&affine0, &affine1, 1, 0)); approx_eq!(f64, 38., Affine::mul_0(&affine0, &affine1, 1, 1)); approx_eq!(f64, 19., Affine::mul_0(&affine1, &affine0, 0, 0)); approx_eq!(f64, 26., Affine::mul_0(&affine1, &affine0, 0, 1)); approx_eq!(f64, 17., Affine::mul_0(&affine1, &affine0, 1, 0)); approx_eq!(f64, 24., Affine::mul_0(&affine1, &affine0, 1, 1)); }
rust_cleaned_test_functions.jsonl/102298
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 426 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48914, 482, 24944, 62, 15, 368, 341, 286, 1077, 68809, 15, 284, 9748, 482, 27119, 16, 2572, 220, 17, 13, 1125, 508, 18, 2572, 220, 19, 13, 20492, 508, 20, 2572, 220, 21, 13, 2558, 286, 1077,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_write_csv_custom_options() { let schema = Schema::new(vec![ Field::new("c1", DataType::Utf8, false), Field::new("c2", DataType::Float64, true), Field::new("c3", DataType::UInt32, false), Field::new("c4", DataType::Boolean, true), Field::new("c6", DataType::Time32(TimeUnit::Second), false), ]); let c1 = StringArray::from(vec![ "Lorem ipsum dolor sit amet", "consectetur adipiscing elit", "sed do eiusmod tempor", ]); let c2 = PrimitiveArray::<Float64Type>::from(vec![ Some(123.564532), None, Some(-556132.25), ]); let c3 = PrimitiveArray::<UInt32Type>::from(vec![3, 2, 1]); let c4 = PrimitiveArray::<BooleanType>::from(vec![Some(true), Some(false), None]); let c6 = Time32SecondArray::from(vec![1234, 24680, 85563]); let batch = RecordBatch::try_new( Arc::new(schema), vec![ Arc::new(c1), Arc::new(c2), Arc::new(c3), Arc::new(c4), Arc::new(c6), ], ) .unwrap(); let file = get_temp_file("custom_options.csv", &[]); let builder = WriterBuilder::new() .has_headers(false) .with_delimiter(b'|') .with_time_format("%r".to_string()); let mut writer = builder.build(file); let batches = vec![&batch]; for batch in batches { writer.write(batch).unwrap(); } // check that file was written successfully let mut file = File::open("target/debug/testdata/custom_options.csv").unwrap(); let mut buffer: Vec<u8> = vec![]; file.read_to_end(&mut buffer).unwrap(); assert_eq!( "Lorem ipsum dolor sit amet|123.564532|3|true|12:20:34 AM\nconsectetur adipiscing elit||2|false|06:51:20 AM\nsed do eiusmod tempor|-556132.25|1||11:46:03 PM\n" .to_string(), String::from_utf8(buffer).unwrap() ); }
rust_cleaned_test_functions.jsonl/39023
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1121 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9165, 14020, 15875, 8743, 368, 341, 286, 1077, 10802, 284, 12539, 486, 931, 25592, 90515, 310, 8601, 486, 931, 445, 66, 16, 497, 33172, 486, 38980, 23, 11, 895, 1326, 310, 8601, 486, 931, 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...
2
#[test] fn test_read_input_registers() { let (_s, cfg) = start_dummy_server_with_cfg(); let mut trans = Transport::new_with_cfg("127.0.0.1", cfg).unwrap(); assert_eq!(trans.read_input_registers(0, 5).unwrap().len(), 5); assert!(trans.read_input_registers(0, 5).unwrap().iter().all(|c| *c == 0)); }
rust_cleaned_test_functions.jsonl/46835
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 160 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 5898, 78360, 368, 341, 286, 1077, 5453, 82, 11, 13286, 8, 284, 1191, 60321, 12015, 6615, 18343, 543, 286, 1077, 5206, 1356, 284, 16742, 486, 931, 6615, 18343, 445, 16, 17, 22, 13, 15, 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_add() { assert_eq!( parse("+ 2 weeks").unwrap().1, PeriodOp::Add(Period::Week(2)) ); assert_eq!( parse(" + 2 weeks").unwrap().1, PeriodOp::Add(Period::Week(2)) ); }
rust_cleaned_test_functions.jsonl/120253
{ "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, 2891, 368, 341, 286, 2060, 10714, 33673, 310, 4715, 34973, 220, 17, 5555, 1827, 15454, 1005, 16, 345, 310, 25492, 7125, 486, 2212, 7, 23750, 486, 17053, 7, 17, 1171, 286, 3475, 286, 2060, 10714,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_key_with_slash() { let mut r = Registry::new(); assert!(r .register_template_string("t", "{{#each .}}{{@key}}: {{this}}\n{{/each}}") .is_ok()); let r = r.render("t", &json!({"/foo": "bar"})).expect("should work"); assert_eq!(r, "/foo: bar\n"); }
rust_cleaned_test_functions.jsonl/14270
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 144 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3097, 6615, 11886, 988, 368, 341, 262, 1077, 5206, 435, 284, 32112, 486, 931, 1428, 262, 2060, 10297, 81, 198, 286, 659, 6343, 8693, 3904, 445, 83, 497, 47219, 2, 9547, 659, 77286, 31, 792, 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_write_to_resized_buffer() { let mut repr = Repr::new(""); // reserve additional bytes repr.reserve(100); assert!(repr.is_heap_allocated()); let slice = unsafe { repr.as_mut_slice() }; let long_word = "hello, I am a very long string that should be allocated on the heap"; let new_len = long_word.len(); slice[..new_len].copy_from_slice(long_word.as_bytes()); unsafe { repr.set_len(new_len) } assert_eq!(repr.as_str(), long_word); }
rust_cleaned_test_functions.jsonl/14390
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9165, 2346, 4918, 1506, 7776, 368, 341, 286, 1077, 5206, 30636, 284, 1032, 649, 486, 931, 56141, 286, 442, 20499, 5107, 5820, 198, 286, 30636, 48520, 7, 16, 15, 15, 317, 286, 2060, 10297, 30837,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fq2_invert() { use super::fq::FqRepr; use ff::PrimeField; assert!(bool::from(Fq2::zero().invert().is_none())); let a = Fq2 { c0: Fq::from_repr(FqRepr([ 0x05, 0x1d, 0x3f, 0x92, 0x53, 0xe2, 0x51, 0x6f, 0x1c, 0x20, 0x2d, 0x8e, 0xd9, 0x7a, 0xfb, 0x45, 0x9e, 0xe5, 0x3e, 0x7e, 0x84, 0xd7, 0x53, 0x2e, 0x41, 0xe4, 0x61, 0x15, 0x4a, 0x73, 0x54, 0xa3, 0xa2, 0xe3, 0x3c, 0x33, 0x34, 0x49, 0xa1, 0xd6, 0x85, 0xc9, 0xf9, 0x89, 0xe1, 0x46, 0x1f, 0x03, ])) .unwrap(), c1: Fq::from_repr(FqRepr([ 0x18, 0x0c, 0x3e, 0xe4, 0x66, 0x56, 0xb0, 0x08, 0x7a, 0x5e, 0x1e, 0xcb, 0x67, 0x6d, 0x65, 0xf9, 0x09, 0x53, 0x3e, 0x4a, 0x9a, 0x51, 0x58, 0xbe, 0x4c, 0xc4, 0x80, 0x81, 0xc0, 0x9b, 0x89, 0x03, 0x14, 0x3c, 0x21, 0x5d, 0x81, 0x76, 0xb3, 0x19, 0xa7, 0x34, 0x8a, 0x8b, 0x51, 0x1a, 0xed, 0xcf, ])) .unwrap(), }; let a = a.invert().unwrap(); assert_eq!( a, Fq2 { c0: Fq::from_repr(FqRepr([ 0x13, 0x51, 0xef, 0x01, 0x94, 0x1b, 0x70, 0xc4, 0xa6, 0xc3, 0xd8, 0xf9, 0x58, 0x6f, 0x26, 0x36, 0xdf, 0xba, 0x70, 0x32, 0x93, 0x94, 0x1c, 0x30, 0x64, 0xbe, 0xf6, 0x17, 0xd2, 0x91, 0x5a, 0x8f, 0xe5, 0xec, 0xda, 0x5f, 0xda, 0xfd, 0xdb, 0xb2, 0x07, 0x03, 0x00, 0xf9, 0xbc, 0xb9, 0xe5, 0x94, ])) .unwrap(), c1: Fq::from_repr(FqRepr([ 0x10, 0x3b, 0xdf, 0x24, 0x1a, 0xfb, 0x00, 0x19, 0xdf, 0x4e, 0x54, 0xf0, 0xd3, 0xef, 0x15, 0xa6, 0xcb, 0xf6, 0x51, 0xa0, 0xf3, 0x67, 0xaf, 0xb2, 0x94, 0x71, 0x43, 0xf8, 0x9f, 0xae, 0xde, 0xe9, 0x15, 0xd7, 0xb6, 0xb9, 0x5d, 0xef, 0xbf, 0xf0, 0x8c, 0x39, 0xfd, 0x76, 0xa8, 0x31, 0x2c, 0xb4, ])) .unwrap(), } ); }
rust_cleaned_test_functions.jsonl/45343
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1393 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 80, 17, 1243, 1621, 368, 341, 262, 990, 2256, 486, 63919, 486, 37, 80, 693, 649, 280, 262, 990, 25539, 486, 32306, 1877, 401, 262, 2060, 10297, 2641, 486, 1499, 7832, 80, 17, 486, 14154, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_device_tree() { let mut device_tree = DeviceTree::new(); assert_eq!(device_tree.0.len(), 0); let id = String::from("id1"); device_tree.insert(id.clone(), DeviceNode::new(id.clone(), None)); assert_eq!(device_tree.0.len(), 1); let node = device_tree.0.get(&id); assert!(node.is_some()); let node = node.unwrap(); assert_eq!(node.id, id); let id2 = String::from("id2"); assert!(device_tree.get(&id).is_some()); assert!(device_tree.get(&id2).is_none()); let node = device_tree.get_mut(&id).unwrap(); node.id = id2.clone(); let node = device_tree.0.get(&id).unwrap(); assert_eq!(node.id, id2); let node = device_tree.remove(&id).unwrap(); assert_eq!(node.id, id2); assert_eq!(device_tree.0.len(), 0); let disk_id = String::from("disk0"); let net_id = String::from("net0"); let rng_id = String::from("rng0"); let device_list = vec![ (disk_id.clone(), device_node!(disk_id)), (net_id.clone(), device_node!(net_id)), (rng_id.clone(), device_node!(rng_id)), ]; device_tree.0.extend(device_list); for (id, node) in device_tree.iter() { if id == &disk_id { assert_eq!(node.id, disk_id); } else if id == &net_id { assert_eq!(node.id, net_id); } else if id == &rng_id { assert_eq!(node.id, rng_id); } else { unreachable!() } } let mut device_tree = DeviceTree::new(); let child_1_id = String::from("child1"); let child_2_id = String::from("child2"); let child_3_id = String::from("child3"); let parent_1_id = String::from("parent1"); let parent_2_id = String::from("parent2"); let root_id = String::from("root"); let mut child_1_node = device_node!(child_1_id); let mut child_2_node = device_node!(child_2_id); let mut child_3_node = device_node!(child_3_id); let mut parent_1_node = device_node!(parent_1_id); let mut parent_2_node = device_node!(parent_2_id); let mut root_node = device_node!(root_id); child_1_node.parent = Some(parent_1_id.clone()); child_2_node.parent = Some(parent_2_id.clone()); child_3_node.parent = Some(parent_2_id.clone()); parent_1_node.children = vec![child_1_id.clone()]; parent_1_node.parent = Some(root_id.clone()); parent_2_node.children = vec![child_2_id.clone(), child_3_id.clone()]; parent_2_node.parent = Some(root_id.clone()); root_node.children = vec![parent_1_id.clone(), parent_2_id.clone()]; let device_list = vec![ (child_1_id.clone(), child_1_node), (child_2_id.clone(), child_2_node), (child_3_id.clone(), child_3_node), (parent_1_id.clone(), parent_1_node), (parent_2_id.clone(), parent_2_node), (root_id.clone(), root_node), ]; device_tree.0.extend(device_list); let iter_vec = device_tree .breadth_first_traversal() .collect::<Vec<&DeviceNode>>(); assert_eq!(iter_vec.len(), 6); assert_eq!(iter_vec[0].id, root_id); assert_eq!(iter_vec[1].id, parent_1_id); assert_eq!(iter_vec[2].id, parent_2_id); assert_eq!(iter_vec[3].id, child_1_id); assert_eq!(iter_vec[4].id, child_2_id); assert_eq!(iter_vec[5].id, child_3_id); let iter_vec = device_tree .breadth_first_traversal() .rev() .collect::<Vec<&DeviceNode>>(); assert_eq!(iter_vec.len(), 6); assert_eq!(iter_vec[5].id, root_id); assert_eq!(iter_vec[4].id, parent_1_id); assert_eq!(iter_vec[3].id, parent_2_id); assert_eq!(iter_vec[2].id, child_1_id); assert_eq!(iter_vec[1].id, child_2_id); assert_eq!(iter_vec[0].id, child_3_id); }
rust_cleaned_test_functions.jsonl/25667
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2212 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9204, 11663, 368, 341, 1789, 286, 1077, 5206, 3671, 11663, 284, 13903, 6533, 486, 931, 543, 286, 2060, 10714, 10297, 6111, 11663, 13, 15, 19406, 1507, 220, 15, 626, 1789, 286, 1077, 877, 284, 92...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_pragma_query_row() { let db = checked_memory_handle(); assert_eq!( "memory", db.query_row::<String, _, _>("PRAGMA journal_mode", NO_PARAMS, |r| r.get(0)) .unwrap() ); assert_eq!( "off", db.query_row::<String, _, _>("PRAGMA journal_mode=off", NO_PARAMS, |r| r.get(0)) .unwrap() ); }
rust_cleaned_test_functions.jsonl/25513
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 255 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 4101, 1728, 5738, 8530, 368, 341, 286, 1077, 2927, 284, 10067, 19195, 10630, 1428, 286, 2060, 10714, 33673, 310, 330, 17269, 756, 310, 2927, 4786, 8530, 27638, 703, 11, 8358, 716, 13211, 6480...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_push_bytes() { let mut s = String::from_str("ABC"); unsafe { s.push_bytes([ 'D' as u8 ]); } assert_eq!(s.as_slice(), "ABCD"); }
rust_cleaned_test_functions.jsonl/113362
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 112 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 12524, 368, 341, 286, 1077, 5206, 274, 284, 923, 486, 1499, 2895, 445, 25411, 797, 286, 19860, 341, 310, 274, 2552, 12524, 2561, 364, 35, 6, 438, 575, 23, 13201, 286, 456, 286, 2060, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_credential_def_identifiers() { let cred1 = CredInfo { requested_attr: "height_1".to_string(), referent: LICENCE_CRED_ID.to_string(), schema_id: SCHEMA_ID.to_string(), cred_def_id: CRED_DEF_ID.to_string(), rev_reg_id: Some(REV_REG_ID.to_string()), cred_rev_id: Some(CRED_REV_ID.to_string()), revocation_interval: Some(NonRevokedInterval { from: Some(123), to: Some(456) }), tails_file: Some(get_temp_dir_path(Some(TEST_TAILS_FILE)).to_str().unwrap().to_string()), timestamp: None, }; let cred2 = CredInfo { requested_attr: "zip_2".to_string(), referent: ADDRESS_CRED_ID.to_string(), schema_id: ADDRESS_SCHEMA_ID.to_string(), cred_def_id: ADDRESS_CRED_DEF_ID.to_string(), rev_reg_id: Some(ADDRESS_REV_REG_ID.to_string()), cred_rev_id: Some(ADDRESS_CRED_REV_ID.to_string()), revocation_interval: Some(NonRevokedInterval { from: None, to: Some(987) }), tails_file: None, timestamp: None, }; let selected_credentials: Value = json!({ "attrs":{ "height_1":{ "credential": { "cred_info":{ "referent":LICENCE_CRED_ID, "attrs":{ "sex":"male", "age":"111", "name":"Bob", "height":"4'11" }, "schema_id": SCHEMA_ID, "cred_def_id": CRED_DEF_ID, "rev_reg_id":REV_REG_ID, "cred_rev_id":CRED_REV_ID }, "interval":null }, "tails_file": get_temp_dir_path(Some(TEST_TAILS_FILE)).to_str().unwrap().to_string(), }, "zip_2":{ "credential": { "cred_info":{ "referent":ADDRESS_CRED_ID, "attrs":{ "address1":"101 Tela Lane", "address2":"101 Wilson Lane", "zip":"87121", "state":"UT", "city":"SLC" }, "schema_id":ADDRESS_SCHEMA_ID, "cred_def_id":ADDRESS_CRED_DEF_ID, "rev_reg_id":ADDRESS_REV_REG_ID, "cred_rev_id":ADDRESS_CRED_REV_ID }, "interval":null }, } }, "predicates":{ } }); let proof_req = json!({ "nonce": "123432421212", "name": "proof_req_1", "version": "0.1", "requested_attributes": { "zip_2": { "name": "zip" }, "height_1": { "name": "height", "non_revoked": {"from": 123, "to": 456} } }, "requested_predicates": {}, "non_revoked": {"to": 987} }).to_string(); let creds = credential_def_identifiers(&selected_credentials.to_string(), &serde_json::from_str(&proof_req).unwrap()).unwrap(); assert_eq!(creds, vec![cred1, cred2]); }
rust_cleaned_test_functions.jsonl/106026
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2132 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 30320, 7844, 38399, 11836, 368, 341, 286, 1077, 4187, 16, 284, 356, 1151, 1731, 341, 310, 11223, 10422, 25, 330, 2563, 62, 16, 3263, 983, 3904, 3148, 310, 8300, 306, 25, 83238, 10150, 920, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rm_errors() { let (at, mut ucmd) = testing(UTIL_NAME); let dir = "test_rm_errors_directory"; let file_a = "test_rm_errors_directory/test_rm_errors_file_a"; let file_b = "test_rm_errors_directory/test_rm_errors_file_b"; at.mkdir(dir); at.touch(file_a); at.touch(file_b); let result = ucmd.arg(dir).run(); assert_eq!(result.stderr, "rm: error: could not remove directory 'test_rm_errors_directory' (did you mean \ to pass '-r'?)\n"); assert!(!result.success); }
rust_cleaned_test_functions.jsonl/61417
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 265 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58537, 20196, 368, 341, 262, 1077, 320, 266, 11, 5206, 575, 8710, 8, 284, 7497, 7, 36969, 4708, 317, 262, 1077, 5419, 284, 330, 1944, 58537, 20196, 14846, 876, 262, 1077, 1034, 4306, 284, 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_emit_u32() { let mut masm = MacroAssembler::new(); masm.emit_u32(0x11223344); assert_eq!(&[0x44, 0x33, 0x22, 0x11], masm.buffer()); masm.emit_u32_at(0, 0x55667788); assert_eq!(&[0x88, 0x77, 0x66, 0x55], masm.buffer()); }
rust_cleaned_test_functions.jsonl/67128
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 167 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 69082, 7300, 18, 17, 368, 341, 286, 1077, 5206, 9243, 76, 284, 53317, 77858, 486, 931, 543, 286, 9243, 76, 16812, 7300, 18, 17, 7, 15, 87, 16, 16, 17, 17, 18, 18, 19, 19, 317, 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_header_error_if_0() { new_ucmd!() .args(&["--header=0"]) .run() .stderr_is("numfmt: invalid header value '0'"); }
rust_cleaned_test_functions.jsonl/45997
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 90 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8757, 4096, 11119, 62, 15, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 313, 2708, 28, 15, 14108, 286, 659, 6108, 741, 286, 659, 36422, 6892, 445, 2413, 12501, 25, 8318...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_replace_add_use_no_anchor() { check_assist( replace_qualified_name_with_use, " std::fmt::Debug<|> ", " use std::fmt::Debug; Debug<|> ", ); }
rust_cleaned_test_functions.jsonl/19560
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10633, 2891, 15951, 6536, 56532, 368, 341, 286, 1779, 12083, 380, 1006, 310, 8290, 62, 36335, 1269, 6615, 15951, 345, 310, 6228, 1834, 486, 12501, 486, 7939, 27, 91, 397, 262, 21796, 310, 6228, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_list_json_equal() { // Test equal case let arrow_array = create_list_array( &mut ListBuilder::new(Int32Builder::new(10)), &[Some(&[1, 2, 3]), None, Some(&[4, 5, 6])], ) .unwrap(); let json_array: Value = serde_json::from_str( r#" [ [1, 2, 3], null, [4, 5, 6] ] "#, ) .unwrap(); assert!(arrow_array.eq(&json_array)); assert!(json_array.eq(&arrow_array)); // Test unequal case let arrow_array = create_list_array( &mut ListBuilder::new(Int32Builder::new(10)), &[Some(&[1, 2, 3]), None, Some(&[4, 5, 6])], ) .unwrap(); let json_array: Value = serde_json::from_str( r#" [ [1, 2, 3], [7, 8], [4, 5, 6] ] "#, ) .unwrap(); assert!(arrow_array.ne(&json_array)); assert!(json_array.ne(&arrow_array)); // Test incorrect type case let arrow_array = create_list_array( &mut ListBuilder::new(Int32Builder::new(10)), &[Some(&[1, 2, 3]), None, Some(&[4, 5, 6])], ) .unwrap(); let json_array: Value = serde_json::from_str( r#" { "a": 1 } "#, ) .unwrap(); assert!(arrow_array.ne(&json_array)); assert!(json_array.ne(&arrow_array)); }
rust_cleaned_test_functions.jsonl/895
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 933 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2019, 9455, 11478, 368, 341, 286, 442, 3393, 6144, 1142, 198, 286, 1077, 17921, 3858, 284, 1855, 2019, 3858, 1006, 310, 609, 6984, 1759, 3297, 486, 931, 24123, 18, 17, 3297, 486, 931, 7, 16, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_try_from() { let gil = Python::acquire_gil(); let py = gil.python(); let list: &PyAny = vec![3, 6, 5, 4, 7].to_object(py).into_ref(py); let dict: &PyAny = vec![("reverse", true)].into_py_dict(py).as_ref(); assert!(PyList::try_from(list).is_ok()); assert!(PyDict::try_from(dict).is_ok()); assert!(PyAny::try_from(list).is_ok()); assert!(PyAny::try_from(dict).is_ok()); }
rust_cleaned_test_functions.jsonl/57741
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 231 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53283, 5673, 368, 341, 286, 1077, 342, 321, 284, 13027, 486, 580, 984, 1889, 321, 543, 286, 1077, 4510, 284, 342, 321, 43193, 543, 286, 1077, 1140, 25, 609, 13828, 8610, 284, 7486, 20703, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_explicit_peer_gets_connected() { let (mut gs, _, _) = inject_nodes1() .peer_no(0) .topics(Vec::new()) .to_subscribe(true) .create_network(); //create new peer let peer = PeerId::random(); //add peer as explicit peer gs.add_explicit_peer(&peer); let dial_events: Vec<&NetworkBehaviourAction<Arc<rpc_proto::Rpc>, GossipsubEvent>> = gs .events .iter() .filter(|e| match e { NetworkBehaviourAction::DialPeer { peer_id, condition: DialPeerCondition::Disconnected, } => peer_id == &peer, _ => false, }) .collect(); assert_eq!( dial_events.len(), 1, "There was no dial peer event for the explicit peer" ); }
rust_cleaned_test_functions.jsonl/66892
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 514 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14214, 6026, 45159, 3062, 82, 43276, 368, 341, 286, 1077, 320, 6984, 28081, 11, 8358, 27439, 284, 15551, 14896, 16, 741, 310, 659, 16537, 6536, 7, 15, 340, 310, 659, 55152, 49923, 486, 931, 2398...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_from_fp() { let mut rng = OsRng; let v = rng.next_u64(); let e = Fp::new(v); let e_fp6 = Fp6::new([v, 0, 0, 0, 0, 0]); let array: [Fp; 6] = [ e, Fp::zero(), Fp::zero(), Fp::zero(), Fp::zero(), Fp::zero(), ]; assert_eq!(e_fp6, e.into()); assert_eq!(Fp6::from(array), e_fp6); }
rust_cleaned_test_functions.jsonl/132395
{ "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, 5673, 34160, 368, 341, 286, 1077, 5206, 28422, 284, 15433, 49, 968, 280, 286, 1077, 348, 284, 28422, 4529, 7300, 21, 19, 543, 286, 1077, 384, 284, 434, 79, 486, 931, 3747, 626, 286, 1077, 384,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_process_testing_n_times_panic() { let _args = FakeParentArgs::with(&["git blame once", "git blame twice"]); assert_eq!( calling_process_cmdline(ProcInfo::new(), guess_git_blame_filename_extension), Some("once".into()) ); assert_eq!( calling_process_cmdline(ProcInfo::new(), guess_git_blame_filename_extension), Some("twice".into()) ); }
rust_cleaned_test_functions.jsonl/95002
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 214 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11305, 70962, 1089, 22353, 620, 31270, 368, 341, 286, 1077, 716, 2116, 284, 36965, 8387, 4117, 486, 4197, 2099, 1183, 12882, 18555, 3055, 497, 330, 12882, 18555, 10917, 15049, 286, 2060, 10714, 3367...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_stake_merge_ix() { let destination_stake_pubkey = Pubkey::new_unique(); let source_stake_pubkey = Pubkey::new_unique(); let authorized_pubkey = Pubkey::new_unique(); let instructions = instruction::merge( &destination_stake_pubkey, &source_stake_pubkey, &authorized_pubkey, ); let message = Message::new(&instructions, None); assert_eq!( parse_stake( &message.instructions[0], &AccountKeys::new(&message.account_keys, None) ) .unwrap(), ParsedInstructionEnum { instruction_type: "merge".to_string(), info: json!({ "destination": destination_stake_pubkey.to_string(), "source": source_stake_pubkey.to_string(), "clockSysvar": sysvar::clock::ID.to_string(), "stakeHistorySysvar": sysvar::stake_history::ID.to_string(), "stakeAuthority": authorized_pubkey.to_string(), }), } ); assert!(parse_stake( &message.instructions[0], &AccountKeys::new(&message.account_keys[0..4], None) ) .is_err()); }
rust_cleaned_test_functions.jsonl/117971
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 700 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 1261, 726, 20888, 62686, 368, 341, 286, 1077, 9106, 1261, 726, 34014, 792, 284, 22611, 792, 486, 931, 21218, 543, 286, 1077, 2530, 1261, 726, 34014, 792, 284, 22611, 792, 486, 931, 21218, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_du_invalid_size() { let args = &["block-size", "threshold"]; for s in args { new_ucmd!() .arg(format!("--{}=1fb4t", s)) .arg("/tmp") .fails() .code_is(1) .stderr_only(format!("du: invalid --{} argument '1fb4t'", s)); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .arg(format!("--{}=1Y", s)) .arg("/tmp") .fails() .code_is(1) .stderr_only(format!("du: --{} argument '1Y' too large", s)); } }
rust_cleaned_test_functions.jsonl/23731
{ "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, 814, 84, 31433, 2368, 368, 341, 262, 1077, 2827, 284, 609, 1183, 4574, 7174, 497, 330, 28902, 6332, 262, 369, 274, 304, 2827, 341, 286, 501, 68887, 2277, 0, 741, 310, 659, 858, 20698, 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_benchmark_id_make_long_directory_name_unique() { let long_name = (0..MAX_DIRECTORY_NAME_LEN).map(|_| 'a').collect::<String>(); let existing_id = BenchmarkId::new(long_name, None, None, None); let mut directories = HashSet::new(); directories.insert(existing_id.as_directory_name().to_owned()); let mut new_id = existing_id.clone(); new_id.ensure_directory_name_unique(&directories); assert_ne!(existing_id.as_directory_name(), new_id.as_directory_name()); }
rust_cleaned_test_functions.jsonl/51508
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 225 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 39381, 842, 28230, 17799, 14846, 1269, 21218, 368, 341, 286, 1077, 1293, 1269, 284, 320, 15, 496, 10586, 43814, 4708, 15536, 568, 2186, 22428, 35395, 364, 64, 1823, 17384, 27638, 703, 3913, 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_nist_params() { let alice = begin_dh_nist(); let bob = begin_dh_nist(); assert_eq!( alice.gen_shared(&bob.gen_pub()), bob.gen_shared(&alice.gen_pub()) ) }
rust_cleaned_test_functions.jsonl/85590
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1089, 380, 6745, 368, 341, 286, 1077, 70433, 284, 3161, 814, 71, 1089, 380, 543, 286, 1077, 35192, 284, 3161, 814, 71, 1089, 380, 543, 286, 2060, 10714, 33673, 310, 70433, 22822, 20405, 2099, 47...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_destruct_path_empty() { // Arrange let path = ""; // Act let result = destruct_path(path); // Assert assert!(result.is_empty()); }
rust_cleaned_test_functions.jsonl/94246
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 105 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2259, 1235, 2638, 15124, 368, 341, 286, 442, 40580, 198, 286, 1077, 1815, 284, 21238, 286, 442, 3218, 198, 286, 1077, 1102, 284, 20780, 2638, 5581, 626, 286, 442, 5319, 198, 286, 2060, 10297, 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
#[test] fn test_f32x4_only_last_any() { let x1 = f32x4::new(2.0, 2.0, 2.0, 1.0); let x2 = f32x4::splat(1.0); assert!((x1.eq(x2)).any()); }
rust_cleaned_test_functions.jsonl/43321
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 111 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 18, 17, 87, 19, 18410, 12195, 37248, 368, 341, 286, 1077, 856, 16, 284, 282, 18, 17, 87, 19, 486, 931, 7, 17, 13, 15, 11, 220, 17, 13, 15, 11, 220, 17, 13, 15, 11, 220, 16, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_two_plus_lines_exact_fit() { let config = make_config_from_args(&["--side-by-side", "--width", "33", "--line-fill-method=ansi"]); let output = run_delta(TWO_PLUS_LINES_DIFF, &config); let mut lines = output.lines().skip(crate::config::HEADER_LEN); let (line_1, line_2) = (lines.next().unwrap(), lines.next().unwrap()); let sac = strip_ansi_codes; // alias to help with `cargo fmt`-ing: assert_eq!("│ │ │ 1 │a = 1", sac(line_1)); assert_eq!("│ │ │ 2 │b = 234567", sac(line_2)); }
rust_cleaned_test_functions.jsonl/72597
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 302 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23241, 28043, 18323, 71084, 32416, 368, 341, 286, 1077, 2193, 4035, 310, 1281, 5332, 5673, 8384, 2099, 1183, 313, 2929, 14319, 24067, 497, 14482, 3098, 497, 330, 18, 18, 497, 14482, 1056, 58987, 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_rfc2822() { use crate::front_matter; let contents = r#" [frontMatter] title = "Hello World" tags = ["first tag", "second tag"] created = "2009-12-30" description = "A run around the world" published = true --- this."#; let (fm, _) = front_matter::parse_front_matter(&contents, "yeah.md", &Default::default()).unwrap(); assert!(fm.rfc2822().len() > 0); }
rust_cleaned_test_functions.jsonl/43341
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 186 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 8316, 17, 23, 17, 17, 368, 341, 286, 990, 17717, 486, 6951, 717, 1650, 280, 286, 1077, 8794, 284, 435, 2, 698, 58, 6951, 44, 1650, 921, 2102, 284, 330, 9707, 4337, 698, 14082, 284, 438...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_total_ord() { assert_eq!("1234".cmp("123"), Greater); assert_eq!("123".cmp("1234"), Less); assert_eq!("1234".cmp("1234"), Equal); assert_eq!("12345555".cmp("123456"), Less); assert_eq!("22".cmp("1234"), Greater); }
rust_cleaned_test_functions.jsonl/17627
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 114 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10784, 67324, 368, 341, 262, 2060, 10714, 17223, 16, 17, 18, 19, 3263, 7293, 445, 16, 17, 18, 3975, 32281, 317, 262, 2060, 10714, 17223, 16, 17, 18, 3263, 7293, 445, 16, 17, 18, 19, 3975, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_map_array_builder() { let string_builder = StringBuilder::new(4); let int_builder = Int32Builder::new(4); let mut builder = MapBuilder::new(None, string_builder, int_builder); let string_builder = builder.keys(); string_builder.append_value("joe").unwrap(); string_builder.append_null().unwrap(); string_builder.append_null().unwrap(); string_builder.append_value("mark").unwrap(); let int_builder = builder.values(); int_builder.append_value(1).unwrap(); int_builder.append_value(2).unwrap(); int_builder.append_null().unwrap(); int_builder.append_value(4).unwrap(); builder.append(true).unwrap(); builder.append(false).unwrap(); builder.append(true).unwrap(); let arr = builder.finish(); let map_data = arr.data(); assert_eq!(3, map_data.len()); assert_eq!(1, map_data.null_count()); assert_eq!( &Some(Bitmap::from(Buffer::from(&[5_u8]))), map_data.null_bitmap() ); let expected_string_data = ArrayData::builder(DataType::Utf8) .len(4) .null_bit_buffer(Buffer::from(&[9_u8])) .add_buffer(Buffer::from_slice_ref(&[0, 3, 3, 3, 7])) .add_buffer(Buffer::from_slice_ref(b"joemark")) .build() .unwrap(); let expected_int_data = ArrayData::builder(DataType::Int32) .len(4) .null_bit_buffer(Buffer::from_slice_ref(&[11_u8])) .add_buffer(Buffer::from_slice_ref(&[1, 2, 0, 4])) .build() .unwrap(); assert_eq!(&expected_string_data, arr.keys().data()); assert_eq!(&expected_int_data, arr.values().data()); }
rust_cleaned_test_functions.jsonl/87816
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 859 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5376, 3858, 28532, 368, 341, 286, 1077, 914, 28532, 284, 11410, 486, 931, 7, 19, 317, 286, 1077, 526, 28532, 284, 1333, 18, 17, 3297, 486, 931, 7, 19, 626, 286, 1077, 5206, 7363, 284, 5027, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_subtraction() { let mut tmp = LARGEST; tmp -= &LARGEST; assert_eq!(tmp, Scalar::zero()); assert_eq!(Scalar::one() - Scalar::zero(), Scalar::one()); }
rust_cleaned_test_functions.jsonl/14277
{ "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, 5228, 26425, 368, 341, 286, 1077, 5206, 4174, 284, 444, 7581, 5177, 280, 286, 4174, 5982, 609, 43, 7581, 5177, 401, 286, 2060, 10714, 10297, 5173, 11, 35176, 486, 14154, 5231, 286, 2060, 10714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_is_mate_with_partial_state_repeat_move_kinds_with_kaku_gote() { let kinds:Vec<KomaKind> = vec![ GKaku, GKakuN ]; let positions:Vec<(u32,u32)> = vec![ (0,4),(4,0),(4,8),(8,4) ]; let mvs:Vec<(u32,u32)> = vec![ (2,2),(6,2),(6,6),(2,6) ]; let occ_positions:Vec<(u32,u32)> = vec![ (3,3),(5,3),(5,5),(3,5) ]; let occ_mvs:Vec<(u32,u32)> = vec![ (3,2),(5,2),(5,6),(3,6) ]; let blank_banmen = Banmen([[Blank; 9]; 9]); for k in &kinds { for ((p,m),(op,om)) in positions.iter().zip(&mvs).zip(occ_positions.iter().zip(&occ_mvs)) { let mut banmen = blank_banmen.clone(); banmen.0[8-3][8-4] = SOu; banmen.0[8 - p.1 as usize][8 - p.0 as usize] = *k; banmen.0[8 - op.1 as usize][8 - op.0 as usize] = SKin; let mut state = State::new(banmen); let mut mc = MochigomaCollections::Empty; let mv = Move::To(KomaSrcPosition(9-(8-4),(8-3)+1),KomaDstToPosition(9-(8-4),(8-4)+1,false)); match Rule::apply_move_none_check(&state,Teban::Gote,&mc,mv.to_applied_move()) { (next,nmc,_) => { state = next; mc = nmc; } } let mv = Move::To(KomaSrcPosition(9-(8-op.0),(8-op.1)+1),KomaDstToPosition(9-(8-om.0),(8-om.1)+1,false)); match Rule::apply_move_none_check(&state,Teban::Gote,&mc,mv.to_applied_move()) { (next,_,_) => { state = next; } } let mv = Move::To(KomaSrcPosition(9-(8-p.0),(8-p.1)+1),KomaDstToPosition(9-(8-m.0),(8-m.1)+1,false)); let ps = Rule::apply_move_to_partial_state_none_check(&state,Teban::Gote,&mc,mv.to_applied_move()); assert!(Rule::is_mate_with_partial_state_repeat_move_kinds(Teban::Gote,&ps),"assertion failed, move = {:?}, {:?}",mv,state.get_banmen()); } } }
rust_cleaned_test_functions.jsonl/72982
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 977 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 717, 349, 6615, 52068, 4387, 41975, 17134, 4698, 8673, 6615, 4698, 23557, 1889, 1272, 368, 972, 10217, 12829, 25, 10050, 28239, 7786, 10629, 29, 284, 7486, 20703, 97409, 23557, 11, 97409, 2355...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_upcoming_utc() { let expression = "0 0,30 0,6,12,18 1,15 Jan-March Thurs"; let schedule = schedule(expression.as_bytes()); assert!(schedule.is_done()); let schedule = schedule.unwrap().1; let mut upcoming = schedule.upcoming(Utc); let next1 = upcoming.next(); assert!(next1.is_some()); let next2 = upcoming.next(); assert!(next2.is_some()); let next3 = upcoming.next(); assert!(next3.is_some()); println!("Upcoming 1 for {} {:?}", expression, next1); println!("Upcoming 2 for {} {:?}", expression, next2); println!("Upcoming 3 for {} {:?}", expression, next3); }
rust_cleaned_test_functions.jsonl/125946
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 250 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8237, 4959, 84259, 368, 341, 262, 1077, 7493, 284, 330, 15, 220, 15, 11, 18, 15, 220, 15, 11, 21, 11, 16, 17, 11, 16, 23, 220, 16, 11, 16, 20, 4350, 5251, 1113, 82685, 876, 262, 1077, 97...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_time_with_tz() -> Result<()> { let ctx_with_tz = |tz: &str| { let mut cfg = EvalConfig::default(); let raw = tz.as_bytes(); // brutally turn timezone in format +08:00 into offset in minute let offset = if raw[0] == b'-' { -1 } else { 1 } * ((raw[1] - b'0') as i64 * 10 + (raw[2] - b'0') as i64) * 60 + ((raw[4] - b'0') as i64 * 10 + (raw[5] - b'0') as i64); cfg.set_time_zone_by_offset(offset * 60).unwrap(); let warnings = cfg.new_eval_warnings(); EvalContext { cfg: Arc::new(cfg), warnings, } }; struct Case { tz: &'static str, t: &'static str, r: Option<&'static str>, tp: TimeType, } let cases = vec![ Case { tz: "+00:00", t: "2020-10-10T10:10:10Z", r: Some("2020-10-10 10:10:10.000000"), tp: TimeType::DateTime, }, Case { tz: "+00:00", t: "2020-10-10T10:10:10+", r: None, tp: TimeType::DateTime, }, Case { tz: "+00:00", t: "2020-10-10T10:10:10+14:01", r: None, tp: TimeType::DateTime, }, Case { tz: "+00:00", t: "2020-10-10T10:10:10-00:00", r: None, tp: TimeType::DateTime, }, Case { tz: "-08:00", t: "2020-10-10T10:10:10-08", r: Some("2020-10-10 10:10:10.000000"), tp: TimeType::DateTime, }, Case { tz: "+08:00", t: "2020-10-10T10:10:10+08:00", r: Some("2020-10-10 10:10:10.000000"), tp: TimeType::DateTime, }, Case { tz: "+08:00", t: "2020-10-10T10:10:10+08:00", r: Some("2020-10-10 10:10:10.000000"), tp: TimeType::Timestamp, }, ]; let mut result: Vec<Option<String>> = vec![]; for Case { tz, t, r: _, tp } in &cases { let mut ctx = ctx_with_tz(tz); let parsed = Time::parse(&mut ctx, t, *tp, 6, true); match parsed { Ok(p) => result.push(Some(p.to_string())), Err(_) => result.push(None), } } for (a, b) in result.into_iter().zip(cases) { match (a, b.r) { (Some(a), Some(b)) => assert_eq!(a.as_str(), b), (None, None) => {} _ => { return Err(Error::invalid_time_format(b.t)); } } } Ok(()) }
rust_cleaned_test_functions.jsonl/84835
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1909 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 3009, 6615, 528, 89, 368, 1464, 5714, 71698, 341, 286, 1077, 5635, 6615, 528, 89, 284, 760, 37592, 25, 609, 495, 91, 341, 310, 1077, 5206, 13286, 284, 58239, 2648, 486, 2258, 543, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_update_data_with_decorator() { let mut handlebars = Registry::new(); handlebars.register_template_string("t0", "{{hello}}{{*foo}}{{hello}}".to_string()) .unwrap(); let data = btreemap! { "hello".to_string() => "world".to_string() }; handlebars.register_decorator("foo", Box::new(|_: &Directive, _: &Registry, rc: &mut RenderContext| -> Result<(), RenderError> { // modify json object let mut ctx_ref = rc.context_mut(); if let Some(ref mut m) = ctx_ref.data_mut().as_object_mut().as_mut() { m.insert("hello".to_string(), context::to_json(&"war".to_owned())); } Ok(()) })); assert_eq!(handlebars.render("t0", &data).ok().unwrap(), "worldwar".to_string()); let data2 = 0; handlebars.register_decorator("bar", Box::new(|d: &Directive, _: &Registry, rc: &mut RenderContext| -> Result<(), RenderError> { // modify value let v = d.param(0) .map(|v| Context::wraps(v.value())) .unwrap_or(Context::null()); *rc.context_mut() = v; Ok(()) })); handlebars.register_template_string("t1", "{{this}}{{*bar 1}}{{this}}".to_string()) .unwrap(); assert_eq!(handlebars.render("t1", &data2).ok().unwrap(), "01".to_string()); handlebars.register_template_string("t2", "{{this}}{{*bar \"string_literal\"}}{{this}}" .to_string()) .unwrap(); assert_eq!(handlebars.render("t2", &data2).ok().unwrap(), "0string_literal".to_string()); handlebars.register_template_string("t3", "{{this}}{{*bar}}{{this}}".to_string()).unwrap(); assert_eq!(handlebars.render("t3", &data2).ok().unwrap(), "0".to_string()); }
rust_cleaned_test_functions.jsonl/83318
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1625 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 1769, 6615, 87252, 368, 341, 286, 1077, 5206, 3705, 24950, 284, 32112, 486, 931, 543, 286, 3705, 24950, 9929, 8693, 3904, 445, 83, 15, 497, 47219, 14990, 77286, 9, 7975, 77286, 14990, 3417, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_parse_key_with_info_and_description() { let text = "AAAAA-BBBBB-CCCCC-DDDD [Store] -> Some game"; let parsed_input = parse_message(text); assert_eq!(parsed_input.value, "AAAAA-BBBBB-CCCCC-DDDD"); assert_eq!(parsed_input.description, Some(format!("Some game"))); assert_eq!(parsed_input.object_info, Some(format!("[Store]"))); assert_eq!(parsed_input.object_type, ObjectType::Key); }
rust_cleaned_test_functions.jsonl/97563
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 208 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 3097, 6615, 3109, 8378, 11448, 368, 341, 286, 1077, 1467, 284, 330, 25699, 32, 7671, 73442, 12, 47932, 34, 40175, 4103, 508, 6093, 60, 1464, 4329, 1809, 876, 286, 1077, 15676, 5898, 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_as_ptr_zero_size() { let vec = LocalVec::<u8, 0>::new(); let ptr = vec.as_ptr(); assert!(ptr.is_null()); }
rust_cleaned_test_functions.jsonl/126351
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 86 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11898, 4348, 19359, 2368, 368, 341, 286, 1077, 7486, 284, 8774, 10050, 27638, 84, 23, 11, 220, 15, 6831, 931, 543, 286, 1077, 10087, 284, 7486, 5357, 4348, 543, 286, 2060, 10297, 3505, 2079, 151...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_vector_should_work() { let pair = Pair::from_seed( &hex!("9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60") ); let public = pair.public(); assert_eq!( public, Public::from_full( &hex!("8db55b05db86c0b1786ca49f095d76344c9e6056b2f02701a7e7f3c20aabfd913ebbe148dd17c56551a52952371071a6c604b3f3abe8f2c8fa742158ea6dd7d4")[..], ).unwrap(), ); let message = b""; let signature = hex!("3dde91174bd9359027be59a428b8146513df80a2a3c7eda2194f64de04a69ab97b753169e94db6ffd50921a2668a48b94ca11e3d32c1ff19cfe88890aa7e8f3c00"); let signature = Signature::from_raw(signature); assert!(pair.sign(&message[..]) == signature); assert!(Pair::verify(&signature, &message[..], &public)); }
rust_cleaned_test_functions.jsonl/23551
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 378 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12247, 43378, 11498, 368, 341, 197, 10217, 6716, 284, 25995, 486, 1499, 33809, 1006, 298, 197, 5, 17308, 17223, 24, 67, 21, 16, 65, 16, 24, 450, 72554, 20, 64, 21, 15, 4645, 23, 19, 19, 2577...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_enrich_tensor() { let tp = pb::TensorProto { dtype: pb::DataType::DtString.into(), string_val: vec![Bytes::from_static(b"foo")], ..Default::default() }; let v = EventValue::Summary(SummaryValue(Box::new(Value::Tensor(tp.clone())))); assert_eq!( v.into_tensor(&blank("mytensors", pb::DataClass::Tensor)), Ok(tp) ); }
rust_cleaned_test_functions.jsonl/6203
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 280 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6205, 13851, 23188, 368, 341, 310, 1077, 18101, 284, 17310, 486, 25336, 31549, 341, 394, 13231, 25, 17310, 486, 22653, 486, 69079, 703, 39860, 3148, 394, 914, 6189, 25, 7486, 20703, 7078, 486, 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_height_index() { let mut index = HeightIndex::new(); use std::collections::HashSet; let mut elems = HashSet::new(); let num_heights = 1000; let num_elems = 1000; for e in 0..num_elems { elems.insert(e); } let elems: Vec<_> = elems.iter().collect(); // shuffled vector for (i, e) in elems.iter().enumerate() { index.insert(Height::from((i % num_heights) as u64), e); } for (i, e) in elems.iter().enumerate() { index.remove(Height::from((i % num_heights) as u64), e); } assert!(index.buckets.is_empty()); }
rust_cleaned_test_functions.jsonl/5877
{ "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, 9561, 3560, 368, 341, 286, 1077, 5206, 1922, 284, 21432, 1552, 486, 931, 1428, 286, 990, 1460, 486, 51137, 486, 44601, 280, 286, 1077, 5206, 55968, 284, 18931, 486, 931, 1428, 286, 1077, 1629, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_no_close() { let mut builder = Path::builder(); builder.begin(point(1.0, 1.0)); builder.line_to(point(5.0, 1.0)); builder.line_to(point(1.0, 5.0)); builder.end(false); test_path(builder.build().as_slice()); }
rust_cleaned_test_functions.jsonl/102436
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 117 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 12704, 368, 341, 262, 1077, 5206, 7363, 284, 7933, 486, 17850, 1428, 262, 7363, 6848, 20235, 7, 16, 13, 15, 11, 220, 16, 13, 15, 1106, 262, 7363, 10932, 2346, 20235, 7, 20, 13, 15, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_max_encoded_bytes_size() { let n = bytes::ENC_GROUP_SIZE; let tbl: Vec<(usize, usize)> = vec![(0, n + 1), (n / 2, n + 1), (n, 2 * (n + 1))]; for (x, y) in tbl { assert_eq!(max_encoded_bytes_size(x), y); } }
rust_cleaned_test_functions.jsonl/55212
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 158 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6345, 73069, 12524, 2368, 368, 341, 286, 1077, 308, 284, 5820, 486, 16226, 20130, 4098, 280, 286, 1077, 21173, 25, 11312, 28706, 51878, 11, 22301, 16018, 284, 7486, 0, 9697, 15, 11, 308, 488, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_link_multiple_values() { let first_link = LinkValue::new("/TheBook/chapter2") .push_rel(RelationType::Previous) .set_title_star("UTF-8'de'letztes%20Kapitel"); let second_link = LinkValue::new("/TheBook/chapter4") .push_rel(RelationType::Next) .set_title_star("UTF-8'de'n%c3%a4chstes%20Kapitel"); let link_header = b"</TheBook/chapter2>; \ rel=\"previous\"; title*=UTF-8'de'letztes%20Kapitel, \ </TheBook/chapter4>; \ rel=\"next\"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel"; let expected_link = Link::new(vec![first_link, second_link]); let r: Raw = vec![link_header.to_vec()].into(); let link = Header::parse_header(&r); assert_eq!(link.ok(), Some(expected_link)); }
rust_cleaned_test_functions.jsonl/46348
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 422 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7233, 45233, 9146, 368, 341, 286, 1077, 1156, 7233, 284, 5948, 1130, 486, 931, 4283, 785, 7134, 21284, 2873, 17, 1138, 310, 659, 9077, 13557, 2785, 301, 367, 929, 486, 21291, 340, 310, 659, 746,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_panic() { let a = PrimitiveArray::from([Some(99999i128)]).to(DataType::Decimal(5, 2)); let b = PrimitiveArray::from([Some(1i128)]).to(DataType::Decimal(5, 2)); let _ = add(&a, &b); }
rust_cleaned_test_functions.jsonl/6875
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 115 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 620, 31270, 368, 341, 286, 1077, 264, 284, 51460, 1857, 486, 1499, 2561, 8373, 7, 24, 24, 24, 24, 24, 72, 16, 17, 23, 7252, 568, 983, 63941, 486, 11269, 7, 20, 11, 220, 17, 1106, 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_status_only_done() { let dir = tempdir().unwrap(); let repo = init_repo_with_tasks( dir.path(), &[ Task::new(TaskStatus::Done, "Foo"), Task::new(TaskStatus::Done, "Bar"), ], ); check_current_status(&repo, DisplayMode::ShowAll, "Done:\n+ Foo\n+ Bar\n"); }
rust_cleaned_test_functions.jsonl/36277
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 209 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4773, 18410, 24390, 368, 341, 286, 1077, 5419, 284, 2730, 3741, 1005, 15454, 543, 286, 1077, 15867, 284, 2930, 37784, 6615, 32823, 1006, 310, 5419, 3875, 3148, 310, 609, 9640, 394, 5430, 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_update_new_fork() { let key = Keypair::new(); let mut index = AccountsIndex::<bool>::default(); let ancestors = vec![(0, 0)].into_iter().collect(); let mut gc = Vec::new(); index.insert(0, &key.pubkey(), true, &mut gc); assert!(gc.is_empty()); index.insert(1, &key.pubkey(), false, &mut gc); assert!(gc.is_empty()); assert_eq!(index.get(&key.pubkey(), &ancestors), Some((&true, 0))); let ancestors = vec![(1, 0)].into_iter().collect(); assert_eq!(index.get(&key.pubkey(), &ancestors), Some((&false, 1))); }
rust_cleaned_test_functions.jsonl/44248
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 288 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 5921, 761, 669, 368, 341, 286, 1077, 1376, 284, 6569, 1082, 1310, 486, 931, 543, 286, 1077, 5206, 1922, 284, 40655, 1552, 27638, 2641, 6831, 2258, 543, 286, 1077, 37518, 284, 7486, 0, 9697...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rolling_sum_nulls() { let buf = Buffer::from([1.0, 2.0, 3.0, 4.0]); let arr = &PrimitiveArray::from_data( DataType::Float64, buf, Some(Bitmap::from(&[true, false, true, true])), ); let out = rolling_sum(arr, 2, 2, false, None); let out = out.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap(); let out = out.into_iter().map(|v| v.copied()).collect::<Vec<_>>(); assert_eq!(out, &[None, None, None, Some(7.0)]); let out = rolling_sum(arr, 2, 1, false, None); let out = out.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap(); let out = out.into_iter().map(|v| v.copied()).collect::<Vec<_>>(); assert_eq!(out, &[Some(1.0), Some(1.0), Some(3.0), Some(7.0)]); let out = rolling_sum(arr, 4, 1, false, None); let out = out.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap(); let out = out.into_iter().map(|v| v.copied()).collect::<Vec<_>>(); assert_eq!(out, &[Some(1.0), Some(1.0), Some(4.0), Some(8.0)]); let out = rolling_sum(arr, 4, 1, true, None); let out = out.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap(); let out = out.into_iter().map(|v| v.copied()).collect::<Vec<_>>(); assert_eq!(out, &[Some(1.0), Some(4.0), Some(8.0), Some(7.0)]); let out = rolling_sum(arr, 4, 4, true, None); let out = out.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap(); let out = out.into_iter().map(|v| v.copied()).collect::<Vec<_>>(); assert_eq!(out, &[None, None, None, None]); }
rust_cleaned_test_functions.jsonl/60603
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 809 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 16210, 10160, 15162, 82, 368, 341, 286, 1077, 6607, 284, 10312, 486, 1499, 2561, 16, 13, 15, 11, 220, 17, 13, 15, 11, 220, 18, 13, 15, 11, 220, 19, 13, 15, 2558, 286, 1077, 2890, 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_vec() { let mut vec = Array::<_, 512>::new(); assert_eq!(vec.capacity(), 512); assert!(vec.is_empty()); assert_eq!(format!("{:?}", &vec), "[]"); assert!(vec.push(15).is_none()); assert!(!vec.is_empty()); let elem = vec.pop().expect("To get value"); assert_eq!(15, elem); assert!(vec.pop().is_none()); for idx in 0..vec.capacity() { assert!(vec.push(idx).is_none()); } assert!(vec.push(500).is_some()); for idx in (0..vec.capacity()).rev() { let elem = vec.pop().expect("To get value"); assert_eq!(idx, elem); } assert!(vec.pop().is_none()); vec.clear(); let mut expected_format = String::new(); let _ = write!(&mut expected_format, "["); for idx in 0..vec.capacity() { assert!(vec.push(idx).is_none()); let _ = write!(&mut expected_format, "{}, ", idx); } expected_format.pop(); expected_format.pop(); let _ = write!(&mut expected_format, "]"); assert_eq!(format!("{:?}", &vec), expected_format); vec.resize(vec.capacity() / 2, 1); assert_eq!(vec.len(), vec.capacity() / 2); vec.clear(); assert!(vec.is_empty()); assert!(vec.pop().is_none()); vec.resize(vec.capacity(), 1); assert_eq!(vec.len(), vec.capacity()); for _ in 0..vec.capacity() { let item = vec.pop().expect("To get value"); assert_eq!(item, 1); } assert!(vec.is_empty()); assert!(vec.pop().is_none()); vec.resize_default(vec.capacity() / 2); assert_eq!(vec.len(), vec.capacity() / 2); for _ in 0..vec.capacity() / 2 { let item = vec.pop().expect("To get value"); assert_eq!(item, 0); } assert!(vec.is_empty()); assert!(vec.pop().is_none()); }
rust_cleaned_test_functions.jsonl/105179
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 996 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 368, 341, 286, 1077, 5206, 7486, 284, 2910, 27638, 6878, 220, 20, 16, 17, 6831, 931, 543, 286, 2060, 10714, 10297, 4083, 59168, 1507, 220, 20, 16, 17, 317, 286, 2060, 10297, 4083, 2079, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_hover_macro_invocation() { check( r#" macro_rules! foo { () => {} } fn f() { fo<|>o!(); } "#, expect![[r#" *foo* ```rust test ``` ```rust macro_rules! foo ``` "#]], ) }
rust_cleaned_test_functions.jsonl/66121
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 256 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53445, 58810, 19996, 2276, 368, 341, 286, 1779, 1006, 310, 435, 2, 698, 32606, 21407, 0, 15229, 314, 1719, 589, 4687, 555, 8822, 282, 368, 314, 11756, 27, 91, 29, 78, 0, 2129, 456, 57676, 345,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_convert_errored_missing_protocol_data() -> Result<(), failure::Error> { let data = vec![ Errored { hash: HashType::OperationHash.string_to_bytes("onvN8U6QJ6DGJKVYkHXYRtFm3tgBJScj9P5bbPjSZUuFaGzwFuJ")?, is_endorsement: Some(true), protocol_data_json_with_error_json: OperationProtocolDataJsonWithErrorListJson { protocol_data_json: "".to_string(), error_json: "[ { \"kind\": \"temporary\",\n \"id\": \"proto.005-PsBabyM1.operation.wrong_endorsement_predecessor\",\n \"expected\": \"BMDb9PfcJmiibDDEbd6bEEDj4XNG4C7QACG6TWqz29c9FxNgDLL\",\n \"provided\": \"BLd8dLs4X5Ve6a8B37kUu7iJkRycWzfSF5MrskY4z8YaideQAp4\" } ]".to_string(), }, } ]; let mut operations = HashMap::new(); // operation with branch=BKqTKfGwK3zHnVXX33X5PPHy1FDTnbkajj3eFtCXGFyfimQhT1H operations.insert( HashType::OperationHash.string_to_bytes("onvN8U6QJ6DGJKVYkHXYRtFm3tgBJScj9P5bbPjSZUuFaGzwFuJ")?, Operation::from_bytes(hex::decode("10490b79070cf19175cd7e3b9c1ee66f6e85799980404b119132ea7e58a4a97e000008c387fa065a181d45d47a9b78ddc77e92a881779ff2cbabbf9646eade4bf1405a08e00b725ed849eea46953b10b5cdebc518e6fd47e69b82d2ca18c4cf6d2f312dd08")?)?, ); let protocol = HashType::ProtocolHash.string_to_bytes("PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb")?; let expected_json = json!( [ [ "onvN8U6QJ6DGJKVYkHXYRtFm3tgBJScj9P5bbPjSZUuFaGzwFuJ", { "protocol" : "PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb", "branch" : "BKqTKfGwK3zHnVXX33X5PPHy1FDTnbkajj3eFtCXGFyfimQhT1H", "error" : [ { "kind": "temporary", "id": "proto.005-PsBabyM1.operation.wrong_endorsement_predecessor", "expected": "BMDb9PfcJmiibDDEbd6bEEDj4XNG4C7QACG6TWqz29c9FxNgDLL", "provided": "BLd8dLs4X5Ve6a8B37kUu7iJkRycWzfSF5MrskY4z8YaideQAp4" } ] } ] ] ); // convert let result = convert_errored(&data, &operations, &protocol)?; assert_json_eq!( serde_json::to_value(result)?, serde_json::to_value(expected_json)? ); Ok(()) }
rust_cleaned_test_functions.jsonl/114827
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1518 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34910, 62, 40296, 1151, 40447, 34880, 1769, 368, 1464, 5714, 68843, 7901, 486, 1454, 29, 972, 286, 1077, 821, 284, 7486, 20703, 319, 310, 9740, 47643, 972, 394, 5175, 25, 6531, 929, 486, 8432, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
#[test] fn test_conn_upgrade() { let mut buf = BytesMut::from( "GET /test HTTP/1.1\r\n\ upgrade: websockets\r\n\ connection: upgrade\r\n\r\n", ); let req = parse_ready!(&mut buf); assert!(req.upgrade()); assert_eq!(req.head().connection_type(), ConnectionType::Upgrade); let mut buf = BytesMut::from( "GET /test HTTP/1.1\r\n\ upgrade: Websockets\r\n\ connection: Upgrade\r\n\r\n", ); let req = parse_ready!(&mut buf); assert!(req.upgrade()); assert_eq!(req.head().connection_type(), ConnectionType::Upgrade); }
rust_cleaned_test_functions.jsonl/22273
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 347 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17241, 67794, 368, 341, 286, 1077, 5206, 6607, 284, 30024, 51440, 486, 1499, 1006, 310, 330, 3806, 608, 1944, 10130, 14, 16, 13, 16, 12016, 1699, 5661, 1797, 13910, 25, 3482, 76729, 12016, 1699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_day14_parse_input_sample2() { let ops = parse_input(SAMPLE2); assert_eq!( vec![ Op::Mask(Mask { zeros: 0b111111111111111111111111111111001100, ones: 0b000000000000000000000000000000010010, flucts: vec![5, 0], }), Op::Mem(42, 100), Op::Mask(Mask { zeros: 0b111111111111111111111111111111110100, ones: 0b000000000000000000000000000000000000, flucts: vec![3, 1, 0], }), Op::Mem(26, 1), ], ops ); }
rust_cleaned_test_functions.jsonl/54729
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 430 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16763, 16, 19, 21039, 5898, 17491, 17, 368, 341, 286, 1077, 27132, 284, 4715, 5898, 3759, 18918, 17, 317, 286, 2060, 10714, 33673, 310, 7486, 90515, 394, 10672, 486, 12686, 3189, 1073, 341, 503, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_timespec_layout() { #[cfg(not(target_os = "redox"))] use rustix::fs::{UTIME_NOW, UTIME_OMIT}; use rustix::time::{Nsecs, Secs, Timespec}; let tv_sec: Secs = 0; let tv_nsec: Nsecs = 0; let _ = Timespec { tv_sec, tv_nsec }; #[cfg(not(target_os = "redox"))] let _ = Timespec { tv_sec, tv_nsec: UTIME_NOW, }; #[cfg(not(target_os = "redox"))] let _ = Timespec { tv_sec, tv_nsec: UTIME_OMIT, }; let _ = Timespec { tv_sec, tv_nsec: 0 }; let _ = Timespec { tv_sec, tv_nsec: 999999999, }; }
rust_cleaned_test_functions.jsonl/43649
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 327 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22353, 992, 14466, 368, 341, 262, 11506, 14072, 24772, 8637, 29387, 284, 330, 1151, 5131, 2761, 921, 262, 990, 23071, 941, 486, 3848, 22964, 1381, 5660, 59401, 11, 547, 18129, 83169, 952, 2440, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_error_into_response() { // Generic error. let mut buf = Cursor::new(vec![0]); let response: Response = Error::Generic(StatusCode::BadRequest, "message".to_string()).into(); assert!(response.write_all(&mut buf).is_ok()); let body = ApiServer::json_fault_message("message"); let expected_response = http_response(&body, 400); assert_eq!(buf.into_inner(), expected_response.as_bytes()); // Empty ID error. let mut buf = Cursor::new(vec![0]); let response: Response = Error::EmptyID.into(); assert!(response.write_all(&mut buf).is_ok()); let body = ApiServer::json_fault_message("The ID cannot be empty."); let expected_response = http_response(&body, 400); assert_eq!(buf.into_inner(), expected_response.as_bytes()); // Invalid ID error. let mut buf = Cursor::new(vec![0]); let response: Response = Error::InvalidID.into(); assert!(response.write_all(&mut buf).is_ok()); let body = ApiServer::json_fault_message( "API Resource IDs can only contain alphanumeric characters and underscores.", ); let expected_response = http_response(&body, 400); assert_eq!(buf.into_inner(), expected_response.as_bytes()); // Invalid path or method error. let mut buf = Cursor::new(vec![0]); let response: Response = Error::InvalidPathMethod("path".to_string(), Method::Get).into(); assert!(response.write_all(&mut buf).is_ok()); let body = ApiServer::json_fault_message(format!( "Invalid request method and/or path: {} {}.", std::str::from_utf8(Method::Get.raw()).unwrap(), "path" )); let expected_response = http_response(&body, 400); assert_eq!(buf.into_inner(), expected_response.as_bytes()); // Serde error. let mut buf = Cursor::new(vec![0]); let serde_error = serde_json::Value::from_str("").unwrap_err(); let response: Response = Error::SerdeJson(serde_error).into(); assert!(response.write_all(&mut buf).is_ok()); let body = ApiServer::json_fault_message( "An error occurred when deserializing the json body of a request: \ EOF while parsing a value at line 1 column 0.", ); let expected_response = http_response(&body, 400); assert_eq!(buf.into_inner(), expected_response.as_bytes()); }
rust_cleaned_test_functions.jsonl/106568
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1034 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4096, 45514, 9655, 368, 341, 286, 442, 21281, 1465, 624, 286, 1077, 5206, 6607, 284, 28067, 486, 931, 25592, 20703, 15, 2558, 286, 1077, 2033, 25, 5949, 4035, 310, 4600, 486, 19964, 7, 15872, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cp_arg_backup() { let (at, mut ucmd) = at_and_ucmd!(); ucmd.arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .arg("-b") .succeeds(); assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n"); assert_eq!( at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), "How are you?\n" ); }
rust_cleaned_test_functions.jsonl/21247
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 208 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39811, 6057, 44710, 368, 341, 262, 1077, 320, 266, 11, 5206, 575, 8710, 8, 284, 518, 8378, 68887, 2277, 0, 1428, 262, 575, 8710, 21186, 50320, 69235, 1593, 38913, 25430, 340, 286, 659, 858, 5032...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_super_super_completion() { check( r#" mod a { const A: usize = 0; mod b { const B: usize = 0; mod c { use super::super::$0 } } } "#, expect![[r#" md b ct A "#]], ); }
rust_cleaned_test_functions.jsonl/49019
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 200 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 38886, 38886, 60164, 368, 341, 286, 1779, 1006, 310, 435, 2, 698, 2593, 264, 341, 262, 733, 362, 25, 22301, 284, 220, 15, 280, 262, 1463, 293, 341, 286, 733, 425, 25, 22301, 284, 220, 15, 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_exactly_one_mode() { assert_eq!( split_mode_string("rwb"), Err("must have exactly one of create/read/write/append mode".to_owned()) ); }
rust_cleaned_test_functions.jsonl/105635
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 122 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2702, 32739, 11667, 7302, 368, 341, 310, 2060, 10714, 33673, 394, 6718, 7302, 3904, 445, 81, 20211, 4461, 394, 15495, 445, 24812, 614, 6896, 825, 315, 1855, 69199, 64264, 14, 5090, 3856, 3263, 983...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_duration() { let mut m = TestFmtJsonWellKnownTypes::new(); let mut d = Duration::new(); d.seconds = 1; d.nanos = 340012; m.set_duration(d); test_json_print_parse_message("{\"duration\": \"1.000340012s\"}", &m); let mut m = TestFmtJsonWellKnownTypes::new(); let mut d = Duration::new(); d.seconds = 1; m.set_duration(d); test_json_parse_message("{\"duration\": \"1s\"}", &m); }
rust_cleaned_test_functions.jsonl/49805
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 195 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25454, 368, 341, 262, 1077, 5206, 296, 284, 3393, 93322, 5014, 11395, 48206, 4173, 486, 931, 543, 262, 1077, 5206, 294, 284, 21045, 486, 931, 543, 262, 294, 56343, 284, 220, 16, 280, 262, 294, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_pure_virtual() { let hdr = indoc! {" #include <cstdint> class A { public: virtual uint32_t get_val() const = 0; }; class B : public A { public: virtual uint32_t get_val() const { return 3; } }; const B b; inline const A* get_a() { return &b; }; "}; let rs = quote! { let a = ffi::get_a(); let a_ref = unsafe { a.as_ref() }.unwrap(); assert_eq!(a_ref.get_val(), 3); }; run_test("", hdr, rs, &["A", "get_a"], &[]); }
rust_cleaned_test_functions.jsonl/9882
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 313 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 620, 552, 58730, 368, 341, 262, 1077, 36615, 284, 1257, 509, 0, 314, 698, 286, 671, 997, 366, 96975, 397, 286, 536, 362, 341, 286, 584, 510, 310, 4108, 2622, 18, 17, 528, 633, 6189, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tempsize_for_fct_call() { info( "fun f() { g(1,2,3,4,5,6); } fun g(a:int, b:int, c:int, d:int, e:int, f:int) {}", |_, jit_info| { assert_eq!(24, jit_info.tempsize); }, ); info( "fun f() { g(1,2,3,4,5,6,7,8); } fun g(a:int, b:int, c:int, d:int, e:int, f:int, g:int, h:int) {}", |_, jit_info| { assert_eq!(32, jit_info.tempsize); }, ); info( "fun f() { g(1,2,3,4,5,6,7,8)+(1+2); } fun g(a:int, b:int, c:int, d:int, e:int, f:int, g:int, h:int) -> int { return 0; }", |_, jit_info| { assert_eq!(40, jit_info.tempsize); }, ); }
rust_cleaned_test_functions.jsonl/73139
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 578 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28613, 1690, 551, 5478, 761, 302, 13429, 368, 341, 286, 3546, 1006, 310, 330, 11894, 282, 368, 314, 342, 7, 16, 11, 17, 11, 18, 11, 19, 11, 20, 11, 21, 1215, 456, 1060, 2464, 342, 2877, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fail() { assert_eq!( to_be_false(&Value::Null, &Value::Null, false), Some("expected null to be false".to_string()) ); assert_eq!( to_be_false(&json!(0), &Value::Null, false), Some("expected 0 to be false".to_string()) ); assert_eq!( to_be_false(&json!(false), &Value::Null, true), Some("expected false to not be false".to_string()) ); }
rust_cleaned_test_functions.jsonl/96778
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 250 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22121, 368, 341, 286, 2060, 10714, 33673, 310, 311, 21263, 36015, 2099, 1130, 486, 3280, 11, 609, 1130, 486, 3280, 11, 895, 1326, 310, 4329, 445, 7325, 845, 311, 387, 895, 3263, 983, 3904, 2398,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fq_display() { assert_eq!( format!("{}", Fq::from_repr(FqRepr([0xa956babf9301ea24, 0x39a8f184f3535c7b, 0xb38d35b3f6779585, 0x676cc4eef4c46f2c, 0xb1d4aad87651e694, 0x1947f0d5f4fe325a])).unwrap()), "Fq(0x1947f0d5f4fe325ab1d4aad87651e694676cc4eef4c46f2cb38d35b3f677958539a8f184f3535c7ba956babf9301ea24)".to_string() ); assert_eq!( format!("{}", Fq::from_repr(FqRepr([0xe28e79396ac2bbf8, 0x413f6f7f06ea87eb, 0xa4b62af4a792a689, 0xb7f89f88f59c1dc5, 0x9a551859b1e43a9a, 0x6c9f5a1060de974])).unwrap()), "Fq(0x06c9f5a1060de9749a551859b1e43a9ab7f89f88f59c1dc5a4b62af4a792a689413f6f7f06ea87ebe28e79396ac2bbf8)".to_string() ); }
rust_cleaned_test_functions.jsonl/2335
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 446 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 80, 14825, 368, 341, 286, 2060, 10714, 33673, 286, 3561, 79878, 434, 80, 486, 1499, 68535, 7832, 80, 693, 649, 2561, 15, 9591, 24, 20, 21, 47722, 69, 24, 18, 15, 16, 12508, 17, 19, 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_ty_param_bound() { let tokens = quote!('a); snapshot!(tokens as TypeParamBound, @r###" Lifetime(Lifetime { ident: "a", }) "###); let tokens = quote!('_); snapshot!(tokens as TypeParamBound, @r###" Lifetime(Lifetime { ident: "_", }) "###); let tokens = quote!(Debug); snapshot!(tokens as TypeParamBound, @r###" Trait(TraitBound { modifier: None, path: Path { segments: [ PathSegment { ident: "Debug", arguments: None, }, ], }, }) "###); let tokens = quote!(?Sized); snapshot!(tokens as TypeParamBound, @r###" Trait(TraitBound { modifier: Maybe, path: Path { segments: [ PathSegment { ident: "Sized", arguments: None, }, ], }, }) "###); }
rust_cleaned_test_functions.jsonl/39279
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 559 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53171, 4090, 19447, 368, 341, 262, 1077, 11211, 284, 12641, 0, 492, 64, 317, 262, 16295, 10297, 30566, 438, 3990, 2001, 19568, 11, 569, 81, 14374, 698, 262, 64352, 4957, 28515, 341, 286, 3524, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_bind_doc() -> Result<(), Box<dyn Error + Send + Sync>> { let sql = SqlBuilder::select_from("books") .fields(&["title", "price"]) .and_where("price > ? AND title LIKE ?".binds(&[&100, &"Harry Potter%"])) .sql()?; assert_eq!( "SELECT title, price FROM books WHERE price > 100 AND title LIKE 'Harry Potter%';", &sql ); Ok(()) }
rust_cleaned_test_functions.jsonl/4402
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 216 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27461, 18869, 368, 1464, 5714, 68843, 8261, 92846, 4600, 488, 11000, 488, 28937, 2452, 341, 286, 1077, 5704, 284, 7224, 3297, 486, 1742, 5673, 445, 12110, 1138, 310, 659, 9007, 2099, 1183, 2102, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_gauge() { let opts = Opts::new("test", "test help") .const_label("a", "1") .const_label("b", "2"); let gauge = Gauge::with_opts(opts).unwrap(); gauge.inc(); assert_eq!(gauge.get() as u64, 1); gauge.add(42.0); assert_eq!(gauge.get() as u64, 43); gauge.sub(42.0); assert_eq!(gauge.get() as u64, 1); gauge.dec(); assert_eq!(gauge.get() as u64, 0); gauge.set(42.0); assert_eq!(gauge.get() as u64, 42); let mut mfs = gauge.collect(); assert_eq!(mfs.len(), 1); let mf = mfs.pop().unwrap(); let m = mf.get_metric().get(0).unwrap(); assert_eq!(m.get_label().len(), 2); assert_eq!(m.get_gauge().get_value() as u64, 42); }
rust_cleaned_test_functions.jsonl/7403
{ "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, 1889, 19392, 368, 341, 286, 1077, 12185, 284, 506, 12754, 486, 931, 445, 1944, 497, 330, 1944, 1492, 1138, 310, 659, 1024, 6106, 445, 64, 497, 330, 16, 1138, 310, 659, 1024, 6106, 445, 65, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_check_now_monitor() { let update = Update::from_args(&["update"], &["check-now", "--monitor"]).unwrap(); assert_eq!( update, Update { cmd: Command::CheckNow(CheckNow { service_initiated: false, monitor: true }) } ); }
rust_cleaned_test_functions.jsonl/50079
{ "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, 7200, 20813, 40112, 368, 341, 286, 1077, 2647, 284, 5549, 486, 1499, 8384, 2099, 1183, 2386, 7914, 609, 1183, 2028, 90963, 497, 14482, 32225, 45014, 15454, 543, 286, 2060, 10714, 33673, 310, 2647, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_constrained_length_mutator_ordered_arbitrary() { let range = 0..=10; let m = VecMutator::<u8, U8Mutator>::new(U8Mutator::default(), range.clone()); let mut step = false; let mut lengths = vec![0; 11]; let mut cplxs = vec![0; 81]; for _ in 0..100000 { let (x, cplx) = m.ordered_arbitrary(&mut step, 800.0).unwrap(); lengths[x.len()] += 1; cplxs[(cplx / 10.0) as usize] += 1; assert!(range.contains(&x.len()), "{}", x.len()); } println!("{:?}", lengths); println!("{:?}", cplxs); }
rust_cleaned_test_functions.jsonl/72633
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 344 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3382, 57727, 5118, 29523, 850, 75272, 25842, 87851, 368, 341, 286, 1077, 2088, 284, 220, 15, 496, 28, 16, 15, 280, 286, 1077, 296, 284, 11312, 51440, 850, 27638, 84, 23, 11, 547, 23, 51440, 85...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2