Added ability for Stopwatch to be sent to an

ostream
This commit is contained in:
2020-02-02 12:02:26 -05:00
parent efa76caca8
commit 2a3c022136
2 changed files with 18 additions and 11 deletions

View File

@@ -17,34 +17,34 @@ int main(){
std::cout << "Test failed" << std::endl;
}
catch(mee::Stopwatch::invalidTimeResolution){
std::cout << "There was an invalid time resolution" << std::endl;
std::cout << "There was an invalid time resolution\n";
std::cout << "Test failed" << std::endl;
}
catch(mee::Stopwatch::timeBeforeStart){
std::cout << "Tried to get time before the stopwatch was started" << std::endl;
std::cout << "Tried to get time before the stopwatch was started\n";
std::cout << "Test failed" << std::endl;
}
catch(mee::Stopwatch::stopBeforeStart){
std::cout << "Tried to stop the stopwatch before it was started" << std::endl;
std::cout << "Tried to stop the stopwatch before it was started\n";
std::cout << "Test successful" << std::endl;
}
//Try to get the time on it without starting it
std::cout << "Testing the timeBeforeStart error" << std::endl;
try{
std::cout << timer.getStr() << std::endl;
std::cout << timer.getStr() << '\n';
std::cout << "Test failed" << std::endl;
}
catch(mee::Stopwatch::invalidTimeResolution){
std::cout << "There was an invalid time resolution" << std::endl;
std::cout << "There was an invalid time resolution\n";
std::cout << "Test failed" << std::endl;
}
catch(mee::Stopwatch::timeBeforeStart){
std::cout << "Tried to get time before the stopwatch was started" << std::endl;
std::cout << "Tried to get time before the stopwatch was started\n";
std::cout << "Test successful" << std::endl;
}
catch(mee::Stopwatch::stopBeforeStart){
std::cout << "Tried to stop the stopwatch before it was started" << std::endl;
std::cout << "Tried to stop the stopwatch before it was started\n";
std::cout << "Test failed" << std::endl;
}
@@ -56,19 +56,20 @@ int main(){
int num = cnt;
}
timer.stop();
std::cout << "It took " << timer.getStr() << " to complete this loop" << std::endl;
std::cout << "It took " << timer.getStr() << " to complete this loop\n";
std::cout << "It took " << timer << " to complete this loop\n";
std::cout << "Test successful" << std::endl;
}
catch(mee::Stopwatch::invalidTimeResolution){
std::cout << "There was an invalid time resolution" << std::endl;
std::cout << "There was an invalid time resolution\n";
std::cout << "Test failed" << std::endl;
}
catch(mee::Stopwatch::timeBeforeStart){
std::cout << "Tried to get time before the stopwatch was started" << std::endl;
std::cout << "Tried to get time before the stopwatch was started\n";
std::cout << "Test failed" << std::endl;
}
catch(mee::Stopwatch::stopBeforeStart){
std::cout << "Tried to stop the stopwatch before it was started" << std::endl;
std::cout << "Tried to stop the stopwatch before it was started\n";
std::cout << "Test failed" << std::endl;
}