-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #8 - Effort in string can be converted to integer minutes #9
base: master
Are you sure you want to change the base?
Conversation
6fdb683
to
17af893
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very complicated. I am thinking, probably we should reduce the feature requirement of this particular function. Lets discuss this on the ML.
src/util.cxx
Outdated
NAMESPACE__THITTAM_UTIL__START | ||
|
||
|
||
std::string getString(const std::string &s, unsigned &pos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We use 'snake_case' for function and variable names. So, please keep with that consistently.
- See how we place curly braces in the start of the function, in other code. Please maintain the same for consistency.
src/util.cxx
Outdated
bool sign = 0; | ||
|
||
if (s[pos] == '-') | ||
sign = true, pos++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if a block (if/for/while/) is only one line, you should include curly braces.
src/util.cxx
Outdated
bool sign = 0; | ||
|
||
if (s[pos] == '-') | ||
sign = true, pos++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be two statements.
src/util.cxx
Outdated
for (unsigned i = 0; i < effort.length(); ++i) | ||
{ | ||
|
||
while (isspace(effort[i])) i++; // Skip space |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should NEVER do this. This is very tricky for readability. Its much better to just 'continue'. That way the control of the iteration is in one place, i..e the 'for'.
src/util.cxx
Outdated
case 'd': // day | ||
minutes += 60.0 * hours_per_day * currentNumber; | ||
break; | ||
case 'h': minutes += 60.0 * currentNumber; break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One statement per line.
Added tests and tests/CMakeLists.txt
Added
tests/CMakeLists.txt
andtests/main.cxx