Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) TestStopwatch

 

TestStopwatch is a tool to test the Stopwatch class.

 

TestStopwatch is programmed in C++ using the IDE Qt Creator. It uses the Boost, Qt and STL libraries.

 

 

 

 

Downloads

 

 

 

 

 

 

Older downloads

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./ToolTestStopwatch/ToolTestStopwatchConsole.pro

 

include(../../ConsoleApplication.pri)
include(../../Libraries/Boost.pri)
include(../../Libraries/GeneralConsole.pri)

include(../../Classes/CppStopwatch/CppStopwatch.pri)

SOURCES += main.cpp

 

 

 

 

 

./ToolTestStopwatch/main.cpp

 

//---------------------------------------------------------------------------
/*
TestStopwatch, tool to test the Stopwatch class
Copyright (C) 2010 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolTestStopwatch.htm
//---------------------------------------------------------------------------
#include <cstdlib>
#include <iostream>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <boost/timer.hpp>

#include "stopwatch.h"
#pragma GCC diagnostic pop

int main()
{
  ribi::Stopwatch s;
  boost::timer t;
  std::system("./../ToolPause-build-desktop/Pause 5");
  std::cout
    << "Elapsed time (should be 5 seconds):\n"
    << "Stopwatch: " << s.elapsed() << " seconds\n"
    << "boost::timer: " << t.elapsed() << " milliseconds\n";
}

 

 

 

 

 

./ToolTestStopwatch/zip.sh

 

#!/bin/sh
#zip packs all the files to port into a single .zip file,
#minicking the same folder structure
#Folder structure
# *
#  * Classes
#    * CppStopwatch      <-- pack *.*
#  * Tools
#    * ToolTestStopwatch <-- pack *.*
echo "Mimicking file structure"
mkdir temp_zip
mkdir temp_zip/Classes
mkdir temp_zip/Classes/CppStopwatch
mkdir temp_zip/Tools
mkdir temp_zip/Tools/ToolTestStopwatch

echo "Copying files"
cp ../../Tools/ToolTestStopwatch/*.* temp_zip/Tools/ToolTestStopwatch
cp ../../Classes/CppStopwatch/*.* temp_zip/Classes/CppStopwatch

echo "Compressing files"
cd temp_zip

zip -r ToolTestStopwatchSource_1_1 Classes
zip -r ToolTestStopwatchSource_1_1 Tools

echo "Copying zipped file from temp folder to this folder"

cd ..
cp temp_zip/ToolTestStopwatchSource_1_1.zip ToolTestStopwatchSource_1_1.zip

echo "Cleaning up"
rm temp_zip/Classes/CppStopwatch/*.*
rmdir temp_zip/Classes/CppStopwatch
rmdir temp_zip/Classes
rm temp_zip/Tools/ToolTestStopwatch/*.*
rmdir temp_zip/Tools/ToolTestStopwatch
rmdir temp_zip/Tools
rm temp_zip/*.*
rmdir temp_zip
echo "Done"

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml