This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.txt
560 lines (425 loc) · 11.8 KB
/
test.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
*********************
Hash :bc4a4df27bbce6889ec5343437ef60d21e5850e8
Type: Tag
Tag: 0.0.1
Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669031023
timezone:+0800
init tag
*********************
Hash :993812c2b11d17 b82fe964c25ae70d4e76cb459
Type: Tree
100644 blob ea8c4bf7f35f6f77f75d92ad8ce8349f6e81ddba .gitignore
100644 blob 45ee13a5634e1f9ba85951800397b38b788d9934 Cargo.lock
100644 blob 1c6ec4271e3e75b585e8d150f9758e4ee4890dd5 Cargo.toml
40000 tree bdcf98368efbd51703c7c187d6eed98783fa6e95 src
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 test.txt
40000 tree f4010b9167a3c7d81bc81bfbffbeac0c9e95052f tests
*********************
Hash :18fd2deaaf152c7f1222c52fb2673f6192b375f0
Type: Blob
#[test]
fn test1(){
print!("hello")
}
#[test]
fn thread_muti(){
use std::thread;
use std::sync::{Mutex,Arc};
let counter = Arc::new(Mutex::new(0));
let mut handles = vec![];
for _i in 0..10{
let counter = Arc::clone(&counter);
let handle = thread::spawn(move ||{
let mut num = counter.lock().unwrap();
*num +=1;
});
handles.push(handle);
}
for handle in handles {
handle.join().unwrap();
}
println!("Result : {} ", *counter.lock().unwrap());
}
#[test]
fn thread_main(){
use std::thread;
use std::time::Duration;
let handle = thread::spawn(
||{
for i in 1..10{
println!("handl 1 hi number {} from thread",i );
thread::sleep(Duration::from_millis(1));
}
}
);
let handle2 = thread::spawn(
||{
for i in 1..10{
println!("handl 2 hi number {} from thread",i );
thread::sleep(Duration::from_millis(1));
}
}
);
print!("main thread finish!");
handle.join().unwrap();
handle2.join().unwrap();
}
#[test]
fn class_AveragedCollection(){
pub struct AveragedCollection{
list:Vec<i32>,
average:f64,
}
impl AveragedCollection {
pub fn add(&mut self, value:i32){
self.list.push(value);
self.update_average();
}
pub fn remove(&mut self) -> Option<i32>{
let result = self.list.pop();
match result {
Some(value)=>{
self.update_average();
Some(value)
},
None => None,
}
}
pub fn average(&self)-> f64{
self.average
}
fn update_average(&mut self){
let total :i32 = self.list.iter().sum();
self.average = total as f64 / self.list.len() as f64;
}
}
}
*********************
Hash :c2b6a2d362b0a7b3922a397bf189862c80aa38d4
Type: Tree
100644 blob ea8c4bf7f35f6f77f75d92ad8ce8349f6e81ddba .gitignore
100644 blob 45ee13a5634e1f9ba85951800397b38b788d9934 Cargo.lock
100644 blob 1c6ec4271e3e75b585e8d150f9758e4ee4890dd5 Cargo.toml
40000 tree bdcf98368efbd51703c7c187d6eed98783fa6e95 src
40000 tree 050eb45ca4a01d41fe10f4f36f14f4d51280bcc6 tests
*********************
Hash :926ecfd1e2f3662d3e6010b62239 a3de077ec 3
tree edd9cf1c12393ae3d07f8c481780933e87248700
parent 4a2a192311c70a489dc34e9f88018d2f6ba7edde
author Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669032657
timezone:+0800
committer Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669032657
timezone:+0800
add a text file
*********************
Hash :c8cf5f19aec7847cf13ee7e4f1952a3eaf2ca75a
tree dc85eb090f08916a6a5db3a8ae458094ecb70ebd
parent 4a2a192311c70a489dc34e9f88018d2f6ba7edde
author Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669030865
timezone:+0800
committer Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669030865
timezone:+0800
add name of func
*********************
Hash :4a2a192311c7 a489dc34e9f88 18d2f6ba7edde
tree 577f54d5cb0dcded6f19e81b632c1c2f4abe1674
author Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669030084
timezone:+0800
committer Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669030084
timezone:+0800
init
*********************
Hash : 4584667a6fc1773553d616eb422bae2fad75e2a
Type: Blob
[package]
name = "my_rust"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
*********************
Hash :1cdf298516b06978668522bc4de95d589d19749d
Type: Blob
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "my_rust"
version = "0.1.0"
*********************
Hash :6d4d8ef31b7b3c31639cd5b35ecec682fae3d759
Type: Blob
use std::usize;
#[test]
fn test1(){
print!("hello")
}
#[test]
fn thread_muti(){
use std::thread;
use std::sync::{Mutex,Arc};
let counter = Arc::new(Mutex::new(0));
let mut handles = vec![];
for _i in 0..10{
let counter = Arc::clone(&counter);
let handle = thread::spawn(move ||{
let mut num = counter.lock().unwrap();
*num +=1;
});
handles.push(handle);
}
for handle in handles {
handle.join().unwrap();
}
println!("Result : {} ", *counter.lock().unwrap());
}
#[test]
fn thread_main(){
use std::thread;
use std::time::Duration;
let handle = thread::spawn(
||{
for i in 1..10{
println!("handl 1 hi number {} from thread",i );
thread::sleep(Duration::from_millis(1));
}
}
);
let handle2 = thread::spawn(
||{
for i in 1..10{
println!("handl 2 hi number {} from thread",i );
thread::sleep(Duration::from_millis(1));
}
}
);
print!("main thread finish!");
handle.join().unwrap();
handle2.join().unwrap();
}
#[test]
fn class_f(){
pub struct AveragedCollection{
list:Vec<i32>,
average:f64,
}
impl AveragedCollection {
pub fn add(&mut self, value:i32){
self.list.push(value);
self.update_average();
}
pub fn remove(&mut self) -> Option<i32>{
let result = self.list.pop();
match result {
Some(value)=>{
self.update_average();
Some(value)
},
None => None,
}
}
pub fn average(&self)-> f64{
self.average
}
fn update_average(&mut self){
let total :i32 = self.list.iter().sum();
self.average = total as f64 / self.list.len() as f64;
}
}
}
#[test]
fn git_test(){
use compress::zlib;
use std::fs::File;
use std::path::Path;
use std::io::Read;
use std::error::Error;
use std::usize;
let stream = File::open(&Path::new(".git/objects/d6/d3d4c3a95f4e699e57fa8d4c943e1fec5fcd58")).unwrap();
let mut decompressed = Vec::new();
let sized =zlib::Decoder::new(stream).read_to_end(&mut decompressed);
match sized {
Ok(a) => { println!( "len:{}",a)},
Err(e) => {println!("!ERROR:{}",e)}
};
let s = String::from_utf8(decompressed).expect("Found invalid UTF-8");
println!("{}", s);
// println!("{:?}",decompressed);
}
*********************
Hash :9acf5f6ea3c3 b172e9540853953a1e93e913ca2
Type: Blob
new adi
*********************
Hash :dcf5b16e76cce7425d beaef62d79a7d10fce1f5
Type: Blob
*********************
Hash :b37dcb44 7cc3cc02c 818a345787d7010 c77a8
Type: Tree
100644 blob aa36c1e0d709f96d7b356967e16766bafdf63a75 test1.rs
*********************
Hash :798033ecd9b01768ccee 05a7fd192a36cb41f47
Type: Tree
100644 blob ea8c4bf7f35f6f77f75d92ad8ce8349f6e81ddba .gitignore
100644 blob 45ee13a5634e1f9ba85951800397b38b788d9934 Cargo.lock
100644 blob 1c6ec4271e3e75b585e8d150f9758e4ee4890dd5 Cargo.toml
40000 tree bdcf98368efbd51703c7c187d6eed98783fa6e95 src
40000 tree f4010b9167a3c7d81bc81bfbffbeac0c9e95052f tests
*********************
Hash :31c63efe74a7d9ab974e7ab455cd73 65e2a309b
Type: Tree
100644 blob cd64b12b3949483d42d34979a3f89589aad804c2 test1.rs
*********************
Hash :6e6882 191b0 eb9b5cb623c2e b1dc79c9f1565
Type: Tree
100644 blob cf4bb1bb12663111732935c66b1c7e2621f28407 main.rs
*********************
Hash :2cb016eab9c744aa75a4edc379e877dfbb1d63c0
Type: Blob
/target
*********************
Hash :26ba dc7b4a3d1289e7f94df8e23418ea41256b4
Type: Blob
use std::thread;
use std::time::Duration;
fn main(){
let handle = thread::spawn(
||{
for i in 1..10{
println!("handl 1 hi number {} from thread",i );
thread::sleep(Duration::from_millis(1));
}
}
);
let handle2 = thread::spawn(
||{
for i in 1..10{
println!("handl 2 hi number {} from thread",i );
thread::sleep(Duration::from_millis(1));
}
}
);
print!("main thread finish!");
handle.join().unwrap();
handle2.join().unwrap();
}
*********************
Hash :4ce7824bddbf78b51e4de011e76e b23dab48e44
Type: Tree
100644 blob 2f81635fd774e693d7c3eb319427d93d22eabf1d test1.rs
*********************
Hash :d95b64f87e2441c330357120de47574676af8e24
Type: Blob
#[test]
fn test1(){
print!("hello")
}
#[test]
fn thread_muti(){
use std::thread;
use std::sync::{Mutex,Arc};
let counter = Arc::new(Mutex::new(0));
let mut handles = vec![];
for _i in 0..10{
let counter = Arc::clone(&counter);
let handle = thread::spawn(move ||{
let mut num = counter.lock().unwrap();
*num +=1;
});
handles.push(handle);
}
for handle in handles {
handle.join().unwrap();
}
println!("Result : {} ", *counter.lock().unwrap());
}
#[test]
fn thread_main(){
use std::thread;
use std::time::Duration;
let handle = thread::spawn(
||{
for i in 1..10{
println!("handl 1 hi number {} from thread",i );
thread::sleep(Duration::from_millis(1));
}
}
);
let handle2 = thread::spawn(
||{
for i in 1..10{
println!("handl 2 hi number {} from thread",i );
thread::sleep(Duration::from_millis(1));
}
}
);
print!("main thread finish!");
handle.join().unwrap();
handle2.join().unwrap();
}
#[test]
fn class_f(){
pub struct AveragedCollection{
list:Vec<i32>,
average:f64,
}
impl AveragedCollection {
pub fn add(&mut self, value:i32){
self.list.push(value);
self.update_average();
}
pub fn remove(&mut self) -> Option<i32>{
let result = self.list.pop();
match result {
Some(value)=>{
self.update_average();
Some(value)
},
None => None,
}
}
pub fn average(&self)-> f64{
self.average
}
fn update_average(&mut self){
let total :i32 = self.list.iter().sum();
self.average = total as f64 / self.list.len() as f64;
}
}
}
*********************
Hash :f4e93d8c6d3abfcbd4f09f88a097987f8137f75c
Type: Tree
100644 blob ea8c4bf7f35f6f77f75d92ad8ce8349f6e81ddba .gitignore
100644 blob 45ee13a5634e1f9ba85951800397b38b788d9934 Cargo.lock
100644 blob 1c6ec4271e3e75b585e8d150f9758e4ee4890dd5 Cargo.toml
40000 tree bdcf98368efbd51703c7c187d6eed98783fa6e95 src
100644 blob d6d3d4c3a95f4e699e57fa8d4c943e1fec5fcd58 test.txt
40000 tree a01a912d65f705e7d558b3aedb31eac566487495 tests
*********************
Hash :bb38d629e630c5b5 87a775f4b91a817 322 659
tree 1b99d2b1c6ce19ed3390037e8d0f67a42f0fbec4
parent 926ecfd1e2f3662d3e6010b622390a3de077ec03
author Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669038238
timezone:+0800
committer Name:Luxian
Email:<xiaoyang@isrc.iscas.ac.cn>
timestamp:1669038238
timezone:+0800
add test