forked from ChicoState/UnitTestPractice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassword.cpp.gcov
More file actions
74 lines (74 loc) · 2.69 KB
/
Copy pathPassword.cpp.gcov
File metadata and controls
74 lines (74 loc) · 2.69 KB
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
-: 0:Source:Password.cpp
-: 0:Graph:Password.gcno
-: 0:Data:Password.gcda
-: 0:Runs:1
-: 1:#include "Password.h"
-: 2:#include <string>
-: 3:
-: 4:using std::string;
-: 5:
-: 6:/*
-: 7: The function receives a string counts how many times the same character
-: 8: occurs at the beginning of the string, before any other characters (or the
-: 9: end of the string). The function is case-sensitive so 'Z' is different than
-: 10: 'z' and any ASCII characters are allowed.
-: 11:*/
function _ZN8Password24count_leading_charactersENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE called 8 returned 100% blocks executed 100%
8: 12:int Password::count_leading_characters(string phrase){
8: 13: int repetition = 1;
8: 14: int index = 0;
18: 15: while( index < phrase.length()-1 && phrase[index] == phrase[index+1] ){
call 0 returned 18
branch 1 taken 16 (fallthrough)
branch 2 taken 2
call 3 returned 16
call 4 returned 16
branch 5 taken 10 (fallthrough)
branch 6 taken 6
branch 7 taken 10
branch 8 taken 8 (fallthrough)
10: 16: repetition++;
10: 17: index++;
-: 18: }
8: 19: return repetition;
-: 20:}
-: 21:
-: 22:
-: 23:/*
-: 24: receives a string and returns whether it has both at least one upper-case
-: 25: letter and at least one lower-case letter
-: 26:*/
function _ZN8Password14has_mixed_caseENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE called 3 returned 100% blocks executed 96%
3: 27:bool Password::has_mixed_case(string pass){
3: 28: bool upper = false;
3: 29: bool lower = false;
9: 30: for(int i = 0; i < pass.size(); i++){
call 0 returned 9
branch 1 taken 6
branch 2 taken 3 (fallthrough)
6: 31: if(pass[i] >= 97 && pass[i] <= 122) lower = true;
call 0 returned 6
branch 1 taken 4 (fallthrough)
branch 2 taken 2
call 3 returned 4
branch 4 taken 4 (fallthrough)
branch 5 taken 0
branch 6 taken 4 (fallthrough)
branch 7 taken 2
2*: 32: else if(pass[i] >= 65 && pass[i] <= 90) upper = true;
call 0 returned 2
branch 1 taken 2 (fallthrough)
branch 2 taken 0
call 3 returned 2
branch 4 taken 2 (fallthrough)
branch 5 taken 0
branch 6 taken 2 (fallthrough)
branch 7 taken 0
-: 33: }
3: 34: if(upper == true && lower == true) return true;
branch 0 taken 2 (fallthrough)
branch 1 taken 1
branch 2 taken 2 (fallthrough)
branch 3 taken 0
1: 35: return false;
-: 36:}