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_split_once() { assert_eq!("".split_once("->"), None); assert_eq!("-".split_once("->"), None); assert_eq!("->".split_once("->"), Some(("", ""))); assert_eq!("a->".split_once("->"), Some(("a", ""))); assert_eq!("->b".split_once("->"), Some(("", "b"))); assert_eq!("a->b".split_once("->"), Some(("a", "b"))); assert_eq!("a->b->c".split_once("->"), Some(("a", "b->c"))); assert_eq!("---".split_once("--"), Some(("", "-"))); }
rust_cleaned_test_functions.jsonl/119433
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 219 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17052, 7630, 368, 341, 262, 2060, 10714, 17223, 3263, 6960, 7630, 445, 405, 3975, 2240, 317, 262, 2060, 10714, 0, 13645, 3263, 6960, 7630, 445, 405, 3975, 2240, 317, 262, 2060, 10714, 17223, 405, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_extend_gcd() { let a = BigInt::from(26); let b = BigInt::from(3); let (g, x, y) = Util::extend_gcd(a.clone(), b.clone()); assert_eq!(g, BigInt::one()); assert_eq!(x, BigInt::from(-1)); assert_eq!(y, BigInt::from(9)); assert_eq!((a.clone() * x) + (b.clone() * y), g); }
rust_cleaned_test_functions.jsonl/130996
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 191 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70265, 1889, 4385, 368, 341, 286, 1077, 264, 284, 62608, 486, 1499, 7, 17, 21, 317, 286, 1077, 293, 284, 62608, 486, 1499, 7, 18, 317, 286, 1077, 320, 70, 11, 856, 11, 379, 8, 284, 10167, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_by_lint_group() { let lints = vec![ Lint::new("should_assert_eq", "group1", "abc", None, "module_name"), Lint::new("should_assert_eq2", "group2", "abc", None, "module_name"), Lint::new("incorrect_match", "group1", "abc", None, "module_name"), ]; let mut expected: HashMap<String, Vec<Lint>> = HashMap::new(); expected.insert( "group1".to_string(), vec![ Lint::new("should_assert_eq", "group1", "abc", None, "module_name"), Lint::new("incorrect_match", "group1", "abc", None, "module_name"), ], ); expected.insert( "group2".to_string(), vec![Lint::new("should_assert_eq2", "group2", "abc", None, "module_name")], ); assert_eq!(expected, Lint::by_lint_group(&lints)); }
rust_cleaned_test_functions.jsonl/1259
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 376 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3710, 907, 396, 6288, 368, 341, 262, 1077, 326, 21042, 284, 7486, 90515, 286, 444, 396, 486, 931, 445, 5445, 16553, 10714, 497, 330, 4074, 16, 497, 330, 13683, 497, 2240, 11, 330, 4352, 1269, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_concat_rs() { test_in_db("strings", |conn| { let result = conn .query("SELECT concat_rs('a','b')", &[]) .expect("query failed"); assert_eq!(result.len(), 1); let row = result.get(0); let col: String = row.get(0); assert_eq!(&col, "ab"); }); }
rust_cleaned_test_functions.jsonl/34713
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 176 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 57478, 47115, 368, 341, 262, 1273, 1243, 8685, 445, 18594, 497, 760, 5148, 91, 341, 286, 1077, 1102, 284, 4534, 198, 310, 659, 1631, 445, 4858, 33720, 47115, 492, 64, 1844, 65, 863, 497, 609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_gjk_hit() { let left = Rectangle::new(10., 10.); let left_transform = transform(15., 0., 0.); let right = Rectangle::new(10., 10.); let right_transform = transform(7., 2., 0.); let gjk = GJK2::new(); let simplex = gjk.intersect(&left, &left_transform, &right, &right_transform); assert!(simplex.is_some()); let contact = gjk.intersection( &CollisionStrategy::FullResolution, &left, &left_transform, &right, &right_transform, ); assert!(contact.is_some()); let contact = contact.unwrap(); assert_eq!(Vector2::new(-1., 0.), contact.normal); assert_eq!(2., contact.penetration_depth); assert_eq!(Point2::new(10., 1.), contact.contact_point); }
rust_cleaned_test_functions.jsonl/90904
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 407 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 41808, 37697, 368, 341, 286, 1077, 2115, 284, 19280, 486, 931, 7, 16, 15, 2572, 220, 16, 15, 58957, 286, 1077, 2115, 18449, 284, 5165, 7, 16, 20, 2572, 220, 15, 2572, 220, 15, 58957, 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_rans_decode_nx16_rle() -> io::Result<()> { let data = [ 0x40, // flags = RLE 0x0d, // uncompressed len = 13 0x06, 0x06, 0x17, 0x01, 0x07, 0x6f, 0x00, 0x02, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x64, 0x65, 0x00, 0x6c, 0x6e, 0x6f, 0x00, 0x73, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x3a, 0x20, 0x00, 0x00, 0x7c, 0x20, 0x00, 0x00, 0x52, 0x01, 0x00, 0x00, 0x08, 0x04, 0x00, ]; let mut reader = &data[..]; assert_eq!(rans_decode_nx16(&mut reader, 0)?, b"noooooooodles"); Ok(()) }
rust_cleaned_test_functions.jsonl/73557
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 463 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 596, 15227, 1089, 87, 16, 21, 1710, 273, 368, 1464, 6399, 486, 2077, 71698, 341, 286, 1077, 821, 284, 2278, 310, 220, 15, 87, 19, 15, 11, 442, 8042, 284, 431, 867, 198, 310, 220, 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...
2
#[test] fn test_reference_lifetime() { let f = || { let s = r#"{"test": 42}"#.to_string(); s.parse::<JsonValue>() // Lifetime of s ends here }; assert!(f().is_ok()); }
rust_cleaned_test_functions.jsonl/88096
{ "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, 25433, 98827, 368, 341, 262, 1077, 282, 284, 1369, 341, 286, 1077, 274, 284, 435, 55543, 4913, 1944, 788, 220, 19, 17, 9863, 87846, 983, 3904, 543, 286, 274, 4632, 27638, 93412, 18949, 286, 442,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
#[test] fn test_request_block() { let (public_key, secret_key) = gen_keypair(); // write let request = BlockRequest::new(&public_key, &public_key, Height(1), &secret_key); // read assert_eq!(request.from(), &public_key); assert_eq!(request.height(), Height(1)); assert_eq!(request.to(), &public_key); assert!(request.verify_signature(&public_key)); }
rust_cleaned_test_functions.jsonl/118861
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 155 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7893, 7113, 368, 341, 262, 1077, 320, 888, 3097, 11, 6234, 3097, 8, 284, 4081, 3097, 12670, 1428, 262, 442, 3270, 198, 262, 1077, 1681, 284, 8362, 1900, 486, 931, 2099, 888, 3097, 11, 609, 888...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_params_pass_array_str() { if let Ok(r) = ParamsPassArrayStr::from_file("src/term_strz.bin") { assert_eq!(r.pass_str_array.strs.len(), 3); assert_eq!(r.pass_str_array.strs[0], "fo"); assert_eq!(r.pass_str_array.strs[1], "o|"); assert_eq!(r.pass_str_array.strs[2], "ba"); assert_eq!(r.pass_str_array_calc.strs.len(), 2); assert_eq!(r.pass_str_array_calc.strs[0], "aB"); assert_eq!(r.pass_str_array_calc.strs[1], "Cd"); } }
rust_cleaned_test_functions.jsonl/115829
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 274 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6745, 15464, 3858, 2895, 368, 341, 262, 421, 1077, 7622, 2601, 8, 284, 34352, 12187, 1857, 2580, 486, 1499, 2458, 445, 3548, 14, 4991, 2895, 89, 29394, 899, 1476, 286, 2060, 10714, 10297, 81, 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...
2
#[test] fn test_index_on_commit_reload_policy() { let schema = throw_away_schema(); let field = schema.get_field("num_likes").unwrap(); let index = Index::create_in_ram(schema); let reader = index .reader_builder() .reload_policy(ReloadPolicy::OnCommit) .try_into() .unwrap(); assert_eq!(reader.searcher().num_docs(), 0); test_index_on_commit_reload_policy_aux(field, &index, &reader); }
rust_cleaned_test_functions.jsonl/104865
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 240 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3560, 4470, 36346, 79405, 22773, 368, 341, 286, 1077, 10802, 284, 2510, 62, 13757, 25371, 543, 286, 1077, 2070, 284, 10802, 670, 5013, 445, 2413, 89178, 1827, 15454, 543, 286, 1077, 1922, 284, 800...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_monkey_symbols() { let input = br###" !-/*5; 5 < 10 > 5; if (5 < 10) { return true; } else { return false; } 10 == 10; 10 != 9; "foobar" "foo bar" [1, 2] {"foo": "bar"} "###.to_vec(); let l = &mut lex(input.into_iter()); let tests = vec![ Expected { expected_type: TokenType::Bang, expected_literal: "!".to_string() }, Expected { expected_type: TokenType::Minus, expected_literal: "-".to_string() }, Expected { expected_type: TokenType::Slash, expected_literal: "/".to_string() }, Expected { expected_type: TokenType::Asterisk, expected_literal: "*".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "5".to_string() }, Expected { expected_type: TokenType::SemiColon, expected_literal: ";".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "5".to_string() }, Expected { expected_type: TokenType::Lt, expected_literal: "<".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "10".to_string() }, Expected { expected_type: TokenType::Gt, expected_literal: ">".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "5".to_string() }, Expected { expected_type: TokenType::SemiColon, expected_literal: ";".to_string() }, Expected { expected_type: TokenType::If, expected_literal: "if".to_string() }, Expected { expected_type: TokenType::LParen, expected_literal: "(".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "5".to_string() }, Expected { expected_type: TokenType::Lt, expected_literal: "<".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "10".to_string() }, Expected { expected_type: TokenType::RParen, expected_literal: ")".to_string() }, Expected { expected_type: TokenType::LBrace, expected_literal: "{".to_string() }, Expected { expected_type: TokenType::Return, expected_literal: "return".to_string() }, Expected { expected_type: TokenType::True, expected_literal: "true".to_string() }, Expected { expected_type: TokenType::SemiColon, expected_literal: ";".to_string() }, Expected { expected_type: TokenType::RBrace, expected_literal: "}".to_string() }, Expected { expected_type: TokenType::Else, expected_literal: "else".to_string() }, Expected { expected_type: TokenType::LBrace, expected_literal: "{".to_string() }, Expected { expected_type: TokenType::Return, expected_literal: "return".to_string() }, Expected { expected_type: TokenType::False, expected_literal: "false".to_string() }, Expected { expected_type: TokenType::SemiColon, expected_literal: ";".to_string() }, Expected { expected_type: TokenType::RBrace, expected_literal: "}".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "10".to_string() }, Expected { expected_type: TokenType::Eq, expected_literal: "==".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "10".to_string() }, Expected { expected_type: TokenType::SemiColon, expected_literal: ";".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "10".to_string() }, Expected { expected_type: TokenType::NotEq, expected_literal: "!=".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "9".to_string() }, Expected { expected_type: TokenType::SemiColon, expected_literal: ";".to_string() }, Expected { expected_type: TokenType::String, expected_literal: "foobar".to_string() }, Expected { expected_type: TokenType::String, expected_literal: "foo bar".to_string() }, Expected { expected_type: TokenType::LBracket, expected_literal: "[".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "1".to_string() }, Expected { expected_type: TokenType::Comma, expected_literal: ",".to_string() }, Expected { expected_type: TokenType::Int, expected_literal: "2".to_string() }, Expected { expected_type: TokenType::RBracket, expected_literal: "]".to_string() }, Expected { expected_type: TokenType::LBrace, expected_literal: "{".to_string() }, Expected { expected_type: TokenType::String, expected_literal: "foo".to_string() }, Expected { expected_type: TokenType::Colon, expected_literal: ":".to_string() }, Expected { expected_type: TokenType::String, expected_literal: "bar".to_string() }, Expected { expected_type: TokenType::RBrace, expected_literal: "}".to_string() }, Expected { expected_type: TokenType::Eof, expected_literal: "".to_string() }, ]; assert_tokens(tests, l); }
rust_cleaned_test_functions.jsonl/58250
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2225 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20737, 792, 55752, 368, 341, 286, 1077, 1946, 284, 1411, 14374, 698, 310, 753, 12, 1057, 20, 280, 310, 220, 20, 366, 220, 16, 15, 861, 220, 20, 401, 310, 421, 320, 20, 366, 220, 16, 15, 8,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_serialize() { let a = ("test", 1u8, 2u32).to_variant(); let bytes = a.data_as_bytes(); let data = a.data(); let len = a.size(); assert_eq!(bytes.len(), len); assert_eq!(data.len(), len); let mut store_data = vec![0u8; len]; assert_eq!(a.store(&mut store_data).unwrap(), len); assert_eq!(&bytes, data); assert_eq!(&store_data, data); let b = Variant::from_data::<(String, u8, u32), _>(store_data); assert_eq!(a, b); let c = Variant::from_bytes::<(String, u8, u32)>(&bytes); assert_eq!(a, c); }
rust_cleaned_test_functions.jsonl/30229
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 321 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 88686, 368, 341, 286, 1077, 264, 284, 3489, 1944, 497, 220, 16, 84, 23, 11, 220, 17, 84, 18, 17, 568, 983, 46112, 1428, 286, 1077, 5820, 284, 264, 2196, 11898, 12524, 543, 286, 1077, 821, 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_filter_valid_packets() { solana_logger::setup(); let all_packets = (0..16) .map(|packets_id| { let packets = Packets::new( (0..32) .map(|packet_id| { let mut p = Packet::default(); p.meta.port = packets_id << 8 | packet_id; p }) .collect_vec(), ); let valid_indexes = (0..32) .filter_map(|x| if x % 2 != 0 { Some(x as usize) } else { None }) .collect_vec(); (packets, valid_indexes) }) .collect_vec(); let result = BankingStage::filter_valid_packets_for_forwarding(&all_packets); assert_eq!(result.len(), 256); let _ = result .into_iter() .enumerate() .map(|(index, p)| { let packets_id = index / 16; let packet_id = (index % 16) * 2 + 1; assert_eq!(p.meta.port, (packets_id << 8 | packet_id) as u16); }) .collect_vec(); }
rust_cleaned_test_functions.jsonl/5947
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 749 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8727, 8337, 63569, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 1428, 286, 1077, 678, 63569, 284, 320, 15, 496, 16, 21, 340, 310, 659, 2186, 22428, 4748, 1415, 842, 91, 341, 394, 1077, 27035, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_safe_checkout_typechange_tree_to_blob() -> BitResult<()> { BitRepo::with_minimal_repo(|repo| { bit_branch!(repo: "original"); let target = commit! { foo { bar } }; bit_checkout!(repo: &rev!(target))?; bit_checkout!(repo: "original")?; assert_eq!(cat!(repo: "foo"), "default foo contents"); Ok(()) }) }
rust_cleaned_test_functions.jsonl/62986
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 236 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34067, 68186, 1819, 3373, 11663, 2346, 45908, 368, 1464, 6495, 2077, 71698, 341, 262, 6495, 25243, 486, 4197, 7260, 2861, 37784, 22428, 23476, 91, 341, 286, 2699, 28031, 10297, 23476, 25, 330, 9889,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_scout_no_workspace_one_diff() -> Result<(), crate::error::Error> { let diff = vec![Section { file_name: get_absolute_file_path("foo/bar.rs")?, line_start: 0, line_end: 10, }]; let lints = vec![ Lint { location: Location { lines: [2, 2], path: get_absolute_file_path("foo/bar.rs")?, }, message: "Test lint".to_string(), }, Lint { location: Location { lines: [12, 22], path: get_absolute_file_path("foo/bar.rs")?, }, message: "This lint is not in diff".to_string(), }, ]; let expected_lints_from_diff = vec![Lint { location: Location { lines: [2, 2], path: get_absolute_file_path("foo/bar.rs")?, }, message: "Test lint".to_string(), }]; let linter = TestLinter::with_lints(lints); let vcs = TestVCS::new(diff); // The member matches the file name let config = TestConfig::new(vec!["foo".to_string()]); let expected_times_called = 1; let actual_times_called = Rc::clone(&linter.lints_times_called); let scout = Scout::new(vcs, config, linter); // We don't check for the lints result here. // It is already tested in the linter tests // and in intersection tests let actual_lints_from_diff = scout.run()?; assert_eq!(expected_times_called, *actual_times_called.borrow()); assert_eq!(expected_lints_from_diff, actual_lints_from_diff); Ok(()) }
rust_cleaned_test_functions.jsonl/28045
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 918 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 6104, 6536, 75560, 11667, 15850, 368, 1464, 5714, 68843, 17717, 486, 841, 486, 1454, 29, 341, 286, 1077, 3638, 284, 7486, 20703, 9620, 341, 310, 1034, 1269, 25, 633, 50874, 2458, 2638, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_is_valid_address() { let bad_address_port = socketaddr!("127.0.0.1:0"); assert!(!ContactInfo::is_valid_address( &bad_address_port, &SocketAddrSpace::Unspecified )); let bad_address_unspecified = socketaddr!(0, 1234); assert!(!ContactInfo::is_valid_address( &bad_address_unspecified, &SocketAddrSpace::Unspecified )); let bad_address_multicast = socketaddr!([224, 254, 0, 0], 1234); assert!(!ContactInfo::is_valid_address( &bad_address_multicast, &SocketAddrSpace::Unspecified )); let loopback = socketaddr!("127.0.0.1:1234"); assert!(ContactInfo::is_valid_address( &loopback, &SocketAddrSpace::Unspecified )); }
rust_cleaned_test_functions.jsonl/71981
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 423 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 8337, 6744, 368, 341, 286, 1077, 3873, 6744, 8716, 284, 7575, 6214, 17223, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 15, 797, 286, 2060, 0, 3471, 8732, 1731, 486, 285, 8337, 6744, 1006, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pow_function() -> Result<()> { #[allow(dead_code)] struct Test { name: &'static str, display: &'static str, args: Vec<DataColumnWithField>, expect: DataColumn, error: &'static str, } let tests = vec![ Test { name: "pow-with-literal", display: "POW", args: vec![ DataColumnWithField::new( Series::new([2]).into(), DataField::new("x", DataType::Int32, false), ), DataColumnWithField::new( Series::new([2]).into(), DataField::new("y", DataType::Int32, false), ), ], expect: DataColumn::Constant(4_f64.into(), 1), error: "", }, Test { name: "pow-with-series", display: "POW", args: vec![ DataColumnWithField::new( Series::new([2, 2]).into(), DataField::new("x", DataType::Int32, false), ), DataColumnWithField::new( Series::new([2, -2]).into(), DataField::new("y", DataType::Int32, false), ), ], expect: Series::new([4_f64, 0.25]).into(), error: "", }, Test { name: "pow-with-null", display: "POW", args: vec![ DataColumnWithField::new( Series::new([Some(2), None, None]).into(), DataField::new("x", DataType::Int32, false), ), DataColumnWithField::new( Series::new([Some(2), Some(-2), None]).into(), DataField::new("y", DataType::Int32, false), ), ], expect: Series::new([Some(4_f64), None, None]).into(), error: "", }, Test { name: "pow-x-constant", display: "POW", args: vec![ DataColumnWithField::new( DataColumn::Constant(2.into(), 2), DataField::new("x", DataType::Int32, false), ), DataColumnWithField::new( Series::new([Some(2), Some(-2), None]).into(), DataField::new("y", DataType::Int32, false), ), ], expect: Series::new([Some(4_f64), Some(0.25), None]).into(), error: "", }, Test { name: "pow-y-constant", display: "POW", args: vec![ DataColumnWithField::new( Series::new([Some(2), Some(-2), None]).into(), DataField::new("x", DataType::Int32, false), ), DataColumnWithField::new( DataColumn::Constant(2.into(), 2), DataField::new("y", DataType::Int32, false), ), ], expect: Series::new([Some(4_f64), Some(4.0), None]).into(), error: "", }, ]; let func = PowFunction::try_create("pow")?; for t in tests { if let Err(e) = func.eval(&t.args, t.args[0].column().len()) { assert_eq!(t.error, e.to_string(), "{}", t.name); } // Display check. let expect_display = t.display.to_string(); let actual_display = format!("{}", func); assert_eq!(expect_display, actual_display); let v = &(func.eval(&t.args, t.args[0].column().len())?); assert_eq!(v, &t.expect, "{}", t.name); let return_type = v.data_type(); let expected_type = func.return_type(&[t.args[0].column().data_type()])?; assert_eq!(expected_type, return_type); } Ok(()) }
rust_cleaned_test_functions.jsonl/134506
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2230 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 56183, 9174, 368, 1464, 5714, 71698, 341, 262, 11506, 7183, 83207, 4136, 5563, 262, 2036, 3393, 341, 286, 829, 25, 30136, 1978, 607, 345, 286, 3037, 25, 30136, 1978, 607, 345, 286, 2827, 25, 113...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_oracle() { let v = vec![5, 6, 3]; let w = vec![4, 5, 2]; assert_eq!(oracle(0, -1, &w, &v), 0); assert_eq!(oracle(9, -1, &w, &v), 0); assert_eq!(oracle(3, 0, &w, &v), 0); assert_eq!(oracle(4, 0, &w, &v), 5); assert_eq!(oracle(9, 0, &w, &v), 5); assert_eq!(oracle(3, 1, &w, &v), 0); assert_eq!(oracle(4, 1, &w, &v), 5); assert_eq!(oracle(5, 1, &w, &v), 6); assert_eq!(oracle(9, 1, &w, &v), 11); assert_eq!(oracle(3, 2, &w, &v), 3); assert_eq!(oracle(8, 2, &w, &v), 9); }
rust_cleaned_test_functions.jsonl/69076
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 429 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8734, 7902, 368, 341, 310, 1077, 348, 284, 7486, 20703, 20, 11, 220, 21, 11, 220, 18, 935, 310, 1077, 289, 284, 7486, 20703, 19, 11, 220, 20, 11, 220, 17, 935, 310, 2060, 10714, 10297, 69631...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_distance_test() { let mut g: DenseShapeGrid<(), [f32; 2]> = DenseShapeGrid::new(10); let a = g.insert([3.0, 4.0], ()); let far: Vec<_> = g.query_around([0.0, 0.0], 5.1).map(|x| x.0).collect(); assert_eq!(far, vec![a]); let near: Vec<_> = g.query_around([0.0, 0.0], 4.9).map(|x| x.0).collect(); assert_eq!(near, vec![]); }
rust_cleaned_test_functions.jsonl/32131
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 221 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19464, 4452, 368, 972, 286, 1077, 5206, 342, 25, 42522, 12301, 3543, 68843, 508, 69, 18, 17, 26, 220, 17, 25669, 284, 42522, 12301, 3543, 486, 931, 7, 16, 15, 736, 286, 1077, 264, 284, 342, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_hostname1_prop() { use super::Props; let c = Connection::new_system().unwrap(); let p = Props::new(&c, "org.freedesktop.hostname1", "/org/freedesktop/hostname1", "org.freedesktop.hostname1", 10000); /* Let's use both the get and getall methods and see if we get the same result */ let v = p.get("StaticHostname").unwrap(); let vall = p.get_all().unwrap(); let v2 = vall.get("StaticHostname").unwrap(); assert_eq!(&v, &*v2); match v { MessageItem::Str(ref s) => { println!("StaticHostname is {}", s); } _ => { panic!("Invalid Get: {:?}", v); } }; }
rust_cleaned_test_functions.jsonl/3098
{ "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, 3062, 63840, 16, 21663, 368, 341, 286, 990, 2256, 486, 5992, 401, 286, 1077, 272, 284, 11032, 486, 931, 17687, 1005, 15454, 543, 286, 1077, 281, 284, 29306, 486, 931, 2099, 66, 11, 330, 1775, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_convert_latin1_to_utf8() { let mut src: Vec<u8> = Vec::with_capacity(256); src.resize(256, 0); let mut reference: Vec<u16> = Vec::with_capacity(256); reference.resize(256, 0); for i in 0..256 { src[i] = i as u8; reference[i] = i as u16; } let s = String::from_utf16(&reference[..]).unwrap(); let mut dst: Vec<u8> = Vec::with_capacity(src.len() * 2); dst.resize(src.len() * 2, 0); let len = convert_latin1_to_utf8(&src[..], &mut dst[..]); dst.truncate(len); assert_eq!(&dst[..], s.as_bytes()); }
rust_cleaned_test_functions.jsonl/27313
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 336 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34910, 907, 14768, 16, 2346, 39453, 23, 368, 341, 286, 1077, 5206, 2286, 25, 11312, 34837, 23, 29, 284, 11312, 486, 4197, 35603, 7, 17, 20, 21, 317, 286, 2286, 17382, 7, 17, 20, 21, 11, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_keys_and_values() { let v = CrdsValue::LeaderId(LeaderId::default()); let key = v.clone().leader_id().unwrap().id; assert_eq!(v.wallclock(), 0); assert_eq!(v.label(), CrdsValueLabel::LeaderId(key)); let v = CrdsValue::ContactInfo(ContactInfo::default()); assert_eq!(v.wallclock(), 0); let key = v.clone().contact_info().unwrap().id; assert_eq!(v.label(), CrdsValueLabel::ContactInfo(key)); let v = CrdsValue::Vote(Vote::new(test_tx(), 0)); assert_eq!(v.wallclock(), 0); let key = v.clone().vote().unwrap().transaction.account_keys[0]; assert_eq!(v.label(), CrdsValueLabel::Vote(key)); }
rust_cleaned_test_functions.jsonl/80560
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 316 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12631, 8378, 9146, 368, 341, 286, 1077, 348, 284, 4553, 5356, 1130, 486, 52621, 764, 7, 52621, 764, 486, 2258, 1423, 286, 1077, 1376, 284, 348, 15997, 1005, 37391, 842, 1005, 15454, 1005, 307, 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_error_s3_list_objects() { let mock_response = MockResponseReader::read_response( "test_resources/generated/error", "s3-list-objects.xml", ); let mock = MockRequestDispatcher::with_status(400).with_body(&mock_response); let client = S3Client::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1); let request = ListObjectsRequest::default(); let result = client.list_objects(request).sync(); assert!(!result.is_ok(), "parse error: {:?}", result); }
rust_cleaned_test_functions.jsonl/29195
{ "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, 21039, 4096, 643, 18, 2019, 24873, 368, 341, 286, 1077, 7860, 9655, 284, 14563, 2582, 5062, 486, 878, 9655, 1006, 310, 330, 1944, 35569, 79372, 41737, 756, 310, 330, 82, 18, 9029, 12, 19210, 902...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_komakind_try_from() { let input_and_expected:Vec<(&'static str,Result<KomaKind, TypeConvertError<String>>)> = vec![ ("K", Ok(KomaKind::SOu)), ("R", Ok(KomaKind::SHisha)), ("B", Ok(KomaKind::SKaku)), ("G", Ok(KomaKind::SKin)), ("S", Ok(KomaKind::SGin)), ("N", Ok(KomaKind::SKei)), ("L", Ok(KomaKind::SKyou)), ("P", Ok(KomaKind::SFu)), ("+R", Ok(KomaKind::SHishaN)), ("+B", Ok(KomaKind::SKakuN)), ("+N", Ok(KomaKind::SKeiN)), ("+S", Ok(KomaKind::SGinN)), ("+L", Ok(KomaKind::SKyouN)), ("+P", Ok(KomaKind::SFuN)), ("k", Ok(KomaKind::GOu)), ("r", Ok(KomaKind::GHisha)), ("b", Ok(KomaKind::GKaku)), ("g", Ok(KomaKind::GKin)), ("s", Ok(KomaKind::GGin)), ("n", Ok(KomaKind::GKei)), ("l", Ok(KomaKind::GKyou)), ("p", Ok(KomaKind::GFu)), ("+r", Ok(KomaKind::GHishaN)), ("+b", Ok(KomaKind::GKakuN)), ("+n", Ok(KomaKind::GKeiN)), ("+s", Ok(KomaKind::GGinN)), ("+l", Ok(KomaKind::GKyouN)), ("+p", Ok(KomaKind::GFuN)), ("a", Err(TypeConvertError::SyntaxError(String::from( "Invalid SFEN character string (a)" )))), ("*p", Err(TypeConvertError::SyntaxError(String::from( "Invalid SFEN character string (*p)" )))), ]; for (i,r) in input_and_expected.into_iter() { assert_eq!(KomaKind::try_from(i),r); } }
rust_cleaned_test_functions.jsonl/46531
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 681 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4698, 316, 585, 484, 53283, 5673, 368, 972, 10217, 1946, 8378, 32190, 25, 10050, 27, 2099, 6, 1978, 607, 11, 2077, 28239, 7786, 10629, 11, 3990, 12012, 1454, 3464, 2452, 16018, 284, 7486, 20703, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_receiving_router_advertisement_prefix_option() { fn packet_buf( src_ip: Ipv6Addr, dst_ip: Ipv6Addr, prefix: Ipv6Addr, prefix_length: u8, on_link_flag: bool, autonomous_address_configuration_flag: bool, valid_lifetime: u32, preferred_lifetime: u32, ) -> Buf<Vec<u8>> { let p = PrefixInformation::new( prefix_length, on_link_flag, autonomous_address_configuration_flag, valid_lifetime, preferred_lifetime, prefix, ); let options = &[NdpOption::PrefixInformation(&p)]; OptionsSerializer::new(options.iter()) .into_serializer() .encapsulate(IcmpPacketBuilder::<Ipv6, &[u8], _>::new( src_ip, dst_ip, IcmpUnusedCode, RouterAdvertisement::new(1, false, false, 0, 4, 5), )) .serialize_vec_outer() .unwrap() .unwrap_b() } let config = Ipv6::DUMMY_CONFIG; let mut ctx = DummyEventDispatcherBuilder::from_config(config.clone()) .build::<DummyEventDispatcher>(); let device = DeviceId::new_ethernet(0); let device_id = device.id().into(); let src_mac = Mac::new([10, 11, 12, 13, 14, 15]); let src_ip = src_mac.to_ipv6_link_local().addr().get(); let prefix = Ipv6Addr::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 0]); let prefix_length = 120; let addr_subnet = AddrSubnet::new(prefix, prefix_length).unwrap(); // Receive a new RA with new prefix. let mut icmpv6_packet_buf = packet_buf(src_ip, config.local_ip.get(), prefix, prefix_length, true, false, 100, 0); let icmpv6_packet = icmpv6_packet_buf .parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip)) .unwrap(); ctx.receive_ndp_packet( device, src_ip.try_into().unwrap(), config.local_ip, icmpv6_packet.unwrap_ndp(), ); assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_advertisement"), 1); let ndp_state = StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with( &mut ctx, device_id, ); // Prefix should be in our list now. assert!(ndp_state.has_prefix(&addr_subnet)); // Invalidation timeout should be set. assert_eq!(ctx.dispatcher().timer_events().count(), 1); // Receive a RA with same prefix but valid_lifetime = 0; let mut icmpv6_packet_buf = packet_buf(src_ip, config.local_ip.get(), prefix, prefix_length, true, false, 0, 0); let icmpv6_packet = icmpv6_packet_buf .parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip)) .unwrap(); ctx.receive_ndp_packet( device, src_ip.try_into().unwrap(), config.local_ip, icmpv6_packet.unwrap_ndp(), ); assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_advertisement"), 2); let ndp_state = StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with( &mut ctx, device_id, ); // Should remove the prefix from our list now. assert!(!ndp_state.has_prefix(&addr_subnet)); // Invalidation timeout should be unset. assert_eq!(ctx.dispatcher().timer_events().count(), 0); // Receive a new RA with new prefix (same as before but new since it let mut icmpv6_packet_buf = packet_buf(src_ip, config.local_ip.get(), prefix, prefix_length, true, false, 100, 0); let icmpv6_packet = icmpv6_packet_buf .parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip)) .unwrap(); ctx.receive_ndp_packet( device, src_ip.try_into().unwrap(), config.local_ip, icmpv6_packet.unwrap_ndp(), ); assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_advertisement"), 3); let ndp_state = StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with( &mut ctx, device_id, ); // Prefix should be in our list now. assert!(ndp_state.has_prefix(&addr_subnet)); // Invalidation timeout should be set. assert_eq!(ctx.dispatcher().timer_events().count(), 1); // Receive the exact same RA as before. let mut icmpv6_packet_buf = packet_buf(src_ip, config.local_ip.get(), prefix, prefix_length, true, false, 100, 0); let icmpv6_packet = icmpv6_packet_buf .parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip)) .unwrap(); ctx.receive_ndp_packet( device, src_ip.try_into().unwrap(), config.local_ip, icmpv6_packet.unwrap_ndp(), ); assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_advertisement"), 4); let ndp_state = StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with( &mut ctx, device_id, ); // Prefix should be in our list still. assert!(ndp_state.has_prefix(&addr_subnet)); // Invalidation timeout should still be set. assert_eq!(ctx.dispatcher().timer_events().count(), 1); // Timeout the prefix. assert_eq!( trigger_next_timer(&mut ctx).unwrap(), NdpTimerId::new_prefix_invalidation(device_id.into(), addr_subnet).into() ); // Prefix should no longer be in our list. let ndp_state = StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with( &mut ctx, device_id, ); assert!(!ndp_state.has_prefix(&addr_subnet)); // No more timers. assert!(trigger_next_timer(&mut ctx).is_none()); }
rust_cleaned_test_functions.jsonl/82809
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3268 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1288, 46344, 55587, 10027, 44424, 13974, 9672, 368, 341, 286, 5168, 10151, 10363, 1006, 310, 2286, 10385, 25, 358, 30168, 21, 13986, 345, 310, 10648, 10385, 25, 358, 30168, 21, 13986, 345, 310, 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...
1
#[test] fn test_ctcp_action_parsing_2() { // > implements message splitting. let mut buf = vec![]; write!( &mut buf, ":a!b@c PRIVMSG target :\x01ACTION msg contents\r\n" ) .unwrap(); assert_eq!( parse_irc_msg(&mut buf).unwrap().unwrap().cmd, Cmd::PRIVMSG { target: MsgTarget::User("target".to_owned()), msg: "msg contents".to_owned(), is_notice: false, ctcp: Some(CTCP::Action), } ); assert_eq!(buf.len(), 0); let mut buf = vec![]; write!(&mut buf, ":a!b@c PRIVMSG target :\x01ACTION \r\n").unwrap(); assert_eq!( parse_irc_msg(&mut buf).unwrap().unwrap().cmd, Cmd::PRIVMSG { target: MsgTarget::User("target".to_owned()), msg: "".to_owned(), is_notice: false, ctcp: Some(CTCP::Action), } ); assert_eq!(buf.len(), 0); // of the '’'s. let mut buf = vec![]; write!(&mut buf, ":a!b@c PRIVMSG target :’’’’’’’\r\n").unwrap(); assert_eq!( parse_irc_msg(&mut buf).unwrap().unwrap().cmd, Cmd::PRIVMSG { target: MsgTarget::User("target".to_owned()), msg: "’’’’’’’".to_owned(), is_notice: false, ctcp: None, } ); assert_eq!(buf.len(), 0); }
rust_cleaned_test_functions.jsonl/24489
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 959 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26134, 4672, 7931, 620, 28598, 62, 17, 368, 341, 16885, 16885, 286, 442, 861, 5169, 1943, 44373, 624, 286, 1077, 5206, 6607, 284, 7486, 0, 15078, 286, 3270, 33673, 310, 609, 6984, 6607, 345, 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_setup_cmd() { // Test input arguments are generated to according struct. let interfaces = "eth"; let args = &["-i", interfaces]; assert_eq!( Setup::from_args(CMD_NAME, args), Ok(Setup { configuration_interfaces: Some(str_to_interfaces(interfaces).unwrap()) }) ) }
rust_cleaned_test_functions.jsonl/592
{ "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, 21363, 11684, 368, 341, 286, 442, 3393, 1946, 5977, 525, 7907, 311, 4092, 2036, 624, 286, 1077, 24099, 284, 330, 769, 876, 286, 1077, 2827, 284, 609, 1183, 12, 72, 497, 24099, 935, 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_lockdb_acquire_init_multiple() { let ls = init_lockservice_db(); let ref1: ObjectRef = (ObjectID::random(), 1.into(), ObjectDigest::random()); let ref2: ObjectRef = (ObjectID::random(), 1.into(), ObjectDigest::random()); let ref3: ObjectRef = (ObjectID::random(), 1.into(), ObjectDigest::random()); let tx1 = TransactionDigest::random(); let tx2 = TransactionDigest::random(); // Should not be able to acquire lock for uninitialized locks assert_eq!( ls.acquire_locks(&[ref1, ref2], tx1), Err(SuiError::TransactionLockDoesNotExist) ); assert_eq!(ls.get_lock(ref1), Ok(None)); // Initialize 2 locks ls.initialize_locks(&[ref1, ref2], false /* is_force_reset */) .unwrap(); assert_eq!(ls.get_lock(ref2), Ok(Some(None))); assert_eq!(ls.locks_exist(&[ref1, ref2]), Ok(())); // Should not be able to acquire lock if not all objects initialized assert_eq!( ls.acquire_locks(&[ref1, ref2, ref3], tx1), Err(SuiError::TransactionLockDoesNotExist) ); // Should be able to acquire lock if all objects initialized ls.acquire_locks(&[ref1, ref2], tx1).unwrap(); assert_eq!(ls.get_lock(ref2), Ok(Some(Some(tx1)))); assert_eq!(ls.locks_exist(&[ref1, ref2]), Ok(())); assert_eq!( ls.locks_exist(&[ref2, ref3]), Err(SuiError::TransactionLockDoesNotExist) ); // Should get TransactionLockExists if try to initialize already locked object assert!(matches!( ls.initialize_locks(&[ref2, ref3], false /* is_force_reset */), Err(SuiError::TransactionLockExists { .. }) )); // Should not be able to acquire lock for diff tx if already locked ls.initialize_locks(&[ref3], false /* is_force_reset */) .unwrap(); assert!(matches!( ls.acquire_locks(&[ref2, ref3], tx2), Err(SuiError::ConflictingTransaction { .. }) )); }
rust_cleaned_test_functions.jsonl/1532
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 959 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9818, 1999, 97523, 6137, 45233, 368, 341, 286, 1077, 19597, 284, 2930, 9818, 7936, 8685, 1428, 286, 1077, 2053, 16, 25, 3002, 3945, 284, 320, 1190, 915, 486, 11463, 1507, 220, 16, 39860, 1507, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_0507_example_2() { let num = 7; let result = false; assert_eq!(Solution::check_perfect_number(num), result); }
rust_cleaned_test_functions.jsonl/47237
{ "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, 62, 15, 20, 15, 22, 39304, 62, 17, 368, 341, 286, 1077, 1629, 284, 220, 22, 280, 286, 1077, 1102, 284, 895, 401, 286, 2060, 10714, 10297, 36842, 486, 2028, 5678, 3751, 5500, 8068, 701, 1102, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_program_errors_and_collect_fee() { let leader = Pubkey::new_rand(); let GenesisConfigInfo { mut genesis_config, mint_keypair, .. } = create_genesis_config_with_leader(100, &leader, 3); genesis_config.fee_calculator.lamports_per_signature = 2; let bank = Bank::new(&genesis_config); let key = Keypair::new(); let tx1 = system_transaction::transfer(&mint_keypair, &key.pubkey(), 2, genesis_config.hash()); let tx2 = system_transaction::transfer(&mint_keypair, &key.pubkey(), 5, genesis_config.hash()); let results = vec![ (Ok(()), Some(HashAgeKind::Extant)), ( Err(TransactionError::InstructionError( 1, InstructionError::new_result_with_negative_lamports(), )), Some(HashAgeKind::Extant), ), ]; let initial_balance = bank.get_balance(&leader); let results = bank.filter_program_errors_and_collect_fee(&vec![tx1, tx2], None, &results); bank.freeze(); assert_eq!( bank.get_balance(&leader), initial_balance + bank .fee_calculator .burn(bank.fee_calculator.lamports_per_signature * 2) .0 ); assert_eq!(results[0], Ok(())); assert_eq!(results[1], Ok(())); }
rust_cleaned_test_functions.jsonl/42388
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 780 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8727, 25096, 20196, 8378, 68140, 34305, 368, 341, 286, 1077, 7653, 284, 22611, 792, 486, 931, 33864, 543, 286, 1077, 40788, 2648, 1731, 341, 310, 5206, 59366, 5332, 345, 310, 28337, 3097, 12670, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_load_tile_data_overlaps_dataset_bounds() { let output_shape: GridShape2D = [8, 8].into(); // shift world bbox one pixel up and to the left let (x_size, y_size) = (45., 22.5); let output_bounds = SpatialPartition2D::new_unchecked( (-180. - x_size, 90. + y_size).into(), (180. - x_size, -90. + y_size).into(), ); let RasterTile2D { global_geo_transform: _, grid_array: grid, tile_position: _, time: _, properties: _, } = load_ndvi_jan_2014(output_shape, output_bounds).unwrap(); assert!(!grid.is_empty()); let x = grid.into_materialized_grid(); assert_eq!(x.data.len(), 64); assert_eq!( x.data, &[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 0, 255, 75, 37, 255, 44, 34, 39, 0, 255, 86, 255, 255, 255, 30, 96, 0, 255, 255, 255, 255, 90, 255, 255, 0, 255, 255, 202, 255, 193, 255, 255, 0, 255, 255, 89, 255, 111, 255, 255, 0, 255, 255, 255, 255, 255, 255, 255 ] ); }
rust_cleaned_test_functions.jsonl/43954
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 652 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12411, 29844, 1769, 15431, 89722, 18999, 36878, 368, 341, 286, 1077, 2550, 13597, 25, 10587, 12301, 17, 35, 284, 508, 23, 11, 220, 23, 936, 18122, 543, 286, 442, 6407, 1879, 29749, 825, 12955, 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_reqopt_no_arg() { let long_args = vec!("--test".to_string()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { Err(ArgumentMissing(_)) => {}, _ => panic!() } let short_args = vec!("-t".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Err(ArgumentMissing(_)) => {}, _ => panic!() } }
rust_cleaned_test_functions.jsonl/11177
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 262 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17644, 2912, 6536, 6057, 368, 341, 286, 1077, 1293, 8384, 284, 7486, 17223, 313, 1944, 3263, 983, 3904, 1423, 286, 1077, 12185, 284, 7486, 10297, 2958, 2912, 445, 83, 497, 330, 1944, 497, 330, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_optional() { let db = checked_memory_handle(); let result: Result<i64> = db.query_row("SELECT 1 WHERE 0 <> 0", NO_PARAMS, |r| r.get(0)); let result = result.optional(); match result.unwrap() { None => (), _ => panic!("Unexpected result"), } let result: Result<i64> = db.query_row("SELECT 1 WHERE 0 == 0", NO_PARAMS, |r| r.get(0)); let result = result.optional(); match result.unwrap() { Some(1) => (), _ => panic!("Unexpected result"), } let bad_query_result: Result<i64> = db.query_row("NOT A PROPER QUERY", NO_PARAMS, |r| r.get(0)); let bad_query_result = bad_query_result.optional(); assert!(bad_query_result.is_err()); }
rust_cleaned_test_functions.jsonl/25512
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 385 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74644, 368, 341, 286, 1077, 2927, 284, 10067, 19195, 10630, 1428, 286, 1077, 1102, 25, 5714, 21897, 21, 19, 29, 284, 2927, 4786, 8530, 445, 4858, 220, 16, 5288, 220, 15, 14392, 220, 15, 497, 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...
3
#[test] fn test_list_of_strings_append() -> Result<()> { let string_builder = StringBuilder::new(32); let mut builder = ListBuilder::<StringBuilder>::new(string_builder); builder.values().append_value("Hello")?; builder.values().append_value("Arrow")?; builder.append(true)?; builder.append(false)?; let string_array = StringArray::from(vec![ Some("alpha"), Some("beta"), None, Some("gamma"), Some("delta"), None, ]); let list_value_offsets = Buffer::from(&[0, 2, 3, 6].to_byte_slice()); let list_data = ArrayData::new( DataType::List(Box::new(Field::new("item", DataType::Utf8, true))), 3, None, None, 0, vec![list_value_offsets], vec![string_array.data()], ); let list_array = ListArray::from(Arc::new(list_data) as ArrayDataRef); builder.append_data(&[ list_array.data(), list_array.slice(1, 2).data(), list_array.slice(0, 0).data(), ])?; let finished = builder.finish(); let expected_string_array = StringArray::from(vec![ Some("Hello"), Some("Arrow"), // list_array Some("alpha"), Some("beta"), None, Some("gamma"), Some("delta"), None, None, Some("gamma"), Some("delta"), None, ]); let list_value_offsets = Buffer::from(&[0, 2, 2, 4, 5, 8, 9, 12].to_byte_slice()); let expected_list_data = ArrayData::new( DataType::List(Box::new(Field::new("item", DataType::Utf8, true))), 7, None, None, // is this correct? 0, vec![list_value_offsets], vec![expected_string_array.data()], ); let expected_list = ListArray::from(Arc::new(expected_list_data) as ArrayDataRef); assert_eq!( finished.data().buffers()[0].data(), expected_list.data().buffers()[0].data() ); assert_eq!( finished.data().child_data()[0].buffers()[0].data(), expected_list.data().child_data()[0].buffers()[0].data() ); assert_eq!(&expected_list.values(), &finished.values()); assert_eq!(expected_list.len(), finished.len()); Ok(()) }
rust_cleaned_test_functions.jsonl/31009
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1342 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2019, 3575, 33500, 26041, 368, 1464, 5714, 71698, 341, 286, 1077, 914, 28532, 284, 11410, 486, 931, 7, 18, 17, 317, 286, 1077, 5206, 7363, 284, 1759, 3297, 27638, 69412, 6831, 931, 3609, 28532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_raw() { assert_eq!(js_parser_rs::parse("Hello".chars()), Ok(vec![TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("Hello\n".chars()), Ok(vec![TokenType::Identifier(String::from("Hello")),TokenType::LineTerminate])); assert_eq!(js_parser_rs::parse("Hello\r".chars()), Ok(vec![TokenType::Identifier(String::from("Hello")),TokenType::LineTerminate])); assert_eq!(js_parser_rs::parse("Hello\u{a0}".chars()), Ok(vec![TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("Hello\u{b}".chars()), Ok(vec![TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("Hello\u{c}".chars()), Ok(vec![TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("Hello\t".chars()), Ok(vec![TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("Hello ".chars()), Ok(vec![TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("Hello=".chars()), Ok(vec![TokenType::Identifier(String::from("Hello")),TokenType::Equal])); assert_eq!(js_parser_rs::parse("Hello('sd'".chars()), Ok(vec![TokenType::Identifier(String::from("Hello")),TokenType::LeftParen,TokenType::Literal(LiteralType::String(String::from("sd")))])); assert_eq!(js_parser_rs::parse("Hello|Hello".chars()), Ok(vec![TokenType::Identifier(String::from("Hello")),TokenType::OrBitwise,TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("Hello.Hello".chars()), Ok(vec![TokenType::Identifier(String::from("Hello")),TokenType::Point,TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("Hello/Hello".chars()), Ok(vec![TokenType::Identifier(String::from("Hello")),TokenType::Divide,TokenType::Identifier(String::from("Hello"))])); assert_eq!(js_parser_rs::parse("\\u005f\\u005f\\u0076\\u0061\\u0072".chars()), Ok(vec![TokenType::Identifier(String::from("__var"))])); }
rust_cleaned_test_functions.jsonl/61523
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 770 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16067, 368, 341, 262, 2060, 10714, 10297, 2519, 18517, 47115, 486, 6400, 445, 9707, 3263, 19255, 11858, 7622, 25592, 20703, 75611, 486, 8714, 2242, 486, 1499, 445, 9707, 2761, 14382, 262, 2060, 1071...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_function() { let ir = ir_from_cc("int f(int a, int b);").unwrap(); assert_ir_matches!( ir, quote! { Func { name: "f", owning_target: BazelLabel("//test:testing_target"), mangled_name: "_Z1fii", doc_comment: None, return_type: MappedType { rs_type: RsType { name: Some("i32"), lifetime_args: [], type_args: [], decl_id: None, }, cc_type: CcType { name: Some("int"), is_const: false, type_args: [], decl_id: None, }, }, params: [ FuncParam { type_: MappedType { rs_type: RsType { name: Some("i32"), lifetime_args: [], type_args: [], decl_id: None, }, cc_type: CcType { name: Some("int"), is_const: false, type_args: [], decl_id: None, }, }, identifier: "a", }, FuncParam { type_: MappedType { rs_type: RsType { name: Some("i32"), lifetime_args: [], type_args: [], decl_id: None, }, cc_type: CcType { name: Some("int"), is_const: false, type_args: [], decl_id: None, }, }, identifier: "b", }, ], lifetime_params: [], is_inline: false, member_func_metadata: None, has_c_calling_convention: true, is_member_or_descendant_of_class_template: false, source_loc: SourceLoc { filename: "ir_from_cc_virtual_header.h", line: 3, column: 1, }, id: ItemId(...), enclosing_namespace_id: None, } } ); }
rust_cleaned_test_functions.jsonl/37151
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2064 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9174, 368, 341, 262, 1077, 6216, 284, 6216, 5673, 28955, 445, 396, 282, 1548, 264, 11, 526, 293, 1215, 1827, 15454, 543, 262, 2060, 51433, 38344, 33673, 286, 6216, 345, 286, 12641, 0, 341, 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_equality() { let s0 = Atom::from("fn"); let s1 = Atom::from("fn"); let s2 = Atom::from("loop"); let i0 = Atom::from("blah"); let i1 = Atom::from("blah"); let i2 = Atom::from("blah2"); let d0 = Atom::from("zzzzzzzz"); let d1 = Atom::from("zzzzzzzz"); let d2 = Atom::from("zzzzzzzzz"); assert!(s0 == s1); assert!(s0 != s2); assert!(i0 == i1); assert!(i0 != i2); assert!(d0 == d1); assert!(d0 != d2); assert!(s0 != i0); assert!(s0 != d0); assert!(i0 != d0); }
rust_cleaned_test_functions.jsonl/80898
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 351 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2204, 10473, 368, 341, 286, 1077, 274, 15, 284, 39516, 486, 1499, 445, 8822, 797, 286, 1077, 274, 16, 284, 39516, 486, 1499, 445, 8822, 797, 286, 1077, 274, 17, 284, 39516, 486, 1499, 445, 104...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_group_by() { let input = json!([ {"id": 1, "year": 2015}, {"id": 2, "year": 2015}, {"id": 3, "year": 2016}, {"id": 4, "year": 2017}, {"id": 5, "year": 2017}, {"id": 6, "year": 2017}, {"id": 7, "year": 2018}, {"id": 8}, {"id": 9, "year": null}, ]); let mut args = HashMap::new(); args.insert("attribute".to_string(), to_value("year").unwrap()); let expected = json!({ "2015": [{"id": 1, "year": 2015}, {"id": 2, "year": 2015}], "2016": [{"id": 3, "year": 2016}], "2017": [{"id": 4, "year": 2017}, {"id": 5, "year": 2017}, {"id": 6, "year": 2017}], "2018": [{"id": 7, "year": 2018}], }); let res = group_by(&input, &args); assert!(res.is_ok()); assert_eq!(res.unwrap(), to_value(expected).unwrap()); }
rust_cleaned_test_functions.jsonl/62065
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 510 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6288, 3710, 368, 341, 286, 1077, 1946, 284, 2951, 0, 8956, 310, 5212, 307, 788, 220, 16, 11, 330, 3157, 788, 220, 17, 15, 16, 20, 1583, 310, 5212, 307, 788, 220, 17, 11, 330, 3157, 788, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_subsystem_from_line() { let lines = vec!["1:cpu:/", "8:cpu,cpuacct,cpuset:/docker/1234567890abcdef"]; let expected_subsystems = vec![ CGroupSubsys { id: 1, sub_systems: vec!["cpu".to_string()], name: "/".to_string(), }, CGroupSubsys { id: 8, sub_systems: vec![ "cpu".to_string(), "cpuacct".to_string(), "cpuset".to_string(), ], name: "/docker/1234567890abcdef".to_string(), }, ]; for (line, expected_subsystem) in lines.iter().zip(expected_subsystems) { let subsystem = parse_subsys_from_line(line).unwrap(); assert_eq!(subsystem, expected_subsystem); } }
rust_cleaned_test_functions.jsonl/45101
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 505 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 5228, 8948, 5673, 6528, 368, 341, 286, 1077, 5128, 284, 7486, 0, 1183, 16, 25, 16475, 14375, 497, 330, 23, 25, 16475, 11, 16475, 95081, 52753, 18187, 14375, 28648, 14, 16, 17, 18, 19, 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_services_config_apply_multiple_configs() { let mut testkit = testkit_with_supervisor_and_2_services(4); let initiator_id = testkit.network().us().validator_id().unwrap(); let params = "I am a new parameter".to_owned(); let propose = ConfigProposeBuilder::new(CFG_CHANGE_HEIGHT) .extend_service_config_propose(params.clone()) .extend_second_service_config_propose(params.clone()) .build(); let proposal_hash = propose.object_hash(); testkit .create_block_with_transaction(sign_config_propose_transaction( &testkit, propose, initiator_id, )) .transactions[0] .status() .expect("Transaction with change propose discarded."); let signed_txs = build_confirmation_transactions(&testkit, proposal_hash, initiator_id); testkit .create_block_with_transactions(signed_txs) .transactions[0] .status() .expect("Transaction with confirmations discarded."); testkit.create_blocks_until(CFG_CHANGE_HEIGHT); check_service_actual_param(&testkit, Some(params.clone())); check_second_service_actual_param(&testkit, Some(params)); }
rust_cleaned_test_functions.jsonl/93847
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 495 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39846, 5332, 36551, 45233, 59150, 368, 341, 262, 1077, 5206, 1273, 8226, 284, 1273, 8226, 6615, 23723, 31396, 8378, 62, 17, 39846, 7, 19, 317, 262, 1077, 98040, 842, 284, 1273, 8226, 20573, 1005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_sorted_extrema_on_small_input() { let actual_extrema = get_sorted_extrema(4); let actual_flags: Vec<u8> = actual_extrema .into_iter() .map(|(start, end)| { let range = start..=end; macro_rules! in_range_shifted { ($e:expr) => { if range.contains(&$e) { 1u8 << $e } else { 0u8 } }; } in_range_shifted!(3) | in_range_shifted!(2) | in_range_shifted!(1) | in_range_shifted!(0) }).collect(); let expected_flags = vec![0b1110, 0b0111, 0b1100, 0b0110, 0b0011]; let actual: Vec<u8> = actual_flags .into_iter() .map(|f: u8| f.count_ones() as u8) .collect(); let expected: Vec<u8> = expected_flags .into_iter() .map(|f: u8| f.count_ones() as u8) .collect(); assert_eq!(expected, actual); }
rust_cleaned_test_functions.jsonl/83015
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 630 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 41277, 9927, 89718, 4470, 31966, 5898, 368, 341, 262, 1077, 5042, 9927, 89718, 284, 633, 41277, 9927, 89718, 7, 19, 626, 262, 1077, 5042, 14130, 25, 11312, 34837, 23, 29, 284, 5042, 9927, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_addition() { let mut tmp = LARGEST; tmp += &LARGEST; assert_eq!( tmp, Scalar(blst::blst_fr { l: [ 0xfffffffeffffffff, 0x53bda402fffe5bfe, 0x3339d80809a1d805, 0x73eda753299d7d48 ] }) ); let mut tmp = LARGEST; tmp += &Scalar(blst::blst_fr { l: [1, 0, 0, 0] }); assert_eq!(tmp, Scalar::zero()); }
rust_cleaned_test_functions.jsonl/54655
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 355 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 680, 368, 341, 286, 1077, 5206, 4174, 284, 444, 7581, 5177, 280, 286, 4174, 1421, 609, 43, 7581, 5177, 401, 286, 2060, 10714, 33673, 310, 4174, 345, 310, 35176, 29811, 267, 486, 2024, 267,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_classed_html_generator_doesnt_panic() { let current_code = "{\n \"headers\": [\"Number\", \"Title\"],\n \"records\": [\n [\"1\", \"Gutenberg\"],\n [\"2\", \"Printing\"]\n ],\n}\n"; let syntax_def = SyntaxDefinition::load_from_str( include_str!("../testdata/JSON.sublime-syntax"), true, None, ) .unwrap(); let mut syntax_set_builder = SyntaxSetBuilder::new(); syntax_set_builder.add(syntax_def); let syntax_set = syntax_set_builder.build(); let syntax = syntax_set.find_syntax_by_name("JSON").unwrap(); let mut html_generator = ClassedHTMLGenerator::new_with_class_style(syntax, &syntax_set, ClassStyle::Spaced); for line in LinesWithEndings::from(current_code) { html_generator.parse_html_for_line_which_includes_newline(line).expect("#[cfg(test)]"); } html_generator.finalize(); }
rust_cleaned_test_functions.jsonl/116425
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 463 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4790, 291, 9564, 25813, 96374, 406, 620, 31270, 368, 341, 286, 1077, 1482, 4136, 284, 13868, 59, 77, 262, 7245, 7713, 11693, 508, 2105, 2833, 16215, 7245, 3851, 2105, 1125, 59, 77, 262, 7245, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_pattern_match() { let wildcard = "[BAR]"; assert!(util::pattern_match("foo[BAR]baz", "foobarbaz", wildcard)); assert!(!util::pattern_match("foo[BAR]baz", "foobazbar", wildcard)); let multiline_pattern = "[BAR] foo: [BAR]baz[BAR]"; fn multi_line_builder(input: &str, leading_text: Option<&str>) -> String { // If there is leading text add a newline so it's on it's own line let head = match leading_text { Some(v) => format!("{}\n", v), None => "".to_string(), }; format!( "{}foo: quuz {} corge grault", head, input ) } // Validate multi-line string builder assert_eq!( "QUUX=qux foo: quuz BAZ corge grault", multi_line_builder("BAZ", Some("QUUX=qux")) ); assert!(util::pattern_match( multiline_pattern, &multi_line_builder("baz", Some("QUX=quux")), wildcard )); assert!(util::pattern_match( multiline_pattern, &multi_line_builder("baz", None), wildcard )); assert!(!util::pattern_match( multiline_pattern, &multi_line_builder("garply", Some("QUX=quux")), wildcard )); assert!(!util::pattern_match( multiline_pattern, &multi_line_builder("garply", None), wildcard )); }
rust_cleaned_test_functions.jsonl/5589
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 540 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21260, 10708, 368, 341, 18611, 220, 1077, 59104, 284, 10545, 33065, 59757, 220, 2060, 10297, 1314, 486, 14339, 10708, 445, 7975, 32622, 934, 60, 42573, 497, 330, 50267, 42573, 497, 59104, 1106, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_nproc_omp_limit() { let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "42") .env("OMP_THREAD_LIMIT", "0") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(nproc, 42); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "42") .env("OMP_THREAD_LIMIT", "2") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(nproc, 2); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "42") .env("OMP_THREAD_LIMIT", "2bad") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(nproc, 42); let result = new_ucmd!().arg("--all").succeeds(); let nproc_system: u8 = result.stdout_str().trim().parse().unwrap(); assert!(nproc_system > 0); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_THREAD_LIMIT", "1") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(nproc, 1); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "0") .env("OMP_THREAD_LIMIT", "") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(nproc, nproc_system); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "") .env("OMP_THREAD_LIMIT", "") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(nproc, nproc_system); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "2,2,1") .env("OMP_THREAD_LIMIT", "") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(2, nproc); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "2,ignored") .env("OMP_THREAD_LIMIT", "") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(2, nproc); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "2,2,1") .env("OMP_THREAD_LIMIT", "0") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(2, nproc); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "2,2,1") .env("OMP_THREAD_LIMIT", "1bad") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(2, nproc); let result = TestScenario::new(util_name!()) .ucmd_keepenv() .env("OMP_NUM_THREADS", "29,2,1") .env("OMP_THREAD_LIMIT", "1bad") .succeeds(); let nproc: u8 = result.stdout_str().trim().parse().unwrap(); assert_eq!(29, nproc); }
rust_cleaned_test_functions.jsonl/43693
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1563 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1089, 15782, 62, 14435, 14763, 368, 341, 262, 1077, 1102, 284, 3393, 54031, 486, 931, 67811, 1269, 0, 2398, 286, 659, 1754, 2277, 50293, 3160, 741, 286, 659, 3160, 445, 51607, 9631, 56239, 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_linear_coord_map() { let coord: RangedCoordu32 = (0..20).into(); assert_eq!(coord.key_points(11).len(), 11); assert_eq!(coord.key_points(11)[0], 0); assert_eq!(coord.key_points(11)[10], 20); assert_eq!(coord.map(&5, (0, 100)), 25); let coord: RangedCoordf32 = (0f32..20f32).into(); assert_eq!(coord.map(&5.0, (0, 100)), 25); }
rust_cleaned_test_functions.jsonl/75127
{ "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, 40674, 30096, 5376, 368, 341, 286, 1077, 16489, 25, 431, 3726, 19437, 84, 18, 17, 284, 320, 15, 496, 17, 15, 568, 18122, 543, 286, 2060, 10714, 10297, 26402, 4735, 12928, 7, 16, 16, 568, 2892,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_additional_condition_inner_join() { let expected_sql = "SELECT `users`.* FROM `users` INNER JOIN `posts` ON (`users`.`id` = `posts`.`user_id` AND `posts`.`published` = ?)"; let query = Select::from_table("users").inner_join( "posts".on(("users", "id") .equals(Column::from(("posts", "user_id"))) .and(("posts", "published").equals(true))), ); let (sql, params) = Sqlite::build(query); assert_eq!(expected_sql, sql); assert_eq!( default_params(vec![ParameterizedValue::Boolean(true),]), params ); }
rust_cleaned_test_functions.jsonl/80614
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 323 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 81742, 27656, 34345, 31017, 368, 341, 286, 1077, 3601, 18063, 4035, 310, 330, 4858, 1565, 4218, 63, 4908, 4295, 1565, 4218, 63, 30348, 13069, 1565, 12664, 63, 6197, 28654, 4218, 28905, 307, 63, 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_scheme_total() { assert!(ShardScheme::Auto.total().is_none()); assert_eq!( 160, ShardScheme::Bucket { bucket_id: 3, concurrency: 16, total: 160, } .total() .unwrap() ); assert_eq!( 17, ShardScheme::Range { from: 0, to: 9, total: 17, } .total() .unwrap() ); }
rust_cleaned_test_functions.jsonl/28588
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 369 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53293, 10784, 368, 341, 286, 2060, 10297, 2016, 567, 28906, 486, 13253, 13717, 1005, 285, 31488, 1423, 286, 2060, 10714, 33673, 310, 220, 16, 21, 15, 345, 310, 95366, 28906, 486, 36018, 341, 394, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_search_coalesce_2() { let mut v = vec![(0, 1), (2, 3), (4, 5), (6, 7)]; assert_eq!(3, v.search_coalesce(1, (5, 6))); assert_eq!(v, [(0, 1), (2, 3), (4, 7)]); }
rust_cleaned_test_functions.jsonl/57411
{ "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, 10716, 11393, 73250, 62, 17, 368, 341, 262, 1077, 5206, 348, 284, 7486, 0, 9697, 15, 11, 220, 16, 701, 320, 17, 11, 220, 18, 701, 320, 19, 11, 220, 20, 701, 320, 21, 11, 220, 22, 12587, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_third_max() { let test_cases = vec![ (vec![1,2,2,5,3,5], 2), ]; for (nums, expect) in test_cases { assert_eq!(expect, Solution::third_max(nums.clone()), "nums: {:?}", nums); } }
rust_cleaned_test_functions.jsonl/37449
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 151 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79519, 6345, 368, 341, 286, 1077, 1273, 41427, 284, 7486, 90515, 310, 320, 4083, 20703, 16, 11, 17, 11, 17, 11, 20, 11, 18, 11, 20, 1125, 220, 17, 1326, 286, 9747, 286, 369, 320, 26350, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_barret_reduction() { let q = 18014398492704769; let ratio = (17592185012223u64, 1024u64); let a: (u64, u64) = (1, 0); let b = Scalar::_barret_reduce(a, ratio, q); assert_eq!(b, 1); let a: (u64, u64) = (q, 0); let b = Scalar::_barret_reduce(a, ratio, q); assert_eq!(b, 0); let a: (u64, u64) = (0, 1); let b = Scalar::_barret_reduce(a, ratio, q); assert_eq!(b, 17179868160); }
rust_cleaned_test_functions.jsonl/1934
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 278 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14388, 2122, 74289, 368, 341, 286, 1077, 2804, 284, 220, 16, 23, 15, 16, 19, 18, 24, 23, 19, 24, 17, 22, 15, 19, 22, 21, 24, 280, 286, 1077, 11341, 284, 320, 16, 22, 20, 24, 17, 16, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_verify_op_complex_nested() { let filter = filter(); let mut op = Operator::And(vec![ Operator::And(vec![ Operator::Or(vec![ Operator::Eq(schema_name_tag(), unencrypted_target("Not Here".to_string())), Operator::Eq(issuer_did_tag(), unencrypted_target("Not Here".to_string())) ]), Operator::Eq(schema_id_tag(), unencrypted_target(SCHEMA_ID.to_string())), Operator::Eq(cred_def_id_tag(), unencrypted_target(CRED_DEF_ID.to_string())) ]), Operator::And(vec![ Operator::Eq(schema_issuer_did_tag(), unencrypted_target(SCHEMA_ISSUER_DID.to_string())), Operator::Eq(schema_name_tag(), unencrypted_target(SCHEMA_NAME.to_string())) ]), Operator::And(vec![ Operator::Eq(schema_version_tag(), unencrypted_target(SCHEMA_VERSION.to_string())), Operator::Eq(issuer_did_tag(), unencrypted_target(ISSUER_DID.to_string())) ]), ]); assert!(Verifier::_process_operator("zip", &op, &filter).is_err()); op = Operator::And(vec![ Operator::And(vec![ Operator::Or(vec![ Operator::Eq(schema_name_tag(), unencrypted_target(SCHEMA_NAME.to_string())), Operator::Eq(issuer_did_tag(), unencrypted_target("Not Here".to_string())) ]), Operator::Eq(schema_id_tag(), unencrypted_target(SCHEMA_ID.to_string())), Operator::Eq(cred_def_id_tag(), unencrypted_target(CRED_DEF_ID.to_string())) ]), Operator::And(vec![ Operator::Eq(schema_issuer_did_tag(), unencrypted_target(SCHEMA_ISSUER_DID.to_string())), Operator::Eq(schema_name_tag(), unencrypted_target(SCHEMA_NAME.to_string())) ]), Operator::And(vec![ Operator::Eq(schema_version_tag(), unencrypted_target(SCHEMA_VERSION.to_string())), Operator::Eq(issuer_did_tag(), unencrypted_target(ISSUER_DID.to_string())) ]), Operator::Not(Box::new(Operator::Eq(schema_version_tag(), unencrypted_target("NOT HERE".to_string())))) ]); Verifier::_process_operator("zip", &op, &filter).unwrap(); op = Operator::And(vec![ Operator::And(vec![ Operator::Or(vec![ Operator::Eq(schema_name_tag(), unencrypted_target(SCHEMA_NAME.to_string())), Operator::Eq(issuer_did_tag(), unencrypted_target("Not Here".to_string())) ]), Operator::Eq(schema_id_tag(), unencrypted_target(SCHEMA_ID.to_string())), Operator::Eq(cred_def_id_tag(), unencrypted_target(CRED_DEF_ID.to_string())) ]), Operator::And(vec![ Operator::Eq(schema_issuer_did_tag(), unencrypted_target(SCHEMA_ISSUER_DID.to_string())), Operator::Eq(schema_name_tag(), unencrypted_target(SCHEMA_NAME.to_string())) ]), Operator::And(vec![ Operator::Eq(schema_version_tag(), unencrypted_target(SCHEMA_VERSION.to_string())), Operator::Eq(issuer_did_tag(), unencrypted_target(ISSUER_DID.to_string())) ]), Operator::Not(Box::new(Operator::Eq(schema_version_tag(), unencrypted_target(SCHEMA_VERSION.to_string())))) ]); assert!(Verifier::_process_operator("zip", &op, &filter).is_err()); }
rust_cleaned_test_functions.jsonl/71873
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1834 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35638, 10287, 41522, 66279, 368, 341, 286, 1077, 4051, 284, 4051, 543, 286, 1077, 5206, 1179, 284, 28498, 486, 3036, 25592, 90515, 310, 28498, 486, 3036, 25592, 90515, 394, 28498, 486, 2195, 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_create_tx_empty_recipients() { let (wallet, _, _) = get_funded_wallet(get_test_wpkh()); wallet .create_tx(TxBuilder::with_recipients(vec![])) .unwrap(); }
rust_cleaned_test_functions.jsonl/11307
{ "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, 8657, 17805, 15124, 7080, 47647, 368, 341, 286, 1077, 320, 35735, 11, 8358, 27439, 284, 633, 761, 36053, 62308, 5433, 4452, 1670, 20819, 71, 1423, 286, 15085, 198, 310, 659, 3182, 17805, 4140, 87,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_char_formatter() -> SimpleResult<()> { let tests = vec![ // character single_quotes replacement_policy unprintable_option expected // Test single quotes on/off ( 'a', false, CharacterReplacementPolicy::ReplaceControl, CharacterUnprintableOption::UnicodeReplacementCharacter, "a" ), ( 'a', true, CharacterReplacementPolicy::ReplaceControl, CharacterUnprintableOption::UnicodeReplacementCharacter, "'a'"), // Test ReplaceNonAscii ( '💣', false, CharacterReplacementPolicy::ReplaceControl, CharacterUnprintableOption::UnicodeReplacementCharacter, "💣"), ( '💣', false, CharacterReplacementPolicy::ReplaceNonAscii, CharacterUnprintableOption::UnicodeReplacementCharacter, "�" ), ( '\n', false, CharacterReplacementPolicy::ReplaceNonAscii, CharacterUnprintableOption::UnicodeReplacementCharacter, "�" ), ( '~', false, CharacterReplacementPolicy::ReplaceNonAscii, CharacterUnprintableOption::UnicodeReplacementCharacter, "~" ), // Test ReplaceEverything ( 'a', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::UnicodeReplacementCharacter, "�" ), ( '\n', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::UnicodeReplacementCharacter, "�" ), ( '💣', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::UnicodeReplacementCharacter, "�" ), // Test ReplaceControl false, CharacterReplacementPolicy::ReplaceControl, CharacterUnprintableOption::UnicodeReplacementCharacter, "a" ), ( '\n', false, CharacterReplacementPolicy::ReplaceControl, CharacterUnprintableOption::UnicodeReplacementCharacter, "�" ), ( '\x7e', false, CharacterReplacementPolicy::ReplaceControl, CharacterUnprintableOption::UnicodeReplacementCharacter, "~" ), ( '\x7f', false, CharacterReplacementPolicy::ReplaceControl, CharacterUnprintableOption::UnicodeReplacementCharacter, "�" ), ( '💣', false, CharacterReplacementPolicy::ReplaceControl, CharacterUnprintableOption::UnicodeReplacementCharacter, "💣" ), // Test HexEncode ( , CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::HexEncode, "\\x61" ), ( '\n', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::HexEncode, "\\x0a" ), ( '💣', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::HexEncode, "\\xf0\\x9f\\x92\\xa3" ), // Test UrlEncode ( 'a CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::URLEncode, "%61" ), ( '\n', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::URLEncode, "%0a" ), ( '💣', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::URLEncode, "%f0%9f%92%a3" ), ( ' ', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::URLEncode, "+" ), ( '%', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::URLEncode, "%25" ), // Test CString ( 'a', CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::CString, "\\x61" ), ( '\n', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::CString, "\\n" ), ( '💣', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::CString, "\\xf0\\x9f\\x92\\xa3" ), ( ' ', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::CString, "\\x20" ), ( '%', false, CharacterReplacementPolicy::ReplaceEverything, CharacterUnprintableOption::CString, "\\x25" ), ]; for (c, show_quotes, replacement_policy, unprintable, expected) in tests { let number = Character::from((c, 1)); // (the size doesn't matter here) assert_eq!( expected, CharacterFormatter::new_character(show_quotes, replacement_policy, unprintable).render(number), ); } Ok(()) }
rust_cleaned_test_functions.jsonl/116382
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2082 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9232, 73965, 368, 1464, 8993, 2077, 71698, 341, 286, 1077, 7032, 284, 7486, 90515, 310, 442, 3668, 220, 3175, 75637, 256, 13723, 22773, 5968, 650, 1350, 480, 9672, 10503, 3601, 271, 310, 442, 3393...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_set_storage_offset_value_too_large() { let too_big = 1 << 56; let mut index = IndexEntry::new(Pubkey::new_unique()); index.set_storage_offset(too_big); }
rust_cleaned_test_functions.jsonl/61657
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 93 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 23310, 6917, 3142, 2346, 78, 45228, 368, 341, 286, 1077, 2238, 36386, 284, 220, 16, 1115, 220, 20, 21, 280, 286, 1077, 5206, 1922, 284, 8008, 5874, 486, 931, 5304, 392, 792, 486, 931, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_dictionary_order2() { new_ucmd!() .pipe_in("a👦🏻aa\tb\naaaa\tb") // spell-checker:disable-line .arg("-d") .succeeds() .stdout_only("a👦🏻aa\tb\naaaa\tb\n"); // spell-checker:disable-line }
rust_cleaned_test_functions.jsonl/20480
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 142 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42605, 7869, 17, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 13768, 1243, 445, 64, 145988, 144321, 5305, 4955, 65, 1699, 28458, 4955, 65, 899, 442, 12845, 15934, 261, 42066, 8447, 198, 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_non_cacheable_debug() { let non_cacheable = CachePolicyNonCacheable { result: 42 }; assert_eq!(format!("{:?}", non_cacheable), "CachePolicyNonCacheable"); }
rust_cleaned_test_functions.jsonl/130407
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 73 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21637, 11529, 480, 15446, 368, 341, 262, 1077, 2477, 11529, 480, 284, 19479, 13825, 8121, 8233, 480, 314, 1102, 25, 220, 19, 17, 2605, 262, 2060, 10714, 10297, 2243, 88928, 25, 52652, 2477, 11529,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_debug_pollopt() { assert_eq!("(empty)", format!("{:?}", PollOpt::empty())); assert_eq!("Edge-Triggered", format!("{:?}", PollOpt::edge())); assert_eq!("Level-Triggered", format!("{:?}", PollOpt::level())); assert_eq!("OneShot", format!("{:?}", PollOpt::oneshot())); }
rust_cleaned_test_functions.jsonl/132734
{ "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, 15446, 620, 27961, 417, 368, 341, 262, 2060, 10714, 17223, 7, 3194, 11583, 3561, 88928, 25, 52652, 24385, 21367, 486, 3194, 7392, 262, 2060, 10714, 17223, 11656, 12, 17939, 291, 497, 3561, 88928, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_assembler_future_labels() { test_case(&["SET A, future", ":future", "SET B, 0"], &[0x7c01, 0x0002, 0x8421]); test_case(&["SET A, future", "SET B, future", ":future", "SET B, 0"], &[0x7c01, 0x0004, 0x7c21, 0x0004, 0x8421]); }
rust_cleaned_test_functions.jsonl/44778
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 247 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11898, 35401, 59740, 14547, 368, 341, 262, 1273, 19096, 2099, 1183, 5884, 362, 11, 3853, 756, 1698, 13022, 21055, 756, 1698, 330, 5884, 425, 11, 220, 15, 8097, 394, 44590, 15, 87, 22, 66, 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_should_calculate_implicit_padding_per_free_argument() { new_ucmd!() .args(&["--from=auto", " 1Ki", " 2K"]) .pipe_in(" 1Ki\n 2K") .run() .stdout_is(" 1024\n 2000\n"); }
rust_cleaned_test_functions.jsonl/46012
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 148 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43378, 24005, 11207, 62, 30940, 40726, 5678, 8905, 9025, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 313, 1499, 28, 3902, 497, 330, 256, 220, 16, 72572, 497, 330, 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_negative_adjustment() { // such attempting to set a negative niceness value will be rejected by // correctly. let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); assert!(res .stderr_str() .starts_with("nice: warning: setpriority: Permission denied")); // spell-checker:disable-line }
rust_cleaned_test_functions.jsonl/15164
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 143 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53865, 44153, 478, 368, 341, 1066, 262, 442, 1741, 19405, 311, 738, 264, 8225, 17327, 23709, 897, 686, 387, 17551, 553, 7213, 262, 442, 12440, 382, 262, 1077, 592, 284, 501, 68887, 2277, 0, 1005...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_assert_expand() { check_expansion( r#" #[rustc_builtin_macro] macro_rules! assert { ($cond:expr) => ({ /* compiler built-in */ }); ($cond:expr, $($args:tt)*) => ({ /* compiler built-in */ }) } assert!(true, "{} {:?}", arg1(a, b, c), arg2); "#, expect![["{{(&(true), &(\"{} {:?}\"), &(arg1(a,b,c)), &(arg2),);}}"]], ); }
rust_cleaned_test_functions.jsonl/112674
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 283 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16553, 67875, 368, 341, 286, 1779, 14214, 10501, 1006, 310, 435, 2, 698, 310, 11506, 35788, 66, 73829, 58810, 921, 310, 18072, 21407, 0, 2060, 341, 394, 1711, 1297, 96011, 8, 589, 9469, 1391, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_address_validator_internal() { let (mut wallet, descriptors, _) = get_funded_wallet(get_test_wpkh()); wallet.add_address_validator(Arc::new(Box::new(TestValidator))); let addr = testutils!(@external descriptors, 10); wallet .create_tx(TxBuilder::with_recipients(vec![( addr.script_pubkey(), 25_000, )])) .unwrap(); }
rust_cleaned_test_functions.jsonl/89819
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 223 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6744, 64959, 23472, 368, 341, 286, 1077, 320, 6984, 15085, 11, 47517, 11, 27439, 284, 633, 761, 36053, 62308, 5433, 4452, 1670, 20819, 71, 1423, 286, 15085, 1364, 6744, 64959, 4346, 1287, 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_percent_settings() { let (_td, cd, cp) = test_prolog(); let conf = load_config!( cp, "[cache]\n\ enabled = true\n\ directory = {cache_dir}\n\ file-count-limit-percent-if-deleting = '62%'\n\ files-total-size-limit-percent-if-deleting = '23 %'", cd ); assert!(conf.enabled()); assert!(conf.errors.is_empty()); assert_eq!(conf.file_count_limit_percent_if_deleting(), 62); assert_eq!(conf.files_total_size_limit_percent_if_deleting(), 23); // different errors let conf = load_config!( cp, "[cache]\n\ enabled = true\n\ directory = {cache_dir}\n\ files-total-size-limit-percent-if-deleting = '23'", cd ); assert!(!conf.enabled()); assert!(!conf.errors.is_empty()); let conf = load_config!( cp, "[cache]\n\ enabled = true\n\ directory = {cache_dir}\n\ files-total-size-limit-percent-if-deleting = '22.5%'", cd ); assert!(!conf.enabled()); assert!(!conf.errors.is_empty()); let conf = load_config!( cp, "[cache]\n\ enabled = true\n\ directory = {cache_dir}\n\ files-total-size-limit-percent-if-deleting = '0.5'", cd ); assert!(!conf.enabled()); assert!(!conf.errors.is_empty()); let conf = load_config!( cp, "[cache]\n\ enabled = true\n\ directory = {cache_dir}\n\ files-total-size-limit-percent-if-deleting = '-1%'", cd ); assert!(!conf.enabled()); assert!(!conf.errors.is_empty()); let conf = load_config!( cp, "[cache]\n\ enabled = true\n\ directory = {cache_dir}\n\ files-total-size-limit-percent-if-deleting = '101%'", cd ); assert!(!conf.enabled()); assert!(!conf.errors.is_empty()); }
rust_cleaned_test_functions.jsonl/48299
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 979 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29883, 10853, 368, 341, 262, 1077, 5453, 1296, 11, 15307, 11, 12490, 8, 284, 1273, 2540, 839, 543, 262, 1077, 2335, 284, 2795, 5332, 33673, 286, 12490, 345, 286, 10545, 9360, 17960, 77, 5661, 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_create_get_actor() { with_actor_system(|system| { let actor_ref = TestActor::new().start(); let system_actor_ref = system.get_actor::<TestActor>(&actor_ref.id()); assert!(system_actor_ref.is_some()); assert_eq!(system_actor_ref.unwrap().id(), actor_ref.id()); }) }
rust_cleaned_test_functions.jsonl/73677
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 145 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 3062, 54818, 368, 341, 262, 448, 54818, 17687, 22428, 8948, 91, 341, 286, 1077, 12089, 7793, 284, 3393, 18870, 486, 931, 1005, 2468, 543, 286, 1077, 1849, 54818, 7793, 284, 1849, 670, 54818,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_failure_fail() { let res = CmdResult { tmpd: None, code: None, success: true, stdout: "".into(), stderr: "".into(), }; res.failure(); }
rust_cleaned_test_functions.jsonl/74678
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 150 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43618, 22121, 368, 341, 286, 1077, 592, 284, 40210, 2077, 341, 310, 4174, 67, 25, 2240, 345, 310, 2038, 25, 2240, 345, 310, 2393, 25, 830, 345, 310, 20075, 25, 44907, 18122, 3148, 310, 26436, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_pack_bit2dword() { let mut src = [SLMPDeviceData::<bool> { dev: SLMPDevice { d_code: SLMPDeviceCode::M, addr: 1111, }, value: true, }; 32]; let buf = [ true, false, true, false, true, true, true, false, false, false, true, false, false, false, false, false, true, false, true, false, false, true, false, false, false, false, true, false, false, false, false, false, ]; for i in 0..32 { src[i].value = buf[i]; src[i].dev.addr = 1111 + i as u32; } let ret = pack_bit2dword(&src); assert_eq!( ret.dev, SLMPDevice { d_code: SLMPDeviceCode::M, addr: 1111 } ); assert_eq!(ret.value, 0x04250475); }
rust_cleaned_test_functions.jsonl/62522
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 517 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32995, 13996, 17, 67, 1158, 368, 341, 286, 1077, 5206, 2286, 284, 508, 7984, 5781, 6985, 1043, 27638, 2641, 29, 341, 310, 3483, 25, 16797, 5781, 6985, 341, 394, 294, 4136, 25, 16797, 5781, 6985,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_for_loop_first() { let template = compile("{{ for a in array }}{{if @first }}{ @index }{{ endif }}{{ endfor }}"); let context = context(); let template_registry = other_templates(); let formatter_registry = formatters(); let string = template .render(&context, &template_registry, &formatter_registry) .unwrap(); assert_eq!("0", &string); }
rust_cleaned_test_functions.jsonl/2385
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 212 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5478, 17198, 12978, 368, 972, 286, 1077, 3811, 32203, 310, 19192, 445, 2979, 369, 264, 304, 1334, 3869, 2979, 333, 569, 3896, 3869, 90, 569, 1252, 335, 2979, 12330, 3869, 2979, 835, 1958, 3869, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_iter_mixed() { let size = 10000; // Forwards let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect(); fn test<T>(size: usize, mut iter: T) where T: Iterator<Item = (usize, usize)> + DoubleEndedIterator { for i in 0..size / 4 { assert_eq!(iter.size_hint(), (size - i * 2, Some(size - i * 2))); assert_eq!(iter.next().unwrap(), (i, i)); assert_eq!(iter.next_back().unwrap(), (size - i - 1, size - i - 1)); } for i in size / 4..size * 3 / 4 { assert_eq!(iter.size_hint(), (size * 3 / 4 - i, Some(size * 3 / 4 - i))); assert_eq!(iter.next().unwrap(), (i, i)); } assert_eq!(iter.size_hint(), (0, Some(0))); assert_eq!(iter.next(), None); } test(size, map.iter().map(|(&k, &v)| (k, v))); test(size, map.iter_mut().map(|(&k, &mut v)| (k, v))); test(size, map.into_iter()); }
rust_cleaned_test_functions.jsonl/49380
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 485 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11723, 717, 3286, 368, 341, 262, 1077, 1379, 284, 220, 16, 15, 15, 15, 15, 401, 262, 442, 1752, 4014, 198, 262, 1077, 5206, 2415, 25, 425, 6533, 2227, 27, 6878, 716, 29, 284, 320, 15, 496, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_query_matches_with_negated_fields() { allocations::record(|| { let language = get_language("javascript"); let query = Query::new( language, " (import_specifier !alias name: (identifier) @import_name) (export_specifier !alias name: (identifier) @export_name) (export_statement !decorator !source (_) @exported) ; This negated field list is an extension of a previous ; negated field list. The order of the children and negated ; fields doesn't matter. (export_statement !decorator !source (_) @exported_expr !declaration) ; This negated field list is a prefix of a previous ; negated field list. (export_statement !decorator (_) @export_child .) ", ) .unwrap(); assert_query_matches( language, &query, " import {a as b, c} from 'p1'; export {g, h as i} from 'p2'; @foo export default 1; export var j = 1; export default k; ", &[ (0, vec![("import_name", "c")]), (1, vec![("export_name", "g")]), (4, vec![("export_child", "'p2'")]), (2, vec![("exported", "var j = 1;")]), (4, vec![("export_child", "var j = 1;")]), (2, vec![("exported", "k")]), (3, vec![("exported_expr", "k")]), (4, vec![("export_child", "k")]), ], ); }); }
rust_cleaned_test_functions.jsonl/77424
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1080 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5738, 38344, 6615, 28209, 657, 12132, 368, 341, 262, 69642, 486, 8548, 79453, 341, 286, 1077, 4128, 284, 633, 29021, 445, 14073, 797, 286, 1077, 3239, 284, 11361, 486, 931, 1006, 310, 4128, 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...
2
#[test] fn test_add_session_different_connection_transient_then_persistent() { let mut broker = BrokerBuilder::default().with_authorizer(AllowAll).build(); let id = "id1".to_string(); let client_id = ClientId::from(id.clone()); let connect1 = transient_connect(id.clone()); let connect2 = persistent_connect(id); let handle1 = connection_handle(); let handle2 = connection_handle(); let auth1 = AuthId::Identity("auth_id1".into()); let auth2 = AuthId::Identity("auth_id2".into()); let expected_client_info1 = ClientInfo::new(client_id.clone(), peer_addr(), auth1.clone()); let expected_client_info2 = ClientInfo::new(client_id.clone(), peer_addr(), auth2.clone()); let req1 = ConnReq::new( client_id.clone(), peer_addr(), connect1, Auth::Identity(auth1.clone()), handle1, ); broker.open_session(auth1, req1).unwrap(); assert_eq!(1, broker.sessions.len()); assert_eq!( *broker.sessions[&client_id].client_info(), expected_client_info1 ); let req2 = ConnReq::new( client_id.clone(), peer_addr(), connect2, Auth::Identity(auth2.clone()), handle2, ); let result = broker.open_session(auth2, req2); assert_matches!(result, Ok(OpenSession::DuplicateSession(_, _))); assert_matches!(broker.sessions[&client_id], Session::Persistent(_)); assert_eq!(1, broker.sessions.len()); assert_eq!( *broker.sessions[&client_id].client_info(), expected_client_info2 ); }
rust_cleaned_test_functions.jsonl/105414
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 812 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 12316, 82741, 15866, 97758, 68367, 620, 13931, 368, 341, 286, 1077, 5206, 22316, 284, 52701, 3297, 486, 2258, 1005, 4197, 22938, 3135, 7, 18605, 2403, 568, 5834, 1428, 286, 1077, 877, 284, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_nested_rule() -> TestResult { let mut p = Polar::new(); p.load_str( r#"f(x) if g(x); g(x) if h(x); h(2); g(x) if j(x); j(4);"#, )?; qeval(&mut p, "f(2)"); qnull(&mut p, "f(3)"); qeval(&mut p, "f(4)"); qeval(&mut p, "j(4)"); Ok(()) }
rust_cleaned_test_functions.jsonl/97609
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 218 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66279, 21124, 368, 1464, 3393, 2077, 341, 262, 1077, 5206, 281, 284, 55896, 486, 931, 543, 262, 281, 5104, 2895, 1006, 286, 435, 55543, 69, 2075, 8, 421, 342, 2075, 317, 1843, 342, 2075, 8, 42...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_chain_get_ancestor() { let (chain_controller, shared, parent) = start_chain(None); let final_number = 20; let mut mock_store = MockStore::new(&parent, shared.store()); let mut chain1 = MockChain::new(parent.clone(), shared.consensus()); let mut chain2 = MockChain::new(parent.clone(), shared.consensus()); for _ in 1..final_number { chain1.gen_empty_block(100u64, &mut mock_store); } for _ in 1..final_number { chain2.gen_empty_block(90u64, &mut mock_store); } for block in chain1.blocks() { chain_controller .process_block(Arc::new(block.clone()), false) .expect("process block ok"); } for block in chain2.blocks() { chain_controller .process_block(Arc::new(block.clone()), false) .expect("process block ok"); } assert!(chain1.tip_header().hash() != chain2.tip_header().hash()); assert_eq!( *chain1.blocks()[9].header(), shared .store() .get_ancestor(&chain1.tip_header().hash(), 10) .unwrap() ); assert_eq!( *chain2.blocks()[9].header(), shared .store() .get_ancestor(&chain2.tip_header().hash(), 10) .unwrap() ); }
rust_cleaned_test_functions.jsonl/84798
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 600 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30583, 3062, 62, 66878, 368, 341, 262, 1077, 320, 8819, 21600, 11, 6094, 11, 2681, 8, 284, 1191, 30583, 26717, 317, 262, 1077, 1590, 5500, 284, 220, 17, 15, 401, 262, 1077, 5206, 7860, 14809, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_node() { let routing_table = RoutingTable::default(); let mut writer: Box<dyn RoutingTableWriter> = Box::new(routing_table.clone()); let reader: Box<dyn RoutingTableReader> = Box::new(routing_table.clone()); let node0 = CircuitNode { node_id: "node-0".to_string(), endpoints: vec!["endpoint_0".to_string()], }; let node1 = CircuitNode { node_id: "node-1".to_string(), endpoints: vec!["endpoint_1".to_string()], }; let mut expected_nodes = BTreeMap::new(); expected_nodes.insert(node0.node_id.clone(), node0.clone()); // add node to the routing table writer .add_node(node0.node_id.clone(), node0.clone()) .expect("Unable to add node"); assert_eq!(routing_table.state.read().unwrap().nodes, expected_nodes); // remove node from the routing table writer .remove_node(&node0.node_id) .expect("Unable to remove node"); assert!(routing_table.state.read().unwrap().nodes.is_empty()); // add multiple nodes to the routing table writer .add_nodes(vec![node0.clone(), node1.clone()]) .expect("Unable to add nodes"); expected_nodes.insert(node1.node_id.clone(), node1.clone()); assert_eq!(routing_table.state.read().unwrap().nodes, expected_nodes); // get a node from the routing table let fetched_node = reader .get_node(&node0.node_id.clone()) .expect("Unable to get node"); assert_eq!(fetched_node, Some(node0.clone())); // list all nodes in the routing table let fetched_node_list = reader.list_nodes().expect("Unable to list nodes"); assert_eq!( fetched_node_list.collect::<BTreeMap<String, CircuitNode>>(), expected_nodes ); }
rust_cleaned_test_functions.jsonl/60133
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 883 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5084, 368, 341, 286, 1077, 29058, 5237, 284, 65707, 2556, 486, 2258, 543, 286, 1077, 5206, 6916, 25, 8261, 92846, 65707, 2556, 6492, 29, 284, 8261, 486, 931, 2601, 10909, 5237, 15997, 1423, 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_bar_slots() { // simple case 1:1 between points and slots let slots = 4; let total = 4; assert_eq!((0, 4), bar_slots(slots, total, 0)); assert_eq!((1, 3), bar_slots(slots, total, 1)); assert_eq!((2, 2), bar_slots(slots, total, 2)); assert_eq!((3, 1), bar_slots(slots, total, 3)); assert_eq!((4, 0), bar_slots(slots, total, 4)); let total = 10; assert_eq!((0, 4), bar_slots(slots, total, 0)); assert_eq!((1, 3), bar_slots(slots, total, 1)); assert_eq!((1, 3), bar_slots(slots, total, 2)); assert_eq!((2, 2), bar_slots(slots, total, 3)); assert_eq!((2, 2), bar_slots(slots, total, 4)); assert_eq!((2, 2), bar_slots(slots, total, 5)); assert_eq!((3, 1), bar_slots(slots, total, 6)); assert_eq!((3, 1), bar_slots(slots, total, 7)); assert_eq!((4, 0), bar_slots(slots, total, 8)); assert_eq!((4, 0), bar_slots(slots, total, 9)); assert_eq!((4, 0), bar_slots(slots, total, 10)); }
rust_cleaned_test_functions.jsonl/101677
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 555 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14388, 54161, 368, 341, 286, 442, 4285, 1142, 220, 16, 25, 16, 1948, 3501, 323, 15711, 198, 286, 1077, 15711, 284, 220, 19, 280, 286, 1077, 2790, 284, 220, 19, 280, 286, 2060, 10714, 0, 1188, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_request_bytes_error() { // Test unsupported HTTP version. let request_bytes = b"GET http://169.254.169.255/ HTTP/2.0\r\n\r\n"; let mut expected_response = Response::new(Version::Http11, StatusCode::NotImplemented); expected_response.set_body(Body::new("Unsupported HTTP version.".to_string())); let actual_response = parse_request_bytes(request_bytes, mock_callback); assert_eq!(actual_response, expected_response); let request_bytes = b"GET HTTP/1.0\r\n\r\n"; let mut expected_response = Response::new(Version::Http11, StatusCode::BadRequest); expected_response.set_body(Body::new("Empty URI not allowed.".to_string())); let actual_response = parse_request_bytes(request_bytes, mock_callback); assert_eq!(actual_response, expected_response); // Test invalid HTTP methods. let invalid_methods = ["POST", "HEAD", "DELETE", "CONNECT", "OPTIONS", "TRACE"]; for method in invalid_methods.iter() { let request_bytes = format!("{} http://169.254.169.255/ HTTP/1.0\r\n\r\n", method); let mut expected_response = Response::new(Version::Http11, StatusCode::NotImplemented); expected_response.set_body(Body::new("Unsupported HTTP method.".to_string())); let actual_response = parse_request_bytes(request_bytes.as_bytes(), mock_callback); assert_eq!(actual_response, expected_response); } // Test valid methods. let valid_methods = ["PUT", "PATCH", "GET"]; for method in valid_methods.iter() { let request_bytes = format!("{} http://169.254.169.255/ HTTP/1.0\r\n\r\n", method); let expected_response = Response::new(Version::Http11, StatusCode::OK); let actual_response = parse_request_bytes(request_bytes.as_bytes(), mock_callback); assert_eq!(actual_response, expected_response); } // Test invalid HTTP format. let request_bytes = b"GET / HTTP/1.1\r\n"; let mut expected_response = Response::new(Version::Http11, StatusCode::BadRequest); expected_response.set_body(Body::new("Invalid request.".to_string())); let actual_response = parse_request_bytes(request_bytes, mock_callback); assert_eq!(actual_response, expected_response); // Test invalid HTTP headers. let request_bytes = b"PATCH http://localhost/home HTTP/1.1\r\n\ Expect: 100-continue\r\n\ Transfer-Encoding: identity; q=0\r\n\ Content-Length: 26\r\n\r\nthis is not\n\r\na json \nbody"; let mut expected_response = Response::new(Version::Http11, StatusCode::BadRequest); expected_response.set_body(Body::new("Invalid headers.".to_string())); let actual_response = parse_request_bytes(request_bytes, mock_callback); assert_eq!(actual_response, expected_response); }
rust_cleaned_test_functions.jsonl/54507
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1255 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 7893, 12524, 4096, 368, 341, 286, 442, 3393, 40409, 10130, 2319, 624, 286, 1077, 1681, 12524, 284, 293, 1, 3806, 1758, 1110, 16, 21, 24, 13, 17, 20, 19, 13, 16, 21, 24, 13, 17, 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...
3
#[test] fn test_per() { init(); let input = "/2".chars().collect::<Vec<_>>(); let _result = asterisk_per(min_digit()) - end(); let result = (per(min_digit()) - end()).parse(&input).to_result().unwrap(); assert_eq!(result, ValueExpr(2)); }
rust_cleaned_test_functions.jsonl/106892
{ "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, 5678, 368, 341, 262, 2930, 543, 262, 1077, 1946, 284, 3521, 17, 3263, 19255, 1005, 17384, 27638, 10050, 32399, 37038, 262, 1077, 716, 1382, 284, 33937, 3187, 5678, 14146, 48403, 2140, 481, 835, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_trades() { let text = BitstampRestClient::fetch_trades("btcusd", Some("minute".to_string())).unwrap(); assert!(text.starts_with("[{")); }
rust_cleaned_test_functions.jsonl/60204
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 72 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3547, 3452, 368, 341, 262, 1077, 1467, 284, 6495, 49113, 12416, 2959, 486, 9641, 3547, 3452, 445, 92634, 355, 67, 497, 4329, 445, 42557, 3263, 983, 3904, 34670, 15454, 543, 262, 2060, 10297, 1318,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_title_within_content() { let documents = load_document("../tests/Gossiping_M.1173456473.A.F4F.html"); assert_eq!( parse_title(&documents).unwrap(), (None, "Re: 有沒有俄國人的八卦?".to_owned()) ); }
rust_cleaned_test_functions.jsonl/87144
{ "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, 21039, 6112, 72385, 7495, 368, 341, 286, 1077, 9293, 284, 2795, 26231, 17409, 23841, 15792, 41473, 287, 1245, 13, 16, 16, 22, 18, 19, 20, 21, 19, 22, 18, 875, 991, 19, 37, 2564, 797, 286, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_none_or_up_to_none_zero() { let occurence: Occurences<u32> = Occurences::NoneOrUpTo(None); occurence.check_count(0).unwrap(); }
rust_cleaned_test_functions.jsonl/4441
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 85 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31488, 8734, 8237, 2346, 31488, 19359, 368, 341, 286, 1077, 2983, 86937, 25, 19927, 552, 98162, 34837, 18, 17, 29, 284, 19927, 552, 98162, 486, 4064, 2195, 2324, 1249, 26717, 317, 286, 2983, 86937...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_min_max_ip() { crate::init().unwrap(); assert_eq!( Some(ip!("10.0.0.1")), min_ip(ip!("10.0.0.2"), ip!("10.0.0.1")) ); assert_eq!( Some(ip!("10.0.0.2")), max_ip(ip!("10.0.0.2"), ip!("10.0.0.1")) ); assert_eq!(None, min_ip(ip!("10.0.0.1"), ip!("::1"))); assert_eq!(None, max_ip(ip!("10.0.0.1"), ip!("::1"))); }
rust_cleaned_test_functions.jsonl/49220
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 242 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7260, 6345, 10385, 368, 341, 262, 17717, 486, 2327, 1005, 15454, 1428, 262, 2060, 10714, 33673, 286, 4329, 23443, 17223, 16, 15, 13, 15, 13, 15, 13, 16, 30154, 286, 1308, 10385, 23443, 17223, 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_correct_type_references() { let expected = [ "smithy.example#MyStructure member e\'s type (foo.baz#MyString) cannot be resolved to a shape in this model.", "The simple shape (smithy.example#MyString) is simply a synonym, did you mean to add any constraint traits?", "The simple shape (smithy.example#MyBoolean) is simply a synonym, did you mean to add any constraint traits?", ]; let model: Model = make_model(); let result = run_validation_actions( &mut [Box::new(CorrectTypeReferences::default())], &model, false, ); assert!(result.is_ok()); let actual = result.unwrap(); println!("{:#?}", actual); assert_eq!(actual.len(), expected.len()); let actual: Vec<String> = actual .iter() .map(|issue| issue.message()) .cloned() .collect(); println!("{:#?}", actual); for message in &expected { assert!(actual.contains(&message.to_string())); } }
rust_cleaned_test_functions.jsonl/81836
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 399 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31550, 1819, 92702, 368, 341, 262, 1077, 3601, 284, 2278, 286, 330, 33017, 88, 7724, 2, 5050, 22952, 4462, 384, 10169, 82, 943, 320, 7975, 948, 1370, 2, 5050, 703, 8, 4157, 387, 19673, 311, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_input_is_empty() { let input = untrusted::Input::from(b""); assert!(input.is_empty()); let input = untrusted::Input::from(b"foo"); assert!(!input.is_empty()); }
rust_cleaned_test_functions.jsonl/27447
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 87 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5898, 6892, 15124, 368, 341, 262, 1077, 1946, 284, 650, 83837, 486, 2505, 486, 1499, 1883, 1, 797, 262, 2060, 10297, 1355, 2079, 15124, 1423, 262, 1077, 1946, 284, 650, 83837, 486, 2505, 486, 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
#[test] fn test_diff_props() { let a = prop!({"a": "old"}); let b = prop!({"a": "new"}); assert_eq!(diff_props(&a, &b), prop!({"a": "new"})); assert_eq!(diff_props(&a, &a), prop!(null)); let a = prop!({ "a": { "a": [] } }); let b = prop!({ "a": { "a": [1, 2] } }); assert_eq!(diff_props(&a, &b), prop!({ "a": { "a": [1, 2] } })); let a = prop!({ "a": 0, "b": 1 }); let b = prop!({ "a": 0 }); assert_eq!(diff_props(&a, &b), prop!({ "b": null })); assert_eq!(diff_props(&b, &a), prop!({ "b": 1 })); }
rust_cleaned_test_functions.jsonl/42666
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 281 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15850, 44835, 368, 341, 262, 1077, 264, 284, 2004, 0, 16864, 64, 788, 330, 813, 27316, 262, 1077, 293, 284, 2004, 0, 16864, 64, 788, 330, 931, 27316, 262, 2060, 10714, 10297, 13490, 44835, 2099,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_push_on_edge() { let mut x = BitVec::with_capacity(0); let mut base = 0; for _ in 0..8 { for i in 0..256 { for bit in 0..8 { x.push(i & (1 << bit) != 0); } for bit in 0..8 { assert_eq!(x.get(base + i * 8 + bit), i & (1 << bit) != 0); } } x.push(false); // try to mis-align boolean values on 8 bound base += 256 * 8 + 1; } }
rust_cleaned_test_functions.jsonl/59458
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 328 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 4470, 17932, 368, 341, 286, 1077, 5206, 856, 284, 6495, 10050, 486, 4197, 35603, 7, 15, 317, 286, 1077, 5206, 2331, 284, 220, 15, 280, 286, 369, 716, 304, 220, 15, 496, 23, 341, 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...
5
#[test] fn test_pay_for_txn() { init!("true"); // Schema let create_schema_req = ::utils::constants::SCHEMA_CREATE_JSON.to_string(); let (payment, response) = pay_for_txn(&create_schema_req, "101").unwrap(); assert_eq!(response, SUBMIT_SCHEMA_RESPONSE.to_string()); }
rust_cleaned_test_functions.jsonl/10482
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 152 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28925, 5478, 92299, 368, 341, 286, 2930, 17223, 1866, 3071, 286, 442, 12539, 198, 286, 1077, 1855, 25371, 17644, 284, 3504, 6031, 486, 15763, 486, 3540, 35839, 25823, 25356, 2389, 3904, 543, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_castle() { let keys = Zobrist::new([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, ]); let side = WHITE; let castle = QUEEN_SIDE; let actual_key = keys.castle(castle, side); let mut expected_key = 0u64; expected_key ^= keys.piece_square(WHITE_KING, E1); expected_key ^= keys.piece_square(WHITE_KING, C1); expected_key ^= keys.piece_square(WHITE_ROOK, A1); expected_key ^= keys.piece_square(WHITE_ROOK, D1); assert_eq!(actual_key, expected_key); }
rust_cleaned_test_functions.jsonl/26054
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 338 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5303, 273, 368, 341, 286, 1077, 6894, 284, 1863, 674, 2819, 486, 931, 8956, 310, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 21, 11, 220, 22, 11, 220, 23, 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_timing_estimator_node() { #[derive(Node)] struct SendNode { pub output: NodeSender<Vec<Complex<f64>>>, } impl SendNode { pub fn new() -> Self { Self { output: Default::default(), } } pub fn run(&mut self) -> Result<Vec<Complex<f64>>, NodeError> { let truth = 2; let alpha = 0.5; let samples = generate_samples(alpha); Ok(samples[truth..].to_vec()) } } #[derive(Node)] struct CheckNode { pub input: NodeReceiver<f64>, } impl CheckNode { pub fn new() -> Self { Self { input: Default::default(), } } pub fn run(&mut self, input: f64) -> Result<(), NodeError> { let truth = 2.0f64; println!("truth: {}, input: {}", truth, input); assert!((truth + input).abs() < 0.01); Ok(()) } } // Create estimator let alpha = 0.5; let n = 10; let d = 5; let mut send_node = SendNode::new(); let mut timing_node = TimingEstimatorNode::new(n, d, alpha).unwrap(); let mut check_node = CheckNode::new(); connect_nodes!(send_node, output, timing_node, input); connect_nodes!(timing_node, output, check_node, input); start_nodes!(send_node, timing_node); let check = thread::spawn(move || { check_node.call().unwrap(); }); assert!(check.join().is_ok()); }
rust_cleaned_test_functions.jsonl/48566
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 942 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70973, 91968, 5084, 368, 341, 286, 11506, 27098, 22078, 5563, 286, 2036, 11000, 1955, 341, 310, 6675, 2550, 25, 6018, 20381, 50439, 27, 31137, 63895, 21, 19, 2452, 12520, 286, 555, 286, 11605, 110...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_lp_matrix_float() { let m = matrix![1.0, -2.0; 0.5, 1.0]; assert_eq!(MatrixNorm::norm(&Lp::Float(1.0), &m), 4.5); }
rust_cleaned_test_functions.jsonl/6906
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 116 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 76529, 10193, 17586, 368, 341, 286, 1077, 296, 284, 6172, 20703, 16, 13, 15, 11, 481, 17, 13, 15, 280, 664, 220, 15, 13, 20, 11, 220, 16, 13, 15, 935, 286, 2060, 10714, 10297, 6689, 24993, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_introduce_var_simple() { check_assist( introduce_variable, " fn foo() { foo(<|>1 + 1<|>); }", " fn foo() { let <|>var_name = 1 + 1; foo(var_name); }", ); }
rust_cleaned_test_functions.jsonl/108752
{ "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, 4042, 47845, 4612, 30015, 368, 341, 286, 1779, 12083, 380, 1006, 310, 19131, 14635, 345, 310, 6228, 8822, 15229, 368, 341, 262, 15229, 22726, 91, 29, 16, 488, 220, 16, 27, 91, 42013, 24375, 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_replace_variables_1() -> Result<()> { let query = parse( r#"from employees derive [ # This adds columns / variables. gross_salary = salary + payroll_tax, gross_cost = gross_salary + benefits_cost # Variables can use other variables. ] "#, )?; let (res, context) = resolve(query.nodes, None)?; let pipeline = find_pipeline(res); let (mat, _, _) = materialize(pipeline.clone(), context.into(), None)?; // We could make a convenience function for this. It's useful for // showing the diffs of an operation. assert_display_snapshot!(diff( &to_string(&pipeline)?, &to_string(&mat)? ), @r###" @@ -6,7 +6,3 @@ name: employees alias: ~ declared_at: 37 - - Transform: - Derive: - - Ident: gross_salary - - Ident: gross_cost "###); Ok(()) }
rust_cleaned_test_functions.jsonl/90555
{ "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, 10633, 28182, 62, 16, 368, 1464, 5714, 71698, 341, 286, 1077, 3239, 284, 4715, 1006, 310, 435, 55543, 1499, 8256, 198, 262, 42430, 508, 12841, 671, 1096, 11367, 8147, 608, 7332, 624, 414, 19952, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_scalar_repr_ordering() { fn assert_equality(a: ScalarRepr, b: ScalarRepr) { assert_eq!(a, b); assert!(a.cmp(&b) == core::cmp::Ordering::Equal); } fn assert_lt(a: ScalarRepr, b: ScalarRepr) { assert!(a < b); assert!(b > a); } assert_equality( ScalarRepr::new([9999, 9999, 9999, 9999]), ScalarRepr::new([9999, 9999, 9999, 9999]), ); assert_equality( ScalarRepr::new([9999, 9998, 9999, 9999]), ScalarRepr::new([9999, 9998, 9999, 9999]), ); assert_equality( ScalarRepr::new([9999, 9999, 9999, 9997]), ScalarRepr::new([9999, 9999, 9999, 9997]), ); assert_lt( ScalarRepr::new([9999, 9997, 9999, 9998]), ScalarRepr::new([9999, 9997, 9999, 9999]), ); assert_lt( ScalarRepr::new([9999, 9997, 9998, 9999]), ScalarRepr::new([9999, 9997, 9999, 9999]), ); assert_lt( ScalarRepr::new([9, 9999, 9999, 9997]), ScalarRepr::new([9999, 9999, 9999, 9997]), ); }
rust_cleaned_test_functions.jsonl/56385
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 680 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41652, 68535, 7869, 287, 368, 341, 286, 5168, 2060, 2204, 10473, 2877, 25, 35176, 693, 649, 11, 293, 25, 35176, 693, 649, 8, 341, 310, 2060, 10714, 10297, 64, 11, 293, 317, 310, 2060, 10297, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_destroy_duplex_stream_after_unplugging_a_nondefault_input_device() { test_unplug_a_device_on_an_active_stream(StreamType::DUPLEX, Scope::Input, false, 0); }
rust_cleaned_test_functions.jsonl/23856
{ "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, 18066, 51932, 2571, 12673, 19844, 4907, 500, 35268, 4306, 21637, 2258, 5898, 9204, 368, 341, 262, 1273, 4907, 47474, 4306, 9204, 4470, 12008, 12930, 12673, 52011, 929, 486, 35, 3124, 35245, 11, 3492...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_any() { let v: Box<[isize]> = Box::new([1, 2, 3, 4, 5]); assert!(v.iter().any(|&x| x < 10)); assert!(v.iter().any(|&x| x % 2 == 0)); assert!(!v.iter().any(|&x| x > 100)); assert!(!v[..0].iter().any(|_| panic!())); }
rust_cleaned_test_functions.jsonl/25931
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 138 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37248, 368, 341, 262, 1077, 348, 25, 8261, 66746, 285, 551, 25669, 284, 8261, 486, 931, 2561, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 2558, 262, 2060, 10297, 85, 19471, 1005,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_stack_overflow() { let brackets: String = iter::repeat('[') .take(127) .chain(iter::repeat(']').take(127)) .collect(); let _: Value = from_str(&brackets).unwrap(); let brackets: String = iter::repeat('[').take(128).collect(); test_parse_err::<Value>(&[(&brackets, "recursion limit exceeded at line 1 column 128")]); }
rust_cleaned_test_functions.jsonl/29859
{ "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, 15528, 79073, 368, 341, 262, 1077, 38929, 25, 923, 284, 5367, 486, 30624, 492, 677, 340, 286, 659, 22769, 7, 16, 17, 22, 340, 286, 659, 8819, 27070, 486, 30624, 492, 36652, 22769, 7, 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...
1
#[test] fn test_unexpected_option_argument() { let err = OptParseError::unexpected_option_argument("--abc", "defg"); let thing = format!("{}", err); let expect = "Unexpected option argument: --abc: defg"; assert_eq!(thing, expect); }
rust_cleaned_test_functions.jsonl/8274
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 116 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 7325, 9672, 9025, 368, 341, 286, 1077, 1848, 284, 16554, 14463, 1454, 486, 53859, 9672, 9025, 21549, 13683, 497, 330, 750, 70, 797, 286, 1077, 3166, 284, 3561, 79878, 1848, 317, 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_ns() { let e: Element = Element::parse(File::open("tests/data/ns1.xml").unwrap()).unwrap(); let htbl = e.get_child(("table", "http://www.w3.org/TR/html4/")).unwrap(); let ftbl = e.get_child(("table", "https://www.w3schools.com/furniture")).unwrap(); assert_ne!(htbl, ftbl); }
rust_cleaned_test_functions.jsonl/15719
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 142 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34728, 368, 341, 262, 1077, 384, 25, 8543, 284, 8543, 486, 6400, 19821, 486, 2508, 445, 23841, 13167, 82492, 16, 9028, 1827, 15454, 6011, 15454, 1428, 262, 1077, 305, 18064, 284, 384, 670, 17268, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_le_operator() { // check use case for SeccompCmpArgLen::DWORD let rules = vec![allow_syscall_if( libc::SYS_ioctl, vec![SeccompRule::new( vec![Cond::new(1, SeccompCmpArgLen::DWORD, Le, KVM_GET_PIT2).unwrap()], SeccompAction::Allow, )], )]; // check syscalls that are supposed to work validate_seccomp_filter( rules.clone(), || unsafe { libc::ioctl(0, KVM_GET_PIT2 as IoctlRequest); libc::ioctl(0, (KVM_GET_PIT2 - 1) as IoctlRequest); }, false, ); // check syscalls that are not supposed to work validate_seccomp_filter( rules.clone(), || unsafe { libc::ioctl(0, (KVM_GET_PIT2 + 1) as IoctlRequest); }, true, ); // check use case for SeccompCmpArgLen::QWORD let rules = vec![allow_syscall_if( libc::SYS_ioctl, vec![SeccompRule::new( vec![Cond::new( 2, SeccompCmpArgLen::QWORD, Le, u64::from(std::u32::MAX) + 10, ) .unwrap()], SeccompAction::Allow, )], )]; // check syscalls that are supposed to work validate_seccomp_filter( rules.clone(), || unsafe { libc::ioctl(0, 0 as IoctlRequest, u64::from(std::u32::MAX) + 10); libc::ioctl(0, 0 as IoctlRequest, u64::from(std::u32::MAX) + 9); }, false, ); // check syscalls that are not supposed to work validate_seccomp_filter( rules.clone(), || unsafe { libc::ioctl(0, 0 as IoctlRequest, u64::from(std::u32::MAX) + 11); }, true, ); }
rust_cleaned_test_functions.jsonl/17471
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1176 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11751, 40594, 368, 341, 286, 442, 1779, 990, 1142, 369, 1345, 638, 14435, 34, 1307, 2735, 11271, 486, 32504, 198, 286, 1077, 5601, 284, 7486, 20703, 7183, 20344, 6659, 11119, 1006, 310, 42142, 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...
5
#[test] fn test_stream_high_range_prefix_suffix() -> crate::Result<()> { let buffer: Vec<u8> = { let mut term_dictionary_builder = TermDictionaryBuilder::create(vec![]).unwrap(); // term requires more than 16bits term_dictionary_builder.insert("abcdefghijklmnopqrstuvwxy", &make_term_info(1))?; term_dictionary_builder.insert("abcdefghijklmnopqrstuvwxyz", &make_term_info(2))?; term_dictionary_builder.insert("abr", &make_term_info(2))?; term_dictionary_builder.finish()? }; let term_dict_file = FileSlice::from(buffer); let term_dictionary: TermDictionary = TermDictionary::open(term_dict_file)?; let mut kv_stream = term_dictionary.stream(); assert!(kv_stream.advance()); assert_eq!(kv_stream.key(), "abcdefghijklmnopqrstuvwxy".as_bytes()); assert_eq!(kv_stream.value(), &make_term_info(1)); assert!(kv_stream.advance()); assert_eq!(kv_stream.key(), "abcdefghijklmnopqrstuvwxyz".as_bytes()); assert_eq!(kv_stream.value(), &make_term_info(2)); assert!(kv_stream.advance()); assert_eq!(kv_stream.key(), "abr".as_bytes()); assert!(!kv_stream.advance()); Ok(()) }
rust_cleaned_test_functions.jsonl/101248
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 599 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12673, 22680, 9698, 13974, 37151, 368, 1464, 17717, 486, 2077, 71698, 341, 286, 1077, 4147, 25, 11312, 34837, 23, 29, 284, 341, 310, 1077, 5206, 4647, 42605, 28532, 284, 17519, 8517, 3297, 486, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_eq_ignores_options_and_comment() { let a = KeyEntry { options: None, key_type: "ssh-rsa".to_owned(), key: "abc".to_owned(), comment: None, }; let b = KeyEntry { options: Some("test".to_owned()), key_type: "ssh-rsa".to_owned(), key: "abc".to_owned(), comment: Some("test".to_owned()), }; assert_eq!(a, b); }
rust_cleaned_test_functions.jsonl/31220
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 266 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10714, 62, 622, 4589, 8743, 8378, 17638, 368, 341, 286, 1077, 264, 284, 5309, 5874, 341, 310, 2606, 25, 2240, 345, 310, 1376, 1819, 25, 330, 25537, 3795, 9081, 3263, 983, 51973, 3148, 310, 1376,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1