未验证 提交 4c6d0d4c 编写于 作者: M mtripsky 提交者: GitHub

Fix bug #884 in TimeEnvelope of samples/led-more-blinking-lights (#990)

- the method IsLastMultiple(int value) did not use _count to correctly decide when the value is last multiple. 
-  simplified all methods returning bool, instead of returning true/false, it returns directly result of if check.
- it was tested against code snippet included in the bug description to test expected behavior.
上级 db4b4267
......@@ -58,31 +58,16 @@ internal class TimeEnvelope
public bool IsFirstMultiple(int value)
{
if (_time == value)
{
return true;
}
return false;
return _time == value;
}
public bool IsLastMultiple(int value)
{
if (_time - value == 0)
{
return true;
}
return false;
return _count - value == _time;
}
public bool IsMultiple(int value)
{
if (_time % value == 0)
{
return true;
}
return false;
return _time % value == 0;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册