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_mem_writer() {
let mut writer = MemWriter::new();
assert_eq!(writer.tell(), Ok(0));
writer.write([0]).unwrap();
assert_eq!(writer.tell(), Ok(1));
writer.write([1, 2, 3]).unwrap();
writer.write([4, 5, 6, 7]).unwrap();
assert_eq!(writer.tell(), Ok(8));
assert_eq!(writer.get_ref(), &[0, 1, 2, 3, 4, 5, 6, 7]);
writer.seek(0, SeekSet).unwrap();
assert_eq!(writer.tell(), Ok(0));
writer.write([3, 4]).unwrap();
assert_eq!(writer.get_ref(), &[3, 4, 2, 3, 4, 5, 6, 7]);
writer.seek(1, SeekCur).unwrap();
writer.write([0, 1]).unwrap();
assert_eq!(writer.get_ref(), &[3, 4, 2, 0, 1, 5, 6, 7]);
writer.seek(-1, SeekEnd).unwrap();
writer.write([1, 2]).unwrap();
assert_eq!(writer.get_ref(), &[3, 4, 2, 0, 1, 5, 6, 1, 2]);
writer.seek(1, SeekEnd).unwrap();
writer.write([1]).unwrap();
assert_eq!(writer.get_ref(), &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1]);
} | rust_cleaned_test_functions.jsonl/31073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12976,
28908,
368,
341,
286,
1077,
5206,
6916,
284,
13550,
6492,
486,
931,
543,
286,
2060,
10714,
10297,
18189,
81838,
1507,
7622,
7,
15,
1106,
286,
6916,
3836,
2561,
15,
10697,
15454,
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_factorial_for_int() {
let ten: Int = 10;
let result = factorial(ten);
assert_eq!(result, 3628800);
} | rust_cleaned_test_functions.jsonl/48667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18588,
530,
5478,
4042,
368,
341,
286,
1077,
5779,
25,
1333,
284,
220,
16,
15,
401,
286,
1077,
1102,
284,
52962,
1155,
268,
626,
286,
2060,
10714,
10297,
1382,
11,
220,
18,
21,
17,
23,
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 |
#[test]
fn test_extensions_with_file_without_extension() {
let path = Path::new(".gitignore");
let name = Name::new(
&path,
FileType::File {
uid: false,
exec: false,
},
);
assert_eq!(None, name.extension());
} | rust_cleaned_test_functions.jsonl/963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60498,
6615,
2458,
39904,
31035,
368,
341,
286,
1077,
1815,
284,
7933,
486,
931,
5680,
12882,
13130,
3071,
286,
1077,
829,
284,
3988,
486,
931,
1006,
310,
609,
2343,
345,
310,
93238,
486,
1703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_regex_overrides_glob() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.assert_output(&["--glob", "--regex", "Foo2$"], "one/two/C.Foo2");
} | rust_cleaned_test_functions.jsonl/10860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
15431,
18245,
95133,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
1013,
3713,
7645,
2099,
1183,
313,
58926,
497,
14482,
26387,
497,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_into_header_value() {
let basic = Basic {
user_id: "Aladdin".into(),
password: Some("open sesame".into()),
};
let result = basic.try_into();
assert!(result.is_ok());
assert_eq!(
result.unwrap(),
HeaderValue::from_static("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
);
} | rust_cleaned_test_functions.jsonl/27914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
8757,
3142,
368,
341,
286,
1077,
6770,
284,
14625,
341,
310,
1196,
842,
25,
330,
2101,
97006,
3263,
18122,
3148,
310,
3552,
25,
4329,
445,
2508,
91123,
3263,
18122,
14702,
286,
3634,
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_has_passed() {
let mut g = test_helpers::create_test_bid_phase();
assert_eq!(has_passed(&g.auction, Bidder::First), false);
g.auction.first_bids.push(AuctionTurn { bid: Bid::Pass, responses: vec![] });
assert_eq!(has_passed(&g.auction, Bidder::First), true);
assert_eq!(has_passed(&g.auction, Bidder::Second), false);
} | rust_cleaned_test_functions.jsonl/83217 | {
"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,
21778,
87405,
368,
341,
286,
1077,
5206,
342,
284,
1273,
54473,
486,
3182,
4452,
62509,
37593,
543,
286,
2060,
10714,
10297,
4648,
87405,
2099,
70,
5849,
2654,
11,
40402,
1107,
486,
5338,
701,
895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_array_iter_round_trip() {
let array =
StringArray::from(vec![Some("a"), None, Some("aaa"), None, Some("aaaaa")]);
let array = Arc::new(array) as ArrayRef;
let array = array.as_any().downcast_ref::<StringArray>().unwrap();
let result: StringArray = array
.iter()
.map(|e| {
e.map(|e| {
let mut a = e.to_string();
a.push('b');
a
})
})
.collect();
let expected =
StringArray::from(vec![Some("ab"), None, Some("aaab"), None, Some("aaaaab")]);
assert_eq!(result, expected);
// check if DoubleEndedIterator is implemented
let result: StringArray = array.iter().rev().collect();
let rev_array =
StringArray::from(vec![Some("aaaaa"), None, Some("aaa"), None, Some("a")]);
assert_eq!(result, rev_array);
// check if ExactSizeIterator is implemented
let _ = array.iter().rposition(|opt_b| opt_b == Some("a"));
} | rust_cleaned_test_functions.jsonl/117561 | {
"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,
3904,
3858,
11723,
29896,
63883,
368,
341,
286,
1077,
1334,
4035,
310,
923,
1857,
486,
1499,
25592,
20703,
8373,
445,
64,
3975,
2240,
11,
4329,
445,
32646,
3975,
2240,
11,
4329,
445,
28458,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_char_iterator() {
let examples = [
// Simple keyword-like strings
("if", false),
("for", false),
("impl", false),
// Strings containing two-byte characters
("パーティーへ行かないか", true),
("パーティーへ行か", true),
("パーティーへ行_", false),
("和製漢語", false),
("部落格", false),
("사회과학원 어학연구소", true),
// String containing diverse characters
("表ポあA鷗ŒéB逍Üߪąñ丂㐀𠀀", true),
];
let s: SmolStr = raw.chars().collect();
assert_eq!(s.as_str(), *raw);
assert_eq!(s.is_heap_allocated(), *is_heap);
} | rust_cleaned_test_functions.jsonl/106848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
9232,
13491,
368,
341,
262,
1077,
10295,
284,
2278,
286,
442,
8993,
16174,
12681,
9069,
198,
286,
3489,
333,
497,
895,
1326,
286,
3489,
1958,
497,
895,
1326,
286,
3489,
6383,
497,
895,
132... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_game_creation() {
new_test_ext().execute_with(|| {
// Test player can not play against himself
assert_noop!(
ConnectFour::new_game(Origin::signed(1), 1),
Error::<Test>::NoFakePlay
);
// Test game creation between to different players
assert_ok!(ConnectFour::new_game(Origin::signed(1), 2));
run_to_block(1);
let board_id_1 = ConnectFour::player_board(1);
let board_id_2 = ConnectFour::player_board(2);
assert_eq!(board_id_1, board_id_2);
assert_noop!(
ConnectFour::new_game(Origin::signed(1), 3),
Error::<Test>::PlayerBoardExists
);
assert_noop!(
ConnectFour::new_game(Origin::signed(3), 2),
Error::<Test>::PlayerBoardExists
);
let board = ConnectFour::boards(board_id_1);
assert_eq!(board.last_turn, 0);
});
} | rust_cleaned_test_functions.jsonl/8680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18547,
46163,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
1476,
197,
197,
322,
3393,
2781,
646,
537,
1486,
2348,
5561,
198,
197,
6948,
6536,
453,
33673,
298,
197,
14611,
26972,
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... | 2 |
#[test]
fn test_get_registrations_empty() {
run_async_test(async {
ffx_config::set((CONFIG_KEY_REGISTRATIONS, ConfigLevel::User), json!({}))
.await
.unwrap();
assert_eq!(get_registrations().await, hashmap! {});
});
} | rust_cleaned_test_functions.jsonl/98271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
4920,
3758,
804,
15124,
368,
341,
286,
1598,
28346,
4452,
18285,
341,
310,
282,
8298,
5332,
486,
746,
1188,
24652,
6600,
8064,
29503,
21792,
11,
5532,
4449,
486,
1474,
701,
2951,
0,
2306,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_short_trailer() {
let mut log = new_record_test();
let n = BLOCK_SIZE - 2 * HEADER_SIZE + 4;
log.write(big_string("foo", n).as_str());
assert_eq!(BLOCK_SIZE - HEADER_SIZE + 4, log.written_bytes());
log.write("");
log.write("bar");
assert_eq!(big_string("foo", n).as_str(), log.read());
assert_eq!("", log.read());
assert_eq!("bar", log.read());
assert_eq!(EOF, log.read());
} | rust_cleaned_test_functions.jsonl/46684 | {
"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,
16673,
3547,
38782,
368,
341,
286,
1077,
5206,
1487,
284,
501,
14192,
4452,
543,
286,
1077,
308,
284,
28677,
4098,
481,
220,
17,
353,
39665,
4098,
488,
220,
19,
280,
286,
1487,
3836,
75616,
3904... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invite_detail_abbr2() {
let un_abbr = json!({
"statusCode":"MS-102",
"connReqId":"yta2odh",
"senderDetail":{
"name":"ent-name",
"agentKeyDlgProof":{
"agentDID":"N2Uyi6SVsHZq1VWXuA3EMg",
"agentDelegatedKey":"CTfF2sZ5q4oPcBvTP75pgx3WGzYiLSTwHGg9zUsJJegi",
"signature":"/FxHMzX8JaH461k1SI5PfyxF5KwBAe6VlaYBNLI2aSZU3APsiWBfvSC+mxBYJ/zAhX9IUeTEX67fj+FCXZZ2Cg=="
},
"DID":"F2axeahCaZfbUYUcKefc3j",
"logoUrl":"ent-logo-url",
"verKey":"74xeXSEac5QTWzQmh84JqzjuXc8yvXLzWKeiqyUnYokx"
},
"senderAgencyDetail":{
"DID":"BDSmVkzxRYGE4HKyMKxd1H",
"verKey":"6yUatReYWNSUfEtC2ABgRXmmLaxCyQqsjLwv2BomxsxD",
"endpoint":"52.38.32.107:80/agency/msg"
},
"targetName":"there",
"statusMsg":"message sent"
});
let abbr = json!({
"sc":"MS-102",
"id": "yta2odh",
"s": {
"n": "ent-name",
"dp": {
"d": "N2Uyi6SVsHZq1VWXuA3EMg",
"k": "CTfF2sZ5q4oPcBvTP75pgx3WGzYiLSTwHGg9zUsJJegi",
"s":
"/FxHMzX8JaH461k1SI5PfyxF5KwBAe6VlaYBNLI2aSZU3APsiWBfvSC+mxBYJ/zAhX9IUeTEX67fj+FCXZZ2Cg==",
},
"d": "F2axeahCaZfbUYUcKefc3j",
"l": "ent-logo-url",
"v": "74xeXSEac5QTWzQmh84JqzjuXc8yvXLzWKeiqyUnYokx",
},
"sa": {
"d": "BDSmVkzxRYGE4HKyMKxd1H",
"v": "6yUatReYWNSUfEtC2ABgRXmmLaxCyQqsjLwv2BomxsxD",
"e": "52.38.32.107:80/agency/msg",
},
"t": "there",
"sm":"message sent"
});
let processed = abbrv_event_detail(un_abbr.clone()).unwrap();
assert_eq!(processed, abbr);
let unprocessed = unabbrv_event_detail(processed).unwrap();
assert_eq!(unprocessed, un_abbr);
} | rust_cleaned_test_functions.jsonl/34227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 994
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
94910,
14480,
22885,
1323,
17,
368,
341,
286,
1077,
650,
22885,
1323,
284,
2951,
0,
2262,
220,
330,
44480,
3252,
4826,
12,
16,
15,
17,
756,
220,
330,
5148,
27234,
764,
3252,
88,
2565,
17,
347,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_computed_values_from_config() {
let git_config_contents = b"
[delta]
true-color = never
width = 100
inspect-raw-lines = true
paging = never
syntax-theme = None
";
let git_config_path = "delta__test_get_true_color_from_config.gitconfig";
let config = integration_test_utils::make_config_from_args_and_git_config(
&[],
Some(git_config_contents),
Some(git_config_path),
);
assert_eq!(config.true_color, false);
assert_eq!(config.decorations_width, cli::Width::Fixed(100));
assert_eq!(config.background_color_extends_to_terminal_width, true);
assert_eq!(config.inspect_raw_lines, cli::InspectRawLines::True);
assert_eq!(config.paging_mode, PagingMode::Never);
assert!(config.syntax_theme.is_none());
// syntax_set doesn't depend on gitconfig.
remove_file(git_config_path).unwrap();
} | rust_cleaned_test_functions.jsonl/42351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2965,
19292,
9146,
5673,
5332,
368,
341,
286,
1077,
16345,
5332,
16682,
284,
293,
698,
58,
20255,
921,
262,
830,
7889,
284,
2581,
198,
262,
2374,
284,
220,
16,
15,
15,
198,
262,
24085,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_user_dirs_exists() {
let user_dirs_file = ::config_dir().unwrap().join("user-dirs.dirs");
println!("{:?} exists: {:?}", user_dirs_file, user_dirs_file.exists());
} | rust_cleaned_test_functions.jsonl/58228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
3317,
44869,
9766,
368,
341,
286,
1077,
1196,
44869,
2458,
284,
3504,
1676,
4334,
1005,
15454,
1005,
5987,
445,
872,
1737,
16838,
14395,
82,
797,
286,
13751,
88928,
76475,
92,
6724,
25,
7196... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decode_01() {
let buf: [u8; 5] = [97, 0, 0, 0, 23];
let msg: MsgChannelClose = SshCodec::decode(&buf[..]).unwrap();
assert_eq!(msg.recipient_channel, 23);
} | rust_cleaned_test_functions.jsonl/121343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
62,
15,
16,
368,
341,
286,
1077,
6607,
25,
508,
84,
23,
26,
220,
20,
60,
284,
508,
24,
22,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
17,
18,
935,
286,
1077,
3750,
25,
2420... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_retry_send_credential_offer() {
init!("true");
let connection_handle = build_test_connection();
let credential_id = DEFAULT_CREDENTIAL_ID;
let handle = issuer_credential_create(::credential_def::tests::create_cred_def_fake(),
"1".to_string(),
"8XFh8yBzrpJQmNyZzgoTqB".to_owned(),
"credential_name".to_string(),
"{\"attr\":\"value\"}".to_owned(),
1).unwrap();
set_libindy_rc(error::TIMEOUT_LIBINDY_ERROR.code_num);
assert!(send_credential_offer(handle, connection_handle).is_err());
assert_eq!(get_state(handle).unwrap(), VcxStateType::VcxStateInitialized as u32);
assert_eq!(get_offer_uid(handle).unwrap(), "");
// Can retry after initial failure
assert_eq!(send_credential_offer(handle, connection_handle).unwrap(), error::SUCCESS.code_num);
assert_eq!(get_state(handle).unwrap(), VcxStateType::VcxStateOfferSent as u32);
assert_eq!(get_offer_uid(handle).unwrap(), "ntc2ytb");
} | rust_cleaned_test_functions.jsonl/104596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 604
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62745,
13565,
666,
30320,
67814,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3633,
10630,
284,
1936,
4452,
15866,
1428,
286,
1077,
40207,
842,
284,
11955,
920,
81509,
3450,
401,
286,
1077,
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_mknod_character_device_requires_major_and_minor() {
new_ucmd!()
.arg("test_file")
.arg("c")
.fails()
.status_code(1)
.stderr_contains(&"Special files require major and minor device numbers.");
new_ucmd!()
.arg("test_file")
.arg("c")
.arg("1")
.fails()
.status_code(1)
.stderr_contains(&"Special files require major and minor device numbers.");
new_ucmd!()
.arg("test_file")
.arg("c")
.arg("1")
.arg("c")
.fails()
.status_code(1)
.stderr_contains(&"Invalid value for '<MINOR>'");
new_ucmd!()
.arg("test_file")
.arg("c")
.arg("c")
.arg("1")
.fails()
.status_code(1)
.stderr_contains(&"Invalid value for '<MAJOR>'");
} | rust_cleaned_test_functions.jsonl/82670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
19095,
347,
40988,
9204,
54949,
47916,
8378,
70861,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
445,
1944,
2458,
1138,
286,
659,
858,
445,
66,
1138,
286,
659,
59631,
741,
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_raw_node_restart() {
let l = default_logger();
let entries = vec![empty_entry(1, 1), new_entry(1, 2, Some("foo"))];
let mut raw_node = {
let store = new_storage();
store.wl().set_hardstate(hard_state(1, 1, 0));
store.wl().append(&entries).unwrap();
new_raw_node(1, vec![], 10, 1, store, &l)
};
let rd = raw_node.ready();
must_cmp_ready(&rd, &None, &None, &[], entries[..1].to_vec(), false);
raw_node.advance(rd);
assert!(!raw_node.has_ready());
} | rust_cleaned_test_functions.jsonl/33971 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
69392,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
10695,
284,
7486,
20703,
3194,
9078,
7,
16,
11,
220,
16,
701,
501,
9078,
7,
16,
11,
220,
17,
11,
4329,
445,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_ascii_large_value() {
let large_value = std::iter::repeat('\u{1}').take(500).collect::<String>();
assert!(to_quoted_ascii(http_token(large_value.as_str())).len() < MESSAGE_MAX_SIZE / 2);
} | rust_cleaned_test_functions.jsonl/88827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
50238,
45228,
3142,
368,
341,
286,
1077,
3460,
3142,
284,
1460,
486,
2015,
486,
30624,
11024,
84,
90,
16,
92,
1823,
22769,
7,
20,
15,
15,
568,
17384,
27638,
703,
3913,
286,
2060,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_render()
{
let points = vec![
PaintPoint::new(Point::new(-1, -1), Some('*')),
PaintPoint::new(Point::new(1, 1), Some('*')),
PaintPoint::new(Point::new(-1, -1), Some('a')),
PaintPoint::new(Point::new(1, -1), Some('b')),
PaintPoint::new(Point::new(0, 0), Some('c')),
PaintPoint::new(Point::new(-1, 1), Some('d')),
PaintPoint::new(Point::new(0, 1), Some('e')),
PaintPoint::new(Point::new(1, 1), Some('f')),
PaintPoint::new(Point::new(1, 1), None),
];
let result = render(&points);
assert_eq!(result, "a b\n c \ndef\n".to_owned());
} | rust_cleaned_test_functions.jsonl/128946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
741,
262,
341,
286,
1077,
3501,
284,
7486,
90515,
310,
17203,
2609,
486,
931,
32737,
486,
931,
4080,
16,
11,
481,
16,
701,
4329,
32014,
22337,
310,
17203,
2609,
486,
931,
32737,
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_read_unpacked_to_unpacked() {
let mut test = TestUnpacked::new();
test.varints = vec![17i32, 1000];
test_deserialize("20 11 20 e8 07", &test);
let mut test = TestUnpacked::new();
test.sfixed32s = vec![17i32, 1000];
test_deserialize("2d 11 00 00 00 2d e8 03 00 00", &test);
} | rust_cleaned_test_functions.jsonl/47066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
4907,
50321,
2346,
4907,
50321,
368,
341,
262,
1077,
5206,
1273,
284,
3393,
1806,
50321,
486,
931,
543,
262,
1273,
19526,
21042,
284,
7486,
20703,
16,
22,
72,
18,
17,
11,
220,
16,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_async_stream() {
let runner = SingleTaskRunner::default();
let rt = runner.startup().unwrap();
thread::spawn(move || {
loop {
if let Err(e) = runner.run() {
println!("!!!!!!run failed, reason: {:?}", e);
break;
}
thread::sleep(Duration::from_millis(1));
}
});
let rt_copy = rt.clone();
rt.spawn(rt.alloc(), async move {
let s = new_stream(3);
pin_mut!(s);
while let Some(value) = s.next().await {
rt_copy.wait_timeout(1000).await;
println!("got {}", value);
}
let mut s = new_boxed_stream(11);
let mut input = Vec::new();
let mut s = rt_copy.pipeline(s, move |n| {
if n < 10 {
input.push(n);
AsyncPipelineResult::Filtered((n * 1000).to_string())
} else {
println!("input: {:?}", input);
AsyncPipelineResult::Disconnect
}
});
while let Some(value) = s.next().await {
rt_copy.wait_timeout(1000).await;
println!("got {:?}", value);
}
let mut s = TestStream(0, 1);
while let Some(value) = s.next().await {
println!("got {}", value);
}
});
thread::sleep(Duration::from_millis(1000000000));
} | rust_cleaned_test_functions.jsonl/62437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
12673,
368,
972,
262,
1077,
22259,
284,
11327,
6262,
19486,
486,
2258,
1647,
262,
1077,
16677,
284,
22259,
4962,
454,
1005,
15454,
7317,
262,
4516,
486,
46087,
34081,
1369,
972,
286,
6337,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_rng_32_reseed() {
let s = ::test::rng().gen_iter::<u32>().take(256).collect::<Vec<u32>>();
let mut r: IsaacRng = SeedableRng::from_seed(&s[..]);
let string1: String = r.gen_ascii_chars().take(100).collect();
r.reseed(&s);
let string2: String = r.gen_ascii_chars().take(100).collect();
assert_eq!(string1, string2);
} | rust_cleaned_test_functions.jsonl/42031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66849,
62,
18,
17,
1288,
22602,
368,
341,
286,
1077,
274,
284,
3504,
1944,
486,
69890,
1005,
4370,
11723,
27638,
84,
18,
17,
10483,
22769,
7,
17,
20,
21,
568,
17384,
27638,
10050,
34837,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peek_mut_pop() {
let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
let mut heap = BinaryHeap::from(data);
assert_eq!(heap.peek(), Some(&10));
{
let mut top = heap.peek_mut().unwrap();
*top -= 2;
assert_eq!(PeekMut::pop(top), 8);
}
assert_eq!(heap.peek(), Some(&9));
} | rust_cleaned_test_functions.jsonl/62359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
29107,
29523,
17061,
368,
341,
262,
1077,
821,
284,
7486,
20703,
17,
11,
220,
19,
11,
220,
21,
11,
220,
17,
11,
220,
16,
11,
220,
23,
11,
220,
16,
15,
11,
220,
18,
11,
220,
20,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_with_config_sanity() {
let (init_result, deps) = init_helper_with_config(
vec![InitialBalance {
address: HumanAddr("lebron".to_string()),
amount: Uint128(5000),
}],
true,
true,
true,
true,
0,
);
assert_eq!(init_result.unwrap(), InitResponse::default());
let config = ReadonlyConfig::from_storage(&deps.storage);
let constants = config.constants().unwrap();
assert_eq!(config.total_supply(), 5000);
assert_eq!(config.contract_status(), ContractStatusLevel::NormalRun);
assert_eq!(constants.name, "sec-sec".to_string());
assert_eq!(constants.admin, HumanAddr("admin".to_string()));
assert_eq!(constants.symbol, "SECSEC".to_string());
assert_eq!(constants.decimals, 8);
assert_eq!(
constants.prng_seed,
sha_256("lolz fun yay".to_owned().as_bytes())
);
assert_eq!(constants.total_supply_is_public, false);
assert_eq!(constants.deposit_is_enabled, true);
assert_eq!(constants.redeem_is_enabled, true);
assert_eq!(constants.mint_is_enabled, true);
assert_eq!(constants.burn_is_enabled, true);
} | rust_cleaned_test_functions.jsonl/69600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 640
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
6615,
5332,
643,
38270,
368,
341,
286,
1077,
320,
2327,
5287,
11,
48178,
8,
284,
2930,
10418,
6615,
5332,
1006,
310,
7486,
20703,
6341,
21190,
341,
394,
2621,
25,
11097,
13986,
445,
273,
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_parse_iomem() {
let source = "009fc00-0009ffff : reserved";
let correct = IoMem {
start: 0x09fc00,
end: 0x0009ffff,
kind: "reserved".to_string(),
};
assert_eq!(correct, source.parse::<IoMem>().unwrap());
} | rust_cleaned_test_functions.jsonl/123024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5318,
316,
336,
368,
341,
286,
1077,
2530,
284,
330,
15,
15,
24,
8316,
15,
15,
12,
15,
15,
15,
24,
7238,
549,
4591,
876,
286,
1077,
4396,
284,
29655,
18816,
341,
310,
1191,
25,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_op_i() {
let mut vars = Variables::new();
assert_eq!(
expand(b"%p1%d%p2%d%p3%d%i%p1%d%p2%d%p3%d", &[Number(1), Number(2), Number(3)], &mut vars),
Ok("123233".bytes().collect::<Vec<_>>())
);
assert_eq!(
expand(b"%p1%d%p2%d%i%p1%d%p2%d", &[], &mut vars),
Ok("0011".bytes().collect::<Vec<_>>())
);
} | rust_cleaned_test_functions.jsonl/35445 | {
"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,
10287,
5318,
368,
341,
262,
1077,
5206,
19942,
284,
21419,
486,
931,
543,
262,
2060,
10714,
33673,
286,
9225,
1883,
31391,
79,
16,
14841,
97472,
17,
14841,
97472,
18,
14841,
62729,
97472,
16,
1484... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seek_ts() {
let engine = TestEngineBuilder::new().build().unwrap();
must_prewrite_put(&engine, &[2], b"vv", &[2], 3);
must_commit(&engine, &[2], 3, 3);
must_prewrite_put(
&engine,
&[3],
"a".repeat(SHORT_VALUE_MAX_LEN + 1).as_bytes(),
&[3],
4,
);
must_commit(&engine, &[3], 4, 4);
must_prewrite_put(
&engine,
&[5],
"b".repeat(SHORT_VALUE_MAX_LEN + 1).as_bytes(),
&[5],
2,
);
must_commit(&engine, &[5], 2, 5);
must_prewrite_put(&engine, &[6], b"xxx", &[6], 3);
must_commit(&engine, &[6], 3, 6);
let snapshot = engine.snapshot(&Context::default()).unwrap();
let mut reader =
MvccReader::new(snapshot, Some(ScanMode::Forward), true, IsolationLevel::Si);
assert_eq!(
reader.seek_ts(3.into()).unwrap().unwrap(),
Key::from_raw(&[2])
);
} | rust_cleaned_test_functions.jsonl/35966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
25023,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
286,
1969,
620,
52473,
15557,
2099,
8512,
11,
44590,
17,
1125,
293,
1,
33075,
497,
44590,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trap_stack_overflow() -> Result<()> {
let store = get_store(false);
let wat = r#"
(module $rec_mod
(func $run (export "run") (call $run))
)
"#;
let module = Module::new(&store, wat)?;
let instance = Instance::new(&module, &imports! {})?;
let run_func = instance
.exports
.get_function("run")
.expect("expected function export");
let e = run_func.call(&[]).err().expect("error calling function");
let trace = e.trace();
assert!(trace.len() >= 32);
for i in 0..trace.len() {
assert_eq!(trace[i].module_name(), "rec_mod");
assert_eq!(trace[i].func_index(), 0);
assert_eq!(trace[i].function_name(), Some("run"));
}
assert!(e.message().contains("call stack exhausted"));
Ok(())
} | rust_cleaned_test_functions.jsonl/38857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88536,
15528,
79073,
368,
1464,
5714,
71698,
341,
262,
1077,
3553,
284,
633,
14809,
3576,
317,
262,
1077,
29025,
284,
435,
2,
698,
286,
320,
4352,
400,
2758,
7480,
198,
310,
320,
2830,
400,
6108... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transpile_bundling_import() {
let source = r#"
import React, { useState, useEffect as useEffect_ } from "https://esm.sh/react"
import * as React_ from "https://esm.sh/react"
import Logo from '../components/logo.ts'
import Nav from '../components/nav.ts'
import '../shared/iife.ts'
export default function Index() {
return (
<>
<head></head>
<Logo />
<Nav />
<h1>Hello World</h1>
</>
)
}
"#;
let module =
ParsedModule::parse("/pages/index.tsx", source, None).expect("could not parse module");
let resolver = Rc::new(RefCell::new(Resolver::new(
"/pages/index.tsx",
ImportHashMap::default(),
None,
true,
vec!["/components/logo.ts".into(), "/shared/iife.ts".into()],
)));
let (code, _) = module
.transpile(resolver.clone(), &EmitOptions::default())
.expect("could not transpile module");
println!("{}", code);
assert!(code.contains("React = __ALEPH.pack[\"https://esm.sh/react\"].default"));
assert!(code.contains("useState = __ALEPH.pack[\"https://esm.sh/react\"].useState"));
assert!(code.contains("useEffect_ = __ALEPH.pack[\"https://esm.sh/react\"].useEffect"));
assert!(code.contains("React_ = __ALEPH.pack[\"https://esm.sh/react\"]"));
assert!(code.contains("Logo = __ALEPH.pack[\"/components/logo.ts\"].default"));
assert!(!code.contains("Nav = __ALEPH.pack[\"/components/nav.ts\"].default"));
assert!(code.contains("import Nav from \""));
assert!(!code.contains("__ALEPH.pack[\"/shared/iife.ts\"]"));
assert!(code.contains(
format!(
"__ALEPH_Head = __ALEPH.pack[\"https://deno.land/x/aleph@v{}/framework/react/head.ts\"].default",
VERSION.as_str()
)
.as_str()
));
} | rust_cleaned_test_functions.jsonl/34199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 859
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
12192,
880,
1241,
2718,
18434,
368,
341,
262,
1077,
2530,
284,
435,
2,
698,
414,
1159,
3592,
11,
314,
8102,
11,
14233,
438,
14233,
62,
335,
504,
330,
2428,
1110,
288,
76,
2395,
27417,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_a_plus_parenthesis_b_less_than_c() {
assert_expression!(
"A + (B < C)",
Expression::BinaryExpression(
Operator::Plus,
Box::new("A".as_var_expr(1, 7)),
Box::new(
Expression::Parenthesis(Box::new(
Expression::BinaryExpression(
Operator::Less,
Box::new("B".as_var_expr(1, 12)),
Box::new("C".as_var_expr(1, 16)),
ExpressionType::Unresolved
)
.at_rc(1, 14)
))
.at_rc(1, 11)
),
ExpressionType::Unresolved
)
);
} | rust_cleaned_test_functions.jsonl/102652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
28043,
620,
9151,
13189,
880,
50747,
51613,
666,
368,
341,
310,
2060,
28068,
33673,
394,
330,
32,
488,
320,
33,
366,
356,
15752,
394,
16378,
486,
21338,
9595,
1006,
503,
28498,
486,
21807,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_required_version() {
assert_eq!(
ExtXSessionData::new(
"com.example.lyrics",
SessionData::Uri("lyrics.json".to_string())
)
.required_version(),
ProtocolVersion::V1
);
} | rust_cleaned_test_functions.jsonl/4171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18743,
9438,
368,
341,
286,
2060,
10714,
33673,
310,
9447,
55,
5283,
1043,
486,
931,
1006,
394,
330,
874,
7724,
27250,
6198,
756,
394,
9164,
1043,
486,
13899,
445,
398,
6198,
4323,
3263,
983,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_part2() {
assert_eq!(decrypt(&parse("qzmt-zixmtkozy-ivhz-343[qwert]")[0]), "very encrypted name".to_string());
} | rust_cleaned_test_functions.jsonl/8867 | {
"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,
10495,
17,
368,
341,
286,
2060,
10714,
10297,
73295,
2099,
6400,
445,
80,
89,
2501,
9141,
941,
2501,
9325,
4246,
12,
344,
37259,
12,
18,
19,
18,
41093,
54594,
60,
17135,
15,
9719,
330,
1204,
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 |
#[test]
fn test_from() {
assert_eq!(Point2::from([1, 2]), POINT2);
{
let p = &[1, 2];
let p: &Point2<_> = From::from(p);
assert_eq!(p, &POINT2);
}
{
let p = &mut [1, 2];
let p: &mut Point2<_> = From::from(p);
assert_eq!(p, &POINT2);
}
assert_eq!(Point2::from((1, 2)), POINT2);
{
let p = &(1, 2);
let p: &Point2<_> = From::from(p);
assert_eq!(p, &POINT2);
}
{
let p = &mut (1, 2);
let p: &mut Point2<_> = From::from(p);
assert_eq!(p, &POINT2);
}
} | rust_cleaned_test_functions.jsonl/45376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
368,
341,
310,
2060,
10714,
10297,
2609,
17,
486,
1499,
2561,
16,
11,
220,
17,
9719,
46595,
17,
317,
310,
341,
394,
1077,
281,
284,
44590,
16,
11,
220,
17,
935,
394,
1077,
281,
25,
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_mul() {
let hw = RefCell::new(CpuHardware::new());
let g = RefCell::new(Graph::new());
let a = 123f32.into_node(&g, &hw);
let b = 456f32.into_node(&g, &hw);
let y = a * b;
let gx = grad(y, &[a, b]);
assert_eq!(gx.len(), 2);
assert_eq!(gx[0].shape(), Shape::new([]));
assert_eq!(gx[1].shape(), Shape::new([]));
assert!(ptr::eq(gx[0].hardware(), &hw));
assert!(ptr::eq(gx[1].hardware(), &hw));
// dy/da == b
assert_eq!(f32::try_from(gx[0]), Ok(456.));
// dy/db == a
assert_eq!(f32::try_from(gx[1]), Ok(123.));
} | rust_cleaned_test_functions.jsonl/83558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
262,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
262,
1077,
342,
284,
8550,
3599,
486,
931,
63779,
486,
931,
5231,
262,
1077,
264,
284,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vnet_helpers() {
let mut frame_buf: [u8; MAX_BUFFER_SIZE] = [42u8; MAX_BUFFER_SIZE];
let vnet_hdr_len_ = mem::size_of::<virtio_net_hdr_v1>();
assert_eq!(vnet_hdr_len_, vnet_hdr_len());
init_vnet_hdr(&mut frame_buf);
let zero_vnet_hdr = vec![0u8; vnet_hdr_len_];
assert_eq!(zero_vnet_hdr, &frame_buf[..vnet_hdr_len_]);
let payload = vec![42u8; MAX_BUFFER_SIZE - vnet_hdr_len_];
assert_eq!(payload, frame_bytes_from_buf(&frame_buf));
{
let payload = frame_bytes_from_buf_mut(&mut frame_buf);
payload[0] = 15;
}
assert_eq!(frame_buf[vnet_hdr_len_], 15);
} | rust_cleaned_test_functions.jsonl/63418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
4711,
54473,
368,
341,
286,
1077,
5206,
4034,
10363,
25,
508,
84,
23,
26,
8334,
14394,
4098,
60,
284,
508,
19,
17,
84,
23,
26,
8334,
14394,
4098,
4821,
286,
1077,
348,
4711,
28238,
6043,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder_i32_alloc_zero_bytes() {
let mut b = BufferBuilder::<i32>::new(0);
b.push(123).unwrap();
let a = b.finish();
assert_eq!(4, a.len());
} | rust_cleaned_test_functions.jsonl/127615 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
5318,
18,
17,
14802,
19359,
12524,
368,
341,
286,
1077,
5206,
293,
284,
10312,
3297,
27638,
72,
18,
17,
6831,
931,
7,
15,
317,
286,
293,
2552,
7,
16,
17,
18,
568,
15454,
543,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_primitive_array_lt_eq() {
cmp_i64!(
lt_eq,
&[8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
&[6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
vec![false, false, true, true, true, false, false, true, true, true]
);
} | rust_cleaned_test_functions.jsonl/38873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
39164,
10714,
368,
341,
286,
26089,
5318,
21,
19,
33673,
310,
25175,
10714,
345,
310,
44590,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call_expr() {
check_assist(
inline_local_variable,
r"
fn foo() {
let a$0 = bar(10 + 1);
let b = a * 10;
let c = a as usize;
}",
r"
fn foo() {
let b = bar(10 + 1) * 10;
let c = bar(10 + 1) as usize;
}",
);
} | rust_cleaned_test_functions.jsonl/3229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
435,
698,
8822,
15229,
368,
341,
262,
1077,
264,
3,
15,
284,
3619,
7,
16,
15,
488,
220,
16,
317,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shared_namespace() {
let ns = "ns";
let key = "key";
let path_buf = TempPath::new().path().to_path_buf();
let storage = OnDiskStorage::new(path_buf.clone());
let nss_default = NamespacedStorage::new(storage, None);
let storage = OnDiskStorage::new(path_buf.clone());
let mut nss = NamespacedStorage::new(storage, Some(ns.into()));
let storage = OnDiskStorage::new(path_buf);
let another_nss = NamespacedStorage::new(storage, Some(ns.into()));
nss.create(key, Value::U64(1), &Policy::public()).unwrap();
nss_default.get(key).unwrap_err();
assert_eq!(nss.get(key).unwrap().value, Value::U64(1));
assert_eq!(another_nss.get(key).unwrap().value, Value::U64(1));
} | rust_cleaned_test_functions.jsonl/79216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20405,
41571,
368,
341,
286,
1077,
12268,
284,
330,
4412,
876,
286,
1077,
1376,
284,
330,
792,
3302,
286,
1077,
1815,
10363,
284,
19944,
1820,
486,
931,
1005,
2343,
1005,
983,
2638,
10363,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_manager__config_dir_create() -> TestResult {
let cm = ConfigManager {};
let (_config_dir, _tmp_dir) = set_config_dir()?;
let actual = cm.config_dir_create();
env::remove_var("HOME");
assert!(actual.is_ok());
Ok(())
} | rust_cleaned_test_functions.jsonl/81012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
12144,
563,
1676,
4334,
8657,
368,
1464,
3393,
2077,
341,
286,
1077,
9961,
284,
5532,
2043,
9321,
286,
1077,
5453,
1676,
4334,
11,
716,
5173,
4334,
8,
284,
738,
5332,
4334,
368,
69493,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_table_reader_checksum() {
let (mut src, size) = build_table(build_data());
src[10] += 1;
let table = Table::new(Options::default(), wrap_buffer(src), size).unwrap();
assert!(table.filters.is_some());
assert_eq!(table.filters.as_ref().unwrap().num(), 1);
{
let mut _iter = table.iter();
let iter = SSIteratorIter::wrap(&mut _iter);
// first block is skipped
assert_eq!(iter.count(), 4);
}
{
let mut _iter = table.iter();
let iter = SSIteratorIter::wrap(&mut _iter);
for (k, _) in iter {
if k == build_data()[5].0.as_bytes() {
return;
}
}
panic!("Should have hit 5th record in table!");
}
} | rust_cleaned_test_functions.jsonl/3810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
22306,
64038,
368,
341,
286,
1077,
320,
6984,
2286,
11,
1379,
8,
284,
1936,
5237,
43333,
1769,
5231,
286,
2286,
58,
16,
15,
60,
1421,
220,
16,
401,
286,
1077,
1965,
284,
6633,
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... | 3 |
#[test]
fn test_split_atom() {
assert_eq!(
split_atom("truc | arg:val"),
vec!["truc", " ", "", "|", "", " ", "arg", ":", "val"]
);
assert_eq!(
split_atom("truc | filter:arg1,arg2"),
vec![
"truc", " ", "", "|", "", " ", "filter", ":", "arg1", ",", "arg2",
]
);
} | rust_cleaned_test_functions.jsonl/65645 | {
"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,
17052,
42292,
368,
341,
286,
2060,
10714,
33673,
310,
6718,
42292,
445,
376,
1754,
760,
1392,
25,
831,
4461,
310,
7486,
0,
1183,
376,
1754,
497,
330,
3670,
7342,
25203,
497,
7342,
330,
3670,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_quoted_string() {
assert_eq!(parse_quoted_string(FileSpan::new(Rc::new(String::from("\"test\"")), Rc::new(String::from("input")))).unwrap().1, IdentValue{
span: FileSpan {
data: Rc::new(String::from("\"test\"")),
filename: Rc::new(String::from("input")),
offset: 0,
length: "\"test\"".len(),
line: 1,
},
value: String::from("test")
});
} | rust_cleaned_test_functions.jsonl/68346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11280,
9253,
3904,
368,
341,
262,
2060,
10714,
10297,
6400,
11280,
9253,
3904,
19821,
12485,
486,
931,
2785,
66,
486,
931,
2242,
486,
1499,
38915,
1944,
2105,
35674,
81463,
486,
931,
2242,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_node_hints_includes_single_channels_to_participating_nodes() {
let mut chanmon_cfgs = create_chanmon_cfgs(3);
let seed_1 = [42 as u8; 32];
let seed_2 = [43 as u8; 32];
let cross_node_seed = [44 as u8; 32];
chanmon_cfgs[1].keys_manager.backing = PhantomKeysManager::new(&seed_1, 43, 44, &cross_node_seed);
chanmon_cfgs[2].keys_manager.backing = PhantomKeysManager::new(&seed_2, 43, 44, &cross_node_seed);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let chan_0_1 = create_unannounced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 10001, InitFeatures::known(), InitFeatures::known());
let chan_0_2 = create_unannounced_chan_between_nodes_with_value(&nodes, 0, 2, 100000, 10001, InitFeatures::known(), InitFeatures::known());
let mut scid_aliases = HashSet::new();
scid_aliases.insert(chan_0_1.0.short_channel_id_alias.unwrap());
scid_aliases.insert(chan_0_2.0.short_channel_id_alias.unwrap());
match_multi_node_invoice_routes(
Some(10_000),
&nodes[1],
vec![&nodes[1], &nodes[2],],
scid_aliases,
false
);
} | rust_cleaned_test_functions.jsonl/65878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
5084,
1523,
21042,
1243,
7396,
19487,
19291,
2346,
10495,
8442,
1095,
14896,
368,
341,
197,
10217,
5206,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
18,
317,
197,
10217,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_op_delete_canonical_serialization_example() {
let input = WriteOp::Deletion;
let expected_output = vec![0x00];
let actual_output = to_bytes(&input).unwrap();
assert_eq!(expected_output, actual_output);
} | rust_cleaned_test_functions.jsonl/8060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
10287,
11353,
27421,
22391,
25602,
2022,
39304,
368,
341,
262,
1077,
1946,
284,
9645,
7125,
486,
1912,
52625,
280,
262,
1077,
3601,
7645,
284,
7486,
20703,
15,
87,
15,
15,
4821,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_with_fields() {
let t = WithFieldsTemplate {
names: (
Name {
first: "foo",
last: "bar",
},
Name {
first: "fOO",
last: "bAR",
},
),
}; // instantiate your struct
assert_eq!("Hello, foo bar and fOO bAR!", t.call().unwrap()); // then call it.
} | rust_cleaned_test_functions.jsonl/92835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
12132,
368,
341,
262,
1077,
259,
284,
3085,
8941,
7275,
341,
286,
5036,
25,
2399,
310,
3988,
341,
394,
1156,
25,
330,
7975,
756,
394,
1537,
25,
330,
2257,
756,
310,
1153,
310,
3988,
341,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction_missing_key() {
let keypair = Keypair::new();
Transaction::new_unsigned_instructions(&[]).sign(&[&keypair], Hash::default());
} | rust_cleaned_test_functions.jsonl/20131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
40447,
3097,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
17869,
486,
931,
67830,
82427,
2099,
1294,
568,
7752,
2099,
58,
5,
792,
12670,
1125,
6531,
486,
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 |
#[test]
fn test_set_operator() {
let storage_helper = StorageHelper::new();
let local_owner_ns = "local";
let remote_owner_ns = "owner";
storage_helper.initialize_by_idx(local_owner_ns.into(), 0);
// Upload an operator key to the remote storage
let operator_name = "operator";
let operator_key = Ed25519PrivateKey::generate_for_testing().public_key();
let mut shared_storage = storage_helper.storage(operator_name.into());
shared_storage
.set(OPERATOR_KEY, operator_key)
.map_err(|e| Error::StorageWriteError("shared", OPERATOR_KEY, e.to_string()))
.unwrap();
// Owner calls the set-operator command
let local_operator_name = storage_helper
.set_operator(operator_name, remote_owner_ns)
.unwrap();
// Verify that a file setting the operator was uploaded to the remote storage
let shared_storage = storage_helper.storage(remote_owner_ns.into());
let uploaded_operator_name = shared_storage
.get::<String>(constants::VALIDATOR_OPERATOR)
.unwrap()
.value;
assert_eq!(local_operator_name, uploaded_operator_name);
} | rust_cleaned_test_functions.jsonl/86345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
40594,
368,
341,
286,
1077,
5819,
10418,
284,
14693,
5511,
486,
931,
543,
286,
1077,
2205,
29027,
34728,
284,
330,
2438,
876,
286,
1077,
8699,
29027,
34728,
284,
330,
8118,
876,
286,
5819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derive_display_from_serialize_lifetimes() {
use serde_derive::Serialize;
#[derive(Serialize)]
struct MyType<'a>(&'a str);
mod inner {
use serde_derive::Serialize;
#[derive(Serialize)]
pub struct MyType<'a>(pub &'a str);
}
derive_display_from_serialize!(MyType<'a>);
derive_display_from_serialize!(inner::MyType<'a>);
assert_eq!(MyType("x").to_string(), "x");
assert_eq!(inner::MyType("x").to_string(), "x");
} | rust_cleaned_test_functions.jsonl/36610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
14825,
5673,
88686,
907,
333,
6889,
368,
341,
262,
990,
61570,
35345,
533,
486,
15680,
401,
262,
11506,
27098,
3759,
9050,
5563,
262,
2036,
3017,
929,
18291,
64,
44784,
6,
64,
607,
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_mul() {
let p = Affine::new(
field_element!("01ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca"),
field_element!("005668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"),
);
let c = ScalarFieldElement::from(u256h!(
"07374b7d69dc9825fc758b28913c8d2a27be5e7c32412f612b20c9c97afbe4dd"
));
let expected = Affine::new(
field_element!("00f24921907180cd42c9d2d4f9490a7bc19ac987242e80ac09a8ac2bcf0445de"),
field_element!("018a7a2ab4e795405f924de277b0e723d90eac55f2a470d8532113d735bdedd4"),
);
let result = p * c;
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/107420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
286,
1077,
281,
284,
9748,
482,
486,
931,
1006,
310,
2070,
7894,
17223,
15,
16,
823,
16,
20,
66,
16,
23,
20,
24,
24,
24,
22,
16,
65,
22,
16692,
291,
19,
16,
20,
64,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixed_schema() {
let schema = Schema::parse_str(r#"{"type": "fixed", "name": "test", "size": 16}"#).unwrap();
let expected = Schema::Fixed {
name: Name::new("test"),
size: 16usize,
};
assert_eq!(expected, schema);
} | rust_cleaned_test_functions.jsonl/26533 | {
"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,
37839,
25371,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
2601,
55543,
4913,
1313,
788,
330,
22021,
497,
330,
606,
788,
330,
1944,
497,
330,
2141,
788,
220,
16,
21,
9863,
2,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_datetime() {
let time1 = "2010-04-10";
let time11 = "19600410";
let time2 = "2012-07-21T07:59:14.322+0000";
let time3 = "20120721075914";
// java miniseconds
let time4 = "1316563200000";
let time5 = "628646400000";
assert_eq!(parse_datetime(time1).unwrap(), 20100410);
assert_eq!(parse_datetime(time11).unwrap(), 19600410);
assert_eq!(parse_datetime(time2).unwrap(), 20120721075914322);
assert_eq!(parse_datetime(time3).unwrap(), 20120721075914);
assert_eq!(parse_datetime(time4).unwrap(), 20110921000000000);
assert_eq!(parse_datetime(time5).unwrap(), 19891203000000000);
} | rust_cleaned_test_functions.jsonl/133826 | {
"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,
21039,
28943,
368,
341,
286,
1077,
882,
16,
284,
330,
17,
15,
16,
15,
12,
15,
19,
12,
16,
15,
876,
286,
1077,
882,
16,
16,
284,
330,
16,
24,
21,
15,
15,
19,
16,
15,
876,
286,
1077,
882... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long() {
assert_eq!(
Variant::VDouble(1.1).plus(Variant::VLong(2)).unwrap(),
Variant::VDouble(3.1)
);
} | rust_cleaned_test_functions.jsonl/84537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
7378,
7,
16,
13,
16,
568,
7138,
12410,
15341,
486,
53,
6583,
7,
17,
4579,
15454,
3148,
503,
39292,
486,
53,
7378,
7,
18,
13,
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 |
#[test]
fn test_daemon_plugin_start_session() -> Result<()> {
let mut x = TestDaemonPlugin::default();
let actual = run(x.start_session())?;
assert_eq!(actual, Some(json!(0)));
assert_eq!(x.0.get_mut(), &mut 1);
Ok(())
} | rust_cleaned_test_functions.jsonl/48132 | {
"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,
47070,
7291,
23110,
4906,
12316,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
856,
284,
3393,
89177,
11546,
486,
2258,
1428,
286,
1077,
5042,
284,
1598,
2075,
4962,
12316,
2140,
69493,
23459,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_big_decimal_zero() -> IonResult<()> {
let mut cursor = ion_cursor_for(&[0x50]);
assert_eq!(cursor.next()?, Some(Value(IonType::Decimal, false)));
assert_eq!(
cursor.read_big_decimal()?,
Some(BigDecimal::new(0i64.into(), 0))
);
Ok(())
} | rust_cleaned_test_functions.jsonl/82737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
36386,
74429,
19359,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
5206,
8128,
284,
27672,
28601,
5478,
2099,
58,
15,
87,
20,
15,
2558,
286,
2060,
10714,
10297,
17437,
4529,
368,
12622,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_create_stake_account_from_seed() {
let vote_keypair = Keypair::new();
let vote_pubkey = vote_keypair.pubkey();
let identity_keypair = Keypair::new();
let identity_pubkey = identity_keypair.pubkey();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config_with_leader(
100_000_000_000,
&panoptes_sdk::pubkey::new_rand(),
1_000_000,
);
let bank = Bank::new(&genesis_config);
let mint_pubkey = mint_keypair.pubkey();
let bank = Arc::new(bank);
let bank_client = BankClient::new_shared(&bank);
let seed = "test-string";
let stake_pubkey = Pubkey::create_with_seed(&mint_pubkey, seed, &stake::program::id()).unwrap();
// Create Vote Account
let message = Message::new(
&vote_instruction::create_account(
&mint_pubkey,
&vote_pubkey,
&VoteInit {
node_pubkey: identity_pubkey,
authorized_voter: vote_pubkey,
authorized_withdrawer: vote_pubkey,
commission: 50,
},
10,
),
Some(&mint_pubkey),
);
bank_client
.send_and_confirm_message(&[&mint_keypair, &vote_keypair, &identity_keypair], message)
.expect("failed to create vote account");
let authorized = Authorized::auto(&mint_pubkey);
// Create stake account and delegate to vote account
let message = Message::new(
&stake_instruction::create_account_with_seed_and_delegate_stake(
&mint_pubkey,
&stake_pubkey,
&mint_pubkey,
seed,
&vote_pubkey,
&authorized,
&Lockup::default(),
1_000_000,
),
Some(&mint_pubkey),
);
bank_client
.send_and_confirm_message(&[&mint_keypair], message)
.expect("failed to create and delegate stake account");
// Test that correct lamports are staked
let account = bank.get_account(&stake_pubkey).expect("account not found");
let stake_state = account.state().expect("couldn't unpack account data");
if let StakeState::Stake(_meta, stake) = stake_state {
assert_eq!(stake.delegation.stake, 1_000_000);
} else {
panic!("wrong account type found")
}
} | rust_cleaned_test_functions.jsonl/41425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1071
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
1261,
726,
13500,
5673,
33809,
368,
341,
262,
1077,
6910,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
6910,
34014,
792,
284,
6910,
3097,
12670,
47773,
792,
543,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_group_defaults() {
use CurveAffine;
use CurveProjective;
assert_eq!(G1::default(), G1::zero());
assert_eq!(G2::default(), G2::zero());
assert_eq!(G1Affine::default(), G1Affine::zero());
assert_eq!(G2Affine::default(), G2Affine::zero());
} | rust_cleaned_test_functions.jsonl/28084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
42290,
368,
341,
262,
990,
53677,
25841,
482,
280,
262,
990,
53677,
7849,
533,
280,
262,
2060,
10714,
10297,
38,
16,
486,
2258,
1507,
479,
16,
486,
14154,
1423,
262,
2060,
10714,
10297,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simplity_optimized_plan_support_projection() {
let table_scan = test_table_scan();
let plan = LogicalPlanBuilder::from(table_scan)
.project(vec![col("a"), col("d"), col("b").eq(lit(false))])
.unwrap()
.build()
.unwrap();
let expected = "\
Projection: #test.a, #test.d, NOT #test.b AS test.b = Boolean(false)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
} | rust_cleaned_test_functions.jsonl/19700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6383,
487,
15032,
45706,
26564,
25827,
72738,
368,
341,
286,
1077,
1965,
28857,
284,
1273,
5237,
28857,
543,
286,
1077,
3119,
284,
62069,
20485,
3297,
486,
1499,
15761,
28857,
340,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_roll() {
let temp_dir = TempDir::new("test_derive_key").unwrap();
let temp_dir_str = format!("{}/", temp_dir.path().display());
let launches = vec![1u32; 29];
let mut opt = DiceOptions {
faces: Base::_20,
bits: Bits::_128,
key_name: "a".to_string(),
launches,
qr_version: 14,
};
roll(&temp_dir_str, Network::Testnet, &opt).unwrap();
opt.launches = vec![1u32; 28];
opt.key_name = "b".to_string();
let result = roll(&temp_dir_str, Network::Testnet, &opt);
assert!(result.is_err());
assert_eq!(
result.unwrap_err().to_string(),
"Need 29 dice launches (-l) to achieve 128 bits of entropy (provided: 28)"
);
opt.launches = vec![21u32; 29];
opt.key_name = "c".to_string();
let result = roll(&temp_dir_str, Network::Testnet, &opt);
assert!(result.is_err());
assert_eq!(
result.unwrap_err().to_string(),
"Numbers must be from 1 to 20 included"
);
let mut launches = vec![1u32; 29];
if let Some(last) = launches.last_mut() {
*last = 2;
}
opt.launches = launches;
opt.key_name = "d".to_string();
let master_key = roll(&temp_dir_str, Network::Bitcoin, &opt).unwrap();
assert_eq!(master_key.key.dice.unwrap().value, "1");
assert_eq!("xprv9s21ZrQH143K3YSbAXLMPCzJso5QAarQksAGc5rQCyZCBfw4Rj2PqVLFNgezSBhktYkiL3Ta2stLPDF9yZtLMaxk6Spiqh3DNFG8p8MVeEC", master_key.key.xprv.to_string());
} | rust_cleaned_test_functions.jsonl/39500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 835
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57578,
368,
341,
286,
1077,
2730,
4334,
284,
19944,
6184,
486,
931,
445,
1944,
35345,
533,
3097,
1827,
15454,
543,
286,
1077,
2730,
4334,
2895,
284,
3561,
88928,
4472,
497,
2730,
4334,
3875,
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... | 2 |
#[test]
fn test_translate_invalid_cm_fails() {
let input = json!({
"exposes": [
{
}
]
});
let expected_res: Result<fsys::ComponentDecl, Error> =
Err(Error::validate_schema(CM_SCHEMA, "OneOf conditions are not met at /exposes/0"));
let res = translate(&format!("{}", input));
assert_eq!(format!("{:?}", res), format!("{:?}", expected_res));
} | rust_cleaned_test_functions.jsonl/130665 | {
"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,
66381,
31433,
43619,
761,
6209,
368,
341,
286,
1077,
1946,
284,
2951,
0,
2262,
310,
330,
327,
8285,
788,
2278,
394,
341,
394,
456,
310,
5133,
286,
3011,
286,
1077,
3601,
4918,
25,
5714,
27,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder_dupe_field_and_tag() {
let res = SchemaBuilder::new()
.tag("the name")
.influx_field("the name", Integer)
.build();
assert_eq!(
res.unwrap_err().to_string(),
"Error validating schema: Error: Duplicate column name found in schema: 'the name'"
);
} | rust_cleaned_test_functions.jsonl/12638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
814,
85477,
5013,
8378,
9372,
368,
341,
286,
1077,
592,
284,
12539,
3297,
486,
931,
741,
310,
659,
4578,
445,
1782,
829,
1138,
310,
659,
258,
36706,
5013,
445,
1782,
829,
497,
4440,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mime_type_guessing_opt() {
assert_eq!(from_ext("gif").first().unwrap().to_string(), "image/gif".to_string());
assert_eq!(from_ext("TXT").first().unwrap().to_string(), "text/plain".to_string());
assert_eq!(from_ext("blahblah").first(), None);
assert_eq!(
from_path("/path/to/file.gif").first().unwrap().to_string(),
"image/gif".to_string()
);
assert_eq!(from_path("/path/to/file").first(), None);
} | rust_cleaned_test_functions.jsonl/61807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83624,
1819,
54737,
287,
15032,
368,
341,
197,
6948,
10714,
10297,
1499,
9927,
445,
33186,
1827,
3896,
1005,
15454,
1005,
983,
3904,
1507,
330,
1805,
90831,
3263,
983,
3904,
1423,
197,
6948,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_row_should_succeed() {
let matrix = MatrixBuf::new(42, 4.2);
assert_eq!(matrix.as_matrix().row(13)[7], 4.2);
} | rust_cleaned_test_functions.jsonl/34509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
43378,
643,
29264,
368,
341,
262,
1077,
6172,
284,
11631,
15064,
486,
931,
7,
19,
17,
11,
220,
19,
13,
17,
317,
262,
2060,
10714,
10297,
18110,
5357,
10193,
1005,
651,
7,
16,
18,
6620,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rb_insert() {
let mut t: TreeRb<isize, isize> = TreeRb::new();
for i in 0..10 {
t.insert(i, i);
}
t.check_nodes();
} | rust_cleaned_test_functions.jsonl/78794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68544,
17678,
368,
341,
262,
1077,
5206,
259,
25,
8942,
49,
65,
27,
285,
551,
11,
91373,
29,
284,
8942,
49,
65,
486,
931,
543,
262,
369,
600,
304,
220,
15,
496,
16,
15,
341,
286,
259,
7030... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vec_truncate_drop() {
static mut DROPS: u32 = 0;
struct Elem(i32);
impl Drop for Elem {
fn drop(&mut self) {
unsafe {
DROPS += 1;
}
}
}
let mut v = vec![Elem(1), Elem(2), Elem(3), Elem(4), Elem(5)];
assert_eq!(unsafe { DROPS }, 0);
v.truncate(3);
assert_eq!(unsafe { DROPS }, 2);
v.truncate(0);
assert_eq!(unsafe { DROPS }, 5);
} | rust_cleaned_test_functions.jsonl/24406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
3547,
26900,
29584,
368,
341,
262,
1099,
5206,
422,
1285,
5012,
25,
575,
18,
17,
284,
220,
15,
280,
262,
2036,
78768,
1956,
18,
17,
317,
262,
11605,
15733,
369,
78768,
341,
286,
5168,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_non_consuming() {
let h = hlist![9000, "joe", 41f32];
let mapped = h.to_ref().map(hlist![|&n| n + 1, |&s| s, |&f| f + 1f32]);
assert_eq!(mapped, hlist![9001, "joe", 42f32]);
} | rust_cleaned_test_functions.jsonl/24764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
21637,
3382,
61117,
368,
341,
286,
1077,
305,
284,
305,
1607,
20703,
24,
15,
15,
15,
11,
330,
73,
4644,
497,
220,
19,
16,
69,
18,
17,
935,
286,
1077,
23844,
284,
305,
2389,
7793,
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_add() {
assert_eq!(nat(42) + &nat(1337), nat(42 + 1337));
assert_eq!(nat(0) + &nat(0), nat(0));
} | rust_cleaned_test_functions.jsonl/78230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
286,
2060,
10714,
10297,
33297,
7,
19,
17,
8,
488,
609,
33297,
7,
16,
18,
18,
22,
701,
17588,
7,
19,
17,
488,
220,
16,
18,
18,
22,
1106,
286,
2060,
10714,
10297,
33297,
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 |
#[test]
fn test_session_cache() {
let mut sm = SessionManager {
sessions: HashMap::new()
};
let session: Session = Session {
id: 1,
transaction: Default::default(),
};
sm.sessions.insert(1, session);
let session: Session = Session {
id: 2,
transaction: Default::default(),
};
sm.sessions.insert(2, session);
let handle = thread::spawn(|| {
for i in 1..10 {
println!("hi number {} from the spawned thread!", i);
thread::sleep(Duration::from_millis(1));
}
});
handle.join().unwrap();
sm.make_current();
println!("{:?}", SessionManager::current());
let mut new_sm = SessionManager::current().as_ref().clone();
new_sm.sessions.remove(&1).unwrap();
new_sm.make_current();
println!("{:?}", SessionManager::current());
assert_eq!(1, 1);
} | rust_cleaned_test_functions.jsonl/107805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 488
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12316,
11529,
368,
341,
286,
1077,
5206,
1525,
284,
9164,
2043,
341,
310,
15704,
25,
10528,
486,
931,
741,
286,
3634,
286,
1077,
3797,
25,
9164,
284,
9164,
341,
310,
877,
25,
220,
16,
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... | 3 |
#[test]
fn test_from_affine_shear() {
let shear_x_with_y = 2;
let shear_x_with_z = 4;
let shear_y_with_x = 8;
let shear_y_with_z = 7;
let shear_z_with_x = 3;
let shear_z_with_y = 11;
let matrix = Matrix4x4::from_affine_shear(
shear_x_with_y, shear_x_with_z, shear_y_with_x, shear_y_with_z, shear_z_with_x, shear_z_with_y
);
let expected = Vector4::new(
1 + shear_x_with_y + shear_x_with_z,
1 + shear_y_with_x + shear_y_with_z,
1 + shear_z_with_x + shear_z_with_y,
1
);
let result = matrix * Vector4::new(1, 1, 1, 1);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
48914,
482,
643,
86060,
368,
341,
286,
1077,
64244,
3212,
6615,
4178,
284,
220,
17,
280,
286,
1077,
64244,
3212,
6615,
6415,
284,
220,
19,
280,
286,
1077,
64244,
4178,
6615,
3212,
284,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_access_file_exists() {
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("does_exist.txt");
let _file = File::create(path.clone()).unwrap();
assert!(access(&path, AccessFlags::R_OK | AccessFlags::W_OK).is_ok());
} | rust_cleaned_test_functions.jsonl/30623 | {
"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,
12759,
2458,
9766,
368,
341,
262,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
1815,
220,
284,
2730,
3741,
3875,
1005,
5987,
445,
27057,
35906,
3909,
797,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ref_expr() {
check_assist(
inline_local_variable,
"
fn foo() {
let bar = 10;
let a<|> = &bar;
let b = a * 10;
}",
"
fn foo() {
let bar = 10;
<|>let b = &bar * 10;
}",
);
} | rust_cleaned_test_functions.jsonl/60323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
3619,
284,
220,
16,
15,
280,
262,
1077,
264,
27,
91,
29,
284,
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_backup_mode_long_with_args_ambiguous() {
let _dummy = TEST_MUTEX.lock().unwrap();
let matches = make_app().get_matches_from(vec!["app", "--backup=n"]);
let result = determine_backup_mode(&matches);
assert!(result.is_err());
let text = format!("{}", result.unwrap_err());
assert!(text.contains("ambiguous argument 'n' for 'backup type'"));
} | rust_cleaned_test_functions.jsonl/98145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
7302,
17799,
6615,
8384,
62,
90213,
368,
341,
286,
1077,
716,
31390,
284,
13602,
66994,
21003,
1005,
15454,
543,
286,
1077,
9071,
284,
1281,
8191,
1005,
455,
38344,
5673,
25592,
0,
1183,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_class() {
assert_eq!(ErrorCode::F00_BAD_REQUEST.class(), ErrorClass::Final);
assert_eq!(ErrorCode::T00_INTERNAL_ERROR.class(), ErrorClass::Temporary);
assert_eq!(
ErrorCode::R00_TRANSFER_TIMED_OUT.class(),
ErrorClass::Relative
);
assert_eq!(
ErrorCode::new(*b"???")
.expect("questionmarks are accepted")
.class(),
ErrorClass::Unknown
);
} | rust_cleaned_test_functions.jsonl/3926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
368,
341,
286,
2060,
10714,
10297,
30748,
486,
37,
15,
15,
30666,
14454,
3074,
1507,
4600,
1957,
486,
19357,
317,
286,
2060,
10714,
10297,
30748,
486,
51,
15,
15,
31752,
5414,
3074,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tree_builder() {
// 16KiB tree has 512 leaves.
test_tree_builder_aux(None, 512, 32, 512, 512);
test_tree_builder_aux(Some(BatcherType::CPU), 512, 32, 512, 512);
#[cfg(all(feature = "gpu", not(target_os = "macos")))]
test_tree_builder_aux(Some(BatcherType::GPU), 512, 32, 512, 512);
#[cfg(all(feature = "opencl", not(target_os = "macos")))]
test_tree_builder_aux(Some(BatcherType::OpenCL), 512, 32, 512, 512);
} | rust_cleaned_test_functions.jsonl/131055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
28532,
368,
341,
286,
442,
220,
16,
21,
72572,
33,
4916,
702,
220,
20,
16,
17,
10901,
624,
286,
1273,
11663,
28532,
30468,
26717,
11,
220,
20,
16,
17,
11,
220,
18,
17,
11,
220,
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_parses_json_mapping() {
parses_to! {
parser: AwsGoEventsParser,
input: "`json:\"fooBar\"`",
rule: Rule::json_mapping,
tokens: [
json_mapping(0, 15, [
json_name(7, 13),
]),
]
};
parses_to! {
parser: AwsGoEventsParser,
input: "`json:\"foo-x\"`",
rule: Rule::json_mapping,
tokens: [
json_mapping(0, 14, [
json_name(7, 12),
]),
]
};
parses_to! {
parser: AwsGoEventsParser,
input: "`json:\"foo.x\"`",
rule: Rule::json_mapping,
tokens: [
json_mapping(0, 14, [
json_name(7, 12),
]),
]
};
parses_to! {
parser: AwsGoEventsParser,
input: "`json:\"foo,omitempty\"`",
rule: Rule::json_mapping,
tokens: [
json_mapping(0, 22, [
json_name(7, 10),
omit_empty(10, 20),
]),
]
};
parses_to! {
parser: AwsGoEventsParser,
input: "`json:\"fooBar\"` // whatever",
rule: Rule::json_mapping,
tokens: [
json_mapping(0, 27, [
json_name(7, 13),
any_comment(16, 27),
]),
]
};
} | rust_cleaned_test_functions.jsonl/8185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77113,
288,
9455,
26930,
368,
341,
310,
70835,
2346,
0,
341,
394,
6729,
25,
40083,
10850,
7900,
6570,
345,
394,
1946,
25,
35973,
2236,
75035,
7975,
3428,
2105,
63,
756,
394,
5912,
25,
18100,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pow() {
assert_eq!(mint!(2).pow(10), mint!(1024));
assert_eq!(mint!(-2).pow(10), mint!(1024));
assert_eq!(mint!(-2).pow(11), mint!(-2048));
} | rust_cleaned_test_functions.jsonl/52170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
368,
341,
286,
2060,
10714,
10297,
67791,
10297,
17,
568,
21743,
7,
16,
15,
701,
28337,
10297,
16,
15,
17,
19,
1106,
286,
2060,
10714,
10297,
67791,
0,
4080,
17,
568,
21743,
7,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_to() {
assert_eq!(&"abcd"[..0], "");
assert_eq!(&"abcd"[..2], "ab");
assert_eq!(&"abcd"[..4], "abcd");
} | rust_cleaned_test_functions.jsonl/63093 | {
"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,
26488,
2346,
368,
341,
262,
2060,
10714,
0,
2099,
1,
68644,
36864,
496,
15,
1125,
14498,
262,
2060,
10714,
0,
2099,
1,
68644,
36864,
496,
17,
1125,
330,
370,
797,
262,
2060,
10714,
0,
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 |
#[test]
fn test_tuple_impl() {
let foo = Tuple::from_tuple((3, 5, "bar".into()));
assert_eq!(foo.into_tuple(), (3, 5, "bar".into()));
} | rust_cleaned_test_functions.jsonl/121833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
21007,
368,
341,
262,
1077,
15229,
284,
24622,
486,
1499,
21773,
1188,
18,
11,
220,
20,
11,
330,
2257,
3263,
18122,
7392,
262,
2060,
10714,
10297,
7975,
39860,
21773,
1507,
320,
18,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_scid_from_parts() {
assert_eq!(scid_from_parts(0x00000000, 0x00000000, 0x0000).unwrap(), 0x000000_000000_0000);
assert_eq!(scid_from_parts(0x00000001, 0x00000002, 0x0003).unwrap(), 0x000001_000002_0003);
assert_eq!(scid_from_parts(0x00111111, 0x00222222, 0x3333).unwrap(), 0x111111_222222_3333);
assert_eq!(scid_from_parts(0x00ffffff, 0x00ffffff, 0xffff).unwrap(), 0xffffff_ffffff_ffff);
assert_eq!(scid_from_parts(0x01ffffff, 0x00000000, 0x0000).err().unwrap(), ShortChannelIdError::BlockOverflow);
assert_eq!(scid_from_parts(0x00000000, 0x01ffffff, 0x0000).err().unwrap(), ShortChannelIdError::TxIndexOverflow);
assert_eq!(scid_from_parts(0x00000000, 0x00000000, 0x010000).err().unwrap(), ShortChannelIdError::VoutIndexOverflow);
} | rust_cleaned_test_functions.jsonl/5993 | {
"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,
13171,
307,
5673,
33217,
368,
341,
197,
6948,
10714,
10297,
2388,
307,
5673,
33217,
7,
15,
87,
15,
15,
15,
15,
15,
15,
15,
15,
11,
220,
15,
87,
15,
15,
15,
15,
15,
15,
15,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_archive_basename() {
assert_eq!(
Node::archive_basename("1.2.3"),
format!("node-v1.2.3-{}-{}", NODE_DISTRO_OS, NODE_DISTRO_ARCH)
);
} | rust_cleaned_test_functions.jsonl/98940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
42873,
81135,
368,
341,
286,
2060,
10714,
33673,
310,
6018,
486,
16019,
81135,
445,
16,
13,
17,
13,
18,
4461,
310,
3561,
17223,
3509,
8273,
16,
13,
17,
13,
18,
12,
6257,
12,
42351,
34817... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_suggested_rule_specializer() -> TestResult {
let p = polar();
let repo_instance = ExternalInstance {
instance_id: 1,
constructor: None,
repr: None,
class_repr: None,
};
let repo_term = term!(Value::ExternalInstance(repo_instance.clone()));
let repo_name = sym!("Repository");
p.register_constant(repo_name.clone(), repo_term)?;
p.register_mro(repo_name, vec![repo_instance.instance_id])?;
let user_instance = ExternalInstance {
instance_id: 2,
constructor: None,
repr: None,
class_repr: None,
};
let user_term = term!(Value::ExternalInstance(user_instance.clone()));
let user_name = sym!("User");
p.register_constant(user_name.clone(), user_term)?;
p.register_mro(user_name, vec![user_instance.instance_id])?;
let policy = r#"
actor User {}
resource Repository {
permissions = ["read"];
roles = ["contributor"];
"read" if "contributor";
}
has_role(actor: User, role_name, repository: Repository) if
role in actor.roles and
role_name = role.name and
repository = role.repository;
"#;
qvalidation!(
p,
policy,
InvalidRule { .. },
"Failed to match because: Parameter `role_name` expects a String type constraint."
);
Ok(())
} | rust_cleaned_test_functions.jsonl/68166 | {
"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,
643,
53276,
21124,
41629,
3135,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
1428,
262,
1077,
15867,
11904,
284,
30936,
2523,
341,
286,
2867,
842,
25,
220,
16,
345,
286,
4692,
25,
224... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_keysend_hash_mismatch() {
// preimage doesn't match the msg's payment hash.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let payer_pubkey = nodes[0].node.get_our_node_id();
let payee_pubkey = nodes[1].node.get_our_node_id();
nodes[0].node.peer_connected(&payee_pubkey, &msgs::Init { features: InitFeatures::known() });
nodes[1].node.peer_connected(&payer_pubkey, &msgs::Init { features: InitFeatures::known() });
let _chan = create_chan_between_nodes(&nodes[0], &nodes[1], InitFeatures::known(), InitFeatures::known());
let network_graph = nodes[0].net_graph_msg_handler.network_graph.read().unwrap();
let first_hops = nodes[0].node.list_usable_channels();
let route = get_keysend_route(&payer_pubkey, &network_graph, &payee_pubkey,
Some(&first_hops.iter().collect::<Vec<_>>()), &vec![], 10000, 40,
nodes[0].logger).unwrap();
let test_preimage = PaymentPreimage([42; 32]);
let mismatch_payment_hash = PaymentHash([43; 32]);
let _ = nodes[0].node.send_payment_internal(&route, mismatch_payment_hash, &None, Some(test_preimage)).unwrap();
check_added_monitors!(nodes[0], 1);
let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
assert_eq!(updates.update_add_htlcs.len(), 1);
assert!(updates.update_fulfill_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
assert!(updates.update_fee.is_none());
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
nodes[1].logger.assert_log_contains("lightning::ln::channelmanager".to_string(), "Payment preimage didn't match payment hash".to_string(), 1);
} | rust_cleaned_test_functions.jsonl/94568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 817
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
6681,
8950,
717,
24976,
368,
341,
2394,
197,
197,
322,
855,
1805,
3171,
944,
2432,
279,
3750,
594,
8160,
5175,
624,
197,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fchdir() {
// fchdir changes the process's cwd
let _dr = crate::DirRestore::new();
let tmpdir = tempdir().unwrap();
let tmpdir_path = tmpdir.path().canonicalize().unwrap();
let tmpdir_fd = File::open(&tmpdir_path).unwrap().into_raw_fd();
assert!(fchdir(tmpdir_fd).is_ok());
assert_eq!(getcwd().unwrap(), tmpdir_path);
assert!(close(tmpdir_fd).is_ok());
} | rust_cleaned_test_functions.jsonl/104807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
331,
3741,
368,
341,
262,
442,
282,
331,
3741,
4344,
279,
1882,
594,
46938,
198,
262,
1077,
716,
3612,
284,
17717,
486,
6184,
56284,
486,
931,
1428,
262,
1077,
4174,
3741,
284,
2730,
3741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_weighted_select_num_1() {
let num_trials = 100;
let nums = &[1, 2, 3, 4];
let probabilities = &[0.1, 0.5, 0.2, 0.2];
let threshold = 10.0;
let occurrences = execute_n_trials(num_trials, nums, probabilities);
for (idx, n) in nums.iter().enumerate() {
let target = num_trials as f32 * probabilities[idx];
let actual = *occurrences.get(&n).unwrap() as f32;
println!("Target: {}, Actual: {}", target, actual);
assert_eq!(
actual >= (target - threshold) && actual <= (target + threshold),
true
);
}
} | rust_cleaned_test_functions.jsonl/73579 | {
"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,
22644,
15876,
291,
13051,
4273,
62,
16,
368,
341,
262,
1077,
1629,
75845,
284,
220,
16,
15,
15,
280,
262,
1077,
10307,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_unterminated_normal_string() {
{
let code = r#"""#;
let tokenization_result = tokenize(code);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedNormalString
),
_ => panic!(),
},
_ => panic!(),
}
}
{
let code = r#""a"#;
let tokenization_result = tokenize(code);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedNormalString
),
_ => panic!(),
},
_ => panic!(),
}
}
{
let code = r#""a\"#;
let tokenization_result = tokenize(code);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedNormalString
),
_ => panic!(),
},
_ => panic!(),
}
}
{
let code = r#""a\""#;
let tokenization_result = tokenize(code);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedNormalString
),
_ => panic!(),
},
_ => panic!(),
}
}
{
let tokenization_result = tokenize(r#""a\"c"#);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedNormalString
),
_ => panic!(),
},
_ => panic!(),
}
}
} | rust_cleaned_test_functions.jsonl/116462 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
68659,
13973,
3904,
368,
341,
286,
341,
310,
1077,
2038,
284,
435,
2,
12599,
2,
280,
310,
1077,
3950,
2022,
5287,
284,
77651,
15842,
317,
310,
2432,
3950,
2022,
5287,
341,
394,
15495,
1141... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_request() {
use helix::*;
let req = DeleteChannelStreamScheduleSegmentRequest::builder()
.to_id("41245072".to_string())
.from_id("41245071".to_string())
.build();
// From twitch docs
let data = br#""#.to_vec();
let http_response = http::Response::builder().status(204).body(data).unwrap();
// FIXME: I have not tested this in production
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/schedule/follows?from_id=41245071&to_id=41245072"
);
dbg!(
DeleteChannelStreamScheduleSegmentRequest::parse_response(Some(req), &uri, http_response)
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/108175 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
10428,
9629,
3027,
32210,
21086,
1900,
486,
17850,
741,
286,
659,
983,
842,
445,
19,
16,
17,
19,
20,
15,
22,
17,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reverse_bit_numbering() {
for _ in 0..100 {
let mut cs = TestConstraintSystem::<Bls12>::new();
let rng = &mut XorShiftRng::from_seed(crate::TEST_SEED);
let val_fr = Fr::random(rng);
let val_vec = fr_into_bytes(&val_fr);
let val_num = num::AllocatedNum::alloc(cs.namespace(|| "val_num"), || Ok(val_fr))
.expect("alloc failure");
let val_num_bits = val_num
.to_bits_le(cs.namespace(|| "val_bits"))
.expect("to_bits_le failure");
let bits =
bytes_into_boolean_vec_be(cs.namespace(|| "val_bits_2"), Some(&val_vec), 256)
.expect("bytes_into_boolean_vec_be failure");
let val_num_reversed_bit_numbering = reverse_bit_numbering(val_num_bits);
let a_values: Vec<bool> = val_num_reversed_bit_numbering
.iter()
.map(|v| v.get_value().expect("get_value failure"))
.collect();
let b_values: Vec<bool> = bits
.iter()
.map(|v| v.get_value().expect("get_value failure"))
.collect();
assert_eq!(&a_values[..], &b_values[..]);
}
} | rust_cleaned_test_functions.jsonl/46589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 691
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
13996,
5500,
287,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
341,
310,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
33,
4730,
16,
17,
6831,
931,
543,
310,
1077,
28422,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_primitive_array_divide_f64() {
let a = Float64Array::from(vec![15.0, 15.0, 8.0]);
let b = Float64Array::from(vec![5.0, 6.0, 8.0]);
let c = divide(&a, &b).unwrap();
assert!(3.0 - c.value(0) < f64::EPSILON);
assert!(2.5 - c.value(1) < f64::EPSILON);
assert!(1.0 - c.value(2) < f64::EPSILON);
} | rust_cleaned_test_functions.jsonl/17859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
16237,
577,
761,
21,
19,
368,
341,
286,
1077,
264,
284,
13001,
21,
19,
1857,
486,
1499,
25592,
20703,
16,
20,
13,
15,
11,
220,
16,
20,
13,
15,
11,
220,
23,
13,
15,
2558,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ord() {
let dies = Orthographia::try_from_ascii("die's").unwrap();
let hora = Orthographia::try_from_canonical("h\u{014d}ra").unwrap();
assert!(dies < hora);
assert!(hora > dies);
} | rust_cleaned_test_functions.jsonl/102147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67324,
368,
341,
262,
1077,
8725,
284,
31110,
3178,
685,
486,
1539,
5673,
50238,
445,
26493,
594,
1827,
15454,
543,
262,
1077,
34120,
284,
31110,
3178,
685,
486,
1539,
5673,
27421,
22391,
445,
71,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_foo() {
let arr = [0.0, 1.0, 2.0, 3.0];
let mut arr = Data::new(arr);
arr.order_statistic(2);
} | rust_cleaned_test_functions.jsonl/81935 | {
"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,
761,
2624,
368,
341,
286,
1077,
2890,
284,
508,
15,
13,
15,
11,
220,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
935,
286,
1077,
5206,
2890,
284,
2885,
486,
931,
10939,
317,
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 |
#[test]
fn test_scalar_mul2() {
let base_point = Secp256r1Point::generator();
let int: Secp256r1Scalar = ECScalar::from(&BigInt::from(2));
let test = base_point * int;
assert_eq!(
test.x_coor().unwrap().to_hex(),
"7CF27B188D034F7E8A52380304B51AC3C08969E277F21B35A60B48FC47669978".to_lowercase()
);
assert_eq!(
format!("{:0>64}", test.y_coor().unwrap().to_hex()),
"07775510DB8ED040293D9AC69F7430DBBA7DADE63CE982299E04B79D227873D1".to_lowercase()
);
} | rust_cleaned_test_functions.jsonl/12368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
24944,
17,
368,
341,
286,
1077,
2331,
6085,
284,
4520,
79,
17,
20,
21,
81,
16,
2609,
486,
35851,
543,
286,
1077,
526,
25,
4520,
79,
17,
20,
21,
81,
16,
20639,
284,
20633,
20639,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_char() {
assert_eq!(
apply(
r#"
'' +
"#
.trim()
),
Ok(vec![
Token::Char(span(1, 1, "''")),
Token::Symbol(span(1, 4, "+"))
])
)
} | rust_cleaned_test_functions.jsonl/27567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
9232,
368,
341,
286,
2060,
10714,
33673,
310,
3796,
1006,
394,
435,
2,
698,
4605,
3610,
1,
4956,
503,
659,
10666,
741,
310,
2837,
310,
7622,
25592,
90515,
394,
9660,
486,
4768,
66092,
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_verify_uri() {
let private_key = include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/test_vectors/private.der"
));
let idp_metadata_xml = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/test_vectors/idp_2_metadata.xml"
));
let response_instant = "2014-07-17T01:01:48Z".parse::<DateTime<Utc>>().unwrap();
let max_issue_delay = Utc::now() - response_instant + chrono::Duration::seconds(60);
let sp = ServiceProvider {
metadata_url: Some("http://test_accept_signed_with_correct_key.test".into()),
acs_url: Some("http://sp.example.com/demo1/index.php?acs".into()),
idp_metadata: idp_metadata_xml.parse().unwrap(),
max_issue_delay,
..Default::default()
};
let authn_request = sp
.make_authentication_request("http://dummy.fake/saml")
.unwrap();
let signed_request_url = authn_request
.signed_redirect("", private_key)
.unwrap()
.unwrap();
// percent encoeded URL:
// percent encoded URI:
let uri_string: &String = &signed_request_url[url::Position::BeforePath..].to_string();
assert!(uri_string.starts_with("/saml?SAMLRequest="));
let url_verifier =
UrlVerifier::from_x509(&sp.idp_signing_certs().unwrap().unwrap()[0]).unwrap();
assert!(url_verifier
.verify_percent_encoded_request_uri_string(uri_string)
.unwrap(),);
} | rust_cleaned_test_functions.jsonl/124801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 813
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
15572,
368,
341,
286,
1077,
869,
3097,
284,
2924,
12524,
10297,
20164,
33673,
310,
6105,
17223,
34,
7581,
46,
25143,
91120,
8291,
4461,
310,
3521,
1944,
49158,
81001,
75819,
698,
286,
33351,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_h2b() {
let h = "48617473756e65204d696b75";
let b = h2b(h).unwrap();
assert_eq!("Hatsune Miku".as_bytes(), b.as_ref());
} | rust_cleaned_test_functions.jsonl/81062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
17,
65,
368,
341,
256,
1077,
305,
284,
330,
19,
23,
21,
16,
22,
19,
22,
18,
22,
20,
21,
68,
21,
20,
17,
15,
19,
67,
21,
24,
21,
65,
22,
20,
876,
256,
1077,
293,
284,
305,
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_even() {
// byrow=TRUE)
let src = [
229, 67, 95, 146, 232, 51, 229, 241, 169, 161, 15, 52, 45, 175, 98, 197,
];
let expected = [
229, 0, 0, 0, 67, 0, 95, 0, 0, 0, 146, 0, 0, 232, 0, 0, 0, 51, 0, 229, 0, 0, 0, 241,
169, 0, 0, 0, 161, 0, 15, 0, 0, 0, 52, 0, 0, 45, 0, 0, 0, 175, 0, 98, 0, 0, 0, 197,
];
const IMG_W: usize = 4;
const IMG_H: usize = 4;
let mut buf = [0u8; 3 * IMG_W * IMG_H];
let res = debayer_u8(
&mut Cursor::new(&src[..]),
CFA::RGGB,
&mut RasterMut::new(IMG_W, IMG_H, RasterDepth::Depth8, &mut buf),
);
assert!(res.is_ok());
assert_eq!(&buf[..], &expected[..]);
} | rust_cleaned_test_functions.jsonl/100201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68347,
368,
341,
1789,
286,
442,
553,
651,
28,
20611,
340,
286,
1077,
2286,
284,
2278,
310,
220,
17,
17,
24,
11,
220,
21,
22,
11,
220,
24,
20,
11,
220,
16,
19,
21,
11,
220,
17,
18,
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_try_into_linestring_feature_success() {
let json_string = r#"{ "type": "Feature", "properties": { "STREETALL": "GLEASON LAKE DR", "ALT_NAM1": " ", "ALT_NAM2": " ", "TLGID": 43062, "FUN_CLAS": 310, "FC_NAME": "Major Collector", "GlobalID": "{0B911CDA-9962-4D2C-8FBF-BF79DD616DEC}", "Shape_Length": 221.56369527898175 }, "geometry": { "type": "LineString", "coordinates": [ [ 462822.7187, 4980845.5 ], [ 462866.6875, 4980852.0 ], [ 463035.5312, 4980905.5 ] ] } }"#;
let linestring_geojson = json_string
.parse::<GeoJson>()
.expect("Expect that the geojson parsed");
if let GeoJson::Feature(feature) = linestring_geojson {
let linestring_feature: Result<LineStringFeature, _> = feature.try_into();
assert!(
linestring_feature.is_ok(),
"Can convert into LineStringFeature from LineString"
);
} else {
panic!("Linestring geojson did not parse into a feature")
}
} | rust_cleaned_test_functions.jsonl/2872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
45514,
24606,
65040,
17069,
18632,
368,
341,
262,
1077,
2951,
3904,
284,
435,
2,
14129,
330,
1313,
788,
330,
13859,
497,
330,
13193,
788,
314,
330,
784,
55921,
3919,
788,
330,
65557,
35304,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cursor() {
let file = File::open("tests/pi.txt").unwrap();
let mut curs = Cursor::new_pos(file, 10);
let mut buf = [0; 4];
{
curs.read_exact(&mut buf).unwrap();
assert_eq!(&buf, b"3589");
}
curs.seek(SeekFrom::Current(4)).unwrap();
curs.read_exact(&mut buf).unwrap();
assert_eq!(&buf, b"3846");
} | rust_cleaned_test_functions.jsonl/115217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28601,
368,
341,
262,
1077,
1034,
284,
2887,
486,
2508,
445,
23841,
62228,
3909,
1827,
15454,
543,
262,
1077,
5206,
23143,
284,
28067,
486,
931,
6479,
4866,
11,
220,
16,
15,
317,
262,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_optopt_multi() {
let args = vec!["--test=20".to_string(), "-t".to_string(), "30".to_string()];
match Options::new()
.optopt("t", "test", "testing", "TEST")
.parse(&args)
{
Err(OptionDuplicated(_)) => {}
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/52361 | {
"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,
15032,
2912,
25133,
368,
341,
262,
1077,
2827,
284,
7486,
0,
1183,
313,
1944,
28,
17,
15,
3263,
983,
3904,
1507,
6523,
83,
3263,
983,
3904,
1507,
330,
18,
15,
3263,
983,
3904,
33800,
262,
2432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_next_back_str() {
let mut item = Item::new();
item.push(ComponentRef::Crate("std"));
item.push("start");
item.push(ComponentRef::Id(1));
item.push(ComponentRef::Id(2));
item.push("middle");
item.push(ComponentRef::Id(3));
item.push("end");
let mut it = item.iter();
assert_eq!(it.next_back_str(), Some("end"));
assert_eq!(it.next_back(), Some(ComponentRef::Id(3)));
assert_eq!(it.next_back_str(), Some("middle"));
assert_eq!(it.next_back(), Some(ComponentRef::Id(2)));
assert_eq!(it.next_back(), Some(ComponentRef::Id(1)));
assert_eq!(it.next_back_str(), Some("start"));
assert_eq!(it.next_back(), Some(ComponentRef::Crate("std")));
assert_eq!(it.next_back(), None);
} | rust_cleaned_test_functions.jsonl/78650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
3895,
2895,
368,
341,
286,
1077,
5206,
1509,
284,
5739,
486,
931,
1428,
286,
1509,
2552,
55064,
3945,
486,
34,
7698,
445,
1834,
4010,
286,
1509,
2552,
445,
2468,
797,
286,
1509,
2552,
550... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.