GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixTex2Html/src/PLatexObj/update_newLine.cpp
Date: 2025-03-24 18:12:43
Exec Total Coverage
Lines: 18 18 100.0%
Branches: 12 12 100.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7
8 #include "update_newLine.h"
9
10 ///Update the new lines to ensure there are new two following
11 /** @param[out] obj : PLatexObj to be updated
12 * @param[out] isPrevNewLine : true if the previous PLatexObj was a new line too
13 */
14 18218 void updateNewLineBase(PLatexObj & obj, bool & isPrevNewLine){
15
1/1
✓ Branch 1 taken 18218 times.
18218 isPrevNewLine = isNewLine(obj);
16
1/1
✓ Branch 1 taken 18218 times.
18218 PVecLatexObj & vecObj = obj.getVecContent();
17 18218 PVecLatexObj::iterator it(vecObj.begin());
18
2/2
✓ Branch 2 taken 21216 times.
✓ Branch 3 taken 18218 times.
39434 while(it != vecObj.end()){
19
3/3
✓ Branch 2 taken 21216 times.
✓ Branch 4 taken 3125 times.
✓ Branch 5 taken 18091 times.
21216 if(isNewLine(*it)){
20
2/2
✓ Branch 0 taken 360 times.
✓ Branch 1 taken 2765 times.
3125 if(isPrevNewLine){ //We remove the current new line because there is one before
21
1/1
✓ Branch 2 taken 360 times.
360 it = vecObj.erase(it);
22 }else{
23 2765 ++it;
24 }
25 3125 isPrevNewLine = true;
26 }else{
27 18091 isPrevNewLine = false; //Ok for clarity but useless for computing
28
1/1
✓ Branch 2 taken 18091 times.
18091 updateNewLineBase(*it, isPrevNewLine);
29 18091 ++it;
30 }
31 }
32 18218 }
33
34 ///Update the new lines to ensure there are new two following
35 /** @param[out] obj : PLatexObj to be updated
36 */
37 127 void updateNewLine(PLatexObj & obj){
38 127 bool isPrevNewLine(false);
39
1/1
✓ Branch 1 taken 127 times.
127 updateNewLineBase(obj, isPrevNewLine);
40 127 }
41
42
43