@@ -6,16 +6,16 @@ use std::path::Path;
66fn  test_commit_count ( )  { 
77    let  repo = Repository :: open ( Path :: new ( "./tests/repo" ) . to_path_buf ( ) ) . unwrap ( ) ; 
88    let  commits = Repo :: commits ( & repo) . unwrap ( ) ; 
9-     assert_eq ! ( commits. len( ) ,  4 ) ; 
9+     assert_eq ! ( commits. len( ) ,  5 ) ; 
1010} 
1111
1212#[ test]  
1313fn  test_example_repo ( )  { 
1414    let  repo = Repo :: new ( Path :: new ( "./tests/repo" ) ) . unwrap ( ) ; 
1515
16-     assert_eq ! ( repo. authors. len( ) ,  2 ) ; 
17-     assert_eq ! ( repo. total_commits,  4 ) ; 
18-     assert_eq ! ( repo. total_curses,  6 ) ; 
16+     assert_eq ! ( repo. authors. len( ) ,  3 ) ; 
17+     assert_eq ! ( repo. total_commits,  5 ) ; 
18+     assert_eq ! ( repo. total_curses,  7 ) ; 
1919
2020    let  john = repo. authors . get ( "John Doe" ) . unwrap ( ) ; 
2121    assert_eq ! ( john. total_curses,  2 ) ; 
@@ -29,4 +29,22 @@ fn test_example_repo() {
2929    assert_eq ! ( me. curses. get( "fuck" ) . unwrap( ) ,  & 1 ) ; 
3030    assert_eq ! ( me. curses. get( "fucking" ) . unwrap( ) ,  & 1 ) ; 
3131    assert_eq ! ( me. curses. get( "shitty" ) . unwrap( ) ,  & 1 ) ; 
32+ 
33+     let  ola = repo. authors . get ( "Ola Nordmann" ) . unwrap ( ) ; 
34+     assert_eq ! ( ola. total_curses,  2 ) ; 
35+     assert_eq ! ( ola. total_commits,  1 ) ; 
36+     assert_eq ! ( ola. curses. get( "fucking" ) . unwrap( ) ,  & 1 ) ; 
37+     assert_eq ! ( ola. curses. get( "bitch" ) . unwrap( ) ,  & 1 ) ; 
38+ } 
39+ 
40+ #[ test]  
41+ fn  test_curse_total ( )  { 
42+     let  repo = Repo :: new ( Path :: new ( "./tests/repo" ) ) . unwrap ( ) ; 
43+     let  total:  usize  = repo
44+         . authors 
45+         . values ( ) 
46+         . map ( |a| a. curses . values ( ) . sum :: < usize > ( ) ) 
47+         . sum ( ) ; 
48+ 
49+     assert_eq ! ( total,  repo. total_curses) ; 
3250} 
0 commit comments