`setPhase` is not working properly
NotLudovico opened this issue · comments
void TrafficLight<Id, Size, Delay>::setPhase(Delay phase) {
if (!m_delay.has_value()) {
throw std::runtime_error(buildLog("TrafficLight's delay has not been set."));
}
if (phase > m_delay.value().first + m_delay.value().second) {
phase -= m_delay.value().first + m_delay.value().second;
}
phase == 0 ? m_counter = 0 : m_counter = m_delay.value().first % phase;
}
Misused modulus operator